Tree metadata (groups, icons, banners), viewer lifecycle fixes, deafen/loopback evidence, docs
ci / linux-x64 (push) Failing after 1m15s
ci / linux-arm64-cross (push) Failing after 1m55s

This commit is contained in:
omar committed 2026-10-24 03:39:00 +03:00
1 parent 7287fdb63e
commit ceb18f3fc9
27 files changed
+761 -56

No files matched your search

+22 -2
View File
@@ -28,6 +28,8 @@ struct Core {
child: Child,
stdin: ChildStdin,
lines: mpsc::Receiver<Value>,
/// Every stdout line, for secret-leak checks.
transcript: std::sync::Arc<std::sync::Mutex<String>>,
}
impl Core {
@@ -43,16 +45,19 @@ impl Core {
let stdin = child.stdin.take().unwrap();
let stdout = child.stdout.take().unwrap();
let (tx, lines) = mpsc::channel();
let transcript = std::sync::Arc::new(std::sync::Mutex::new(String::new()));
let t = transcript.clone();
std::thread::spawn(move || {
for line in BufReader::new(stdout).lines() {
let line = line.unwrap();
t.lock().unwrap().push_str(&line);
let v: Value = serde_json::from_str(&line).unwrap_or_else(|e| panic!("stdout is not JSON ({e}): {line}"));
if tx.send(v).is_err() {
break;
}
}
});
let mut core = Self { child, stdin, lines };
let mut core = Self { child, stdin, lines, transcript };
let ready = core.next();
assert_eq!(ready["event"], "ready");
assert_eq!(ready["protocol"], 1);
@@ -111,7 +116,12 @@ fn identity_lifecycle_over_stdio() {
assert_eq!(r["result"]["nickname"], "TeamsPeach-Smoke");
assert!(r["result"]["security_level"].as_u64().unwrap() >= 8);
assert!(events.iter().any(|e| e["event"] == "profile" && e["uid"] == uid.as_str()));
assert!(r.to_string().find("private").is_none(), "private key material leaked: {r}");
// The private key (as stored, i.e. what any accidental serialization would print) must never
// appear on stdout.
let stored: Value = serde_json::from_slice(&std::fs::read(dir.0.join("identity.json")).unwrap()).unwrap();
let private_key = stored["private_key"].as_str().unwrap().to_owned();
assert!(private_key.len() > 40);
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
let (r, _) = core.request("4", "profile_create", json!({ "nickname": "Other" }));
assert_eq!(r["error"]["code"], "profile_exists");
@@ -143,6 +153,7 @@ fn identity_lifecycle_over_stdio() {
core.send(json!({ "cmd": "audio_end" }));
let (r, _) = core.request("9", "set_audio", json!({ "input_muted": true }));
assert_eq!(r["result"], json!({ "input_muted": true, "output_muted": false, "transmitting": false }));
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
core.shutdown();
// Restart: same UID, renamed nickname persisted.
@@ -150,6 +161,7 @@ fn identity_lifecycle_over_stdio() {
let (r, _) = core.request("1", "profile_get", json!({}));
assert_eq!(r["result"]["uid"], uid.as_str());
assert_eq!(r["result"]["nickname"], "Renamed Smoke");
assert!(!core.transcript.lock().unwrap().contains(&private_key), "private key leaked to stdout");
core.shutdown();
// Export (allowed while a core runs) and import into a fresh data dir.
@@ -158,6 +170,14 @@ fn identity_lifecycle_over_stdio() {
let (code, v) = cli(&["identity".as_ref(), "export".as_ref(), "--data-dir".as_ref(), dir.0.as_os_str(), "--out".as_ref(), export_file.as_os_str()]);
assert_eq!(code, 0, "{v}");
assert_eq!(v["uid"], uid.as_str());
assert!(!v.to_string().contains(&private_key));
// The export carries the key (obfuscated TeamSpeak form); it must not reach stdout either.
let ini = std::fs::read_to_string(&export_file).unwrap();
let exported = ini.lines().find_map(|l| l.strip_prefix("identity=\"")).unwrap().trim_end_matches('"');
let exported_key = exported.split_once('V').unwrap().1.to_owned();
assert!(!v.to_string().contains(&exported_key));
assert!(!running.transcript.lock().unwrap().contains(&exported_key));
assert!(!running.transcript.lock().unwrap().contains(&private_key));
running.shutdown();
let other = TempDir::new("import");