26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
//! #356 regression: a TCC-standalone daemon must never access ~/Documents.
|
|
//!
|
|
//! Thin wrapper around `tests/tcc_sandbox.sh`, which boots the foreground daemon
|
|
//! under a macOS sandbox that SIGKILLs on any `~/Documents` access (see that
|
|
//! script for the full rationale). It only runs when explicitly requested —
|
|
//! it needs macOS, `sandbox-exec`, and process spawning — mirroring the
|
|
//! empirical method used to root-cause #356.
|
|
//!
|
|
//! Run it with:
|
|
//! `LEAN_CTX_TCC_SANDBOX_TEST=1` cargo test --test `tcc_sandbox` -- --nocapture
|
|
|
|
#[test]
|
|
fn tcc_standalone_daemon_never_touches_documents() {
|
|
if std::env::var("LEAN_CTX_TCC_SANDBOX_TEST").as_deref() != Ok("1") {
|
|
eprintln!("SKIP: set LEAN_CTX_TCC_SANDBOX_TEST=1 to run (macOS only)");
|
|
return;
|
|
}
|
|
if !cfg!(target_os = "macos") {
|
|
eprintln!("SKIP: macOS only (TCC is a macOS feature)");
|
|
return;
|
|
}
|
|
|
|
let script = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/tcc_sandbox.sh");
|
|
let status = std::process::Command::new("bash")
|
|
.arg(script)
|
|
.env("LEAN_CTX_BIN", env!("CARGO_BIN_EXE_lean-ctx"))
|
|
.env("LEAN_CTX_TCC_SANDBOX_TEST", "1")
|
|
.status()
|
|
.expect("failed to spawn tests/tcc_sandbox.sh");
|
|
|
|
assert!(
|
|
status.success(),
|
|
"tcc_sandbox.sh failed: a TCC-standalone boot path accessed ~/Documents (#356)"
|
|
);
|
|
}
|