fix(portable): run the CLI on an 8 MiB thread and scope G3 tests
ci/woodpecker/push/woodpecker Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s
ci/woodpecker/push/woodpecker Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s
Windows gives the main thread 1 MiB, unlike Linux/macOS at 8 MiB. The bundled regex self-test overflowed that stack even though the same document passed on Linux, so run the CLI dispatch on an explicit 8 MiB thread on every platform. The macOS package test compared a raw temp path with a canonicalized one; on macOS /var is a symlink to /private/var. Compare canonical forms on both sides. The adversarial security matrix is G3-only: ordinary cargo test --workspace on a namespace-capable but non-disposable hosted runner turned G0 red. Make it opt-in (MARQDO_REQUIRE_STRICT_SECURITY=1 for the G3 lane, or MARQDO_RUN_STRICT_SECURITY=1 for a developer); the lane still requires the mechanism and fails on a missing one.
This commit is contained in:
1 parent
b898c419fe
commit
4265231a14
3 files changed
+48
-12
No files matched your search
+23
-3
@@ -367,8 +367,29 @@ struct SyncArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// The interpreter and the bundled pure stdlib recurse on the parse/execute
|
||||||
|
// path. Windows gives the main thread 1 MiB by default (Linux/macOS use
|
||||||
|
// 8 MiB), which overflowed on the regex self-test. Run the CLI on an
|
||||||
|
// explicit 8 MiB thread on every platform so behavior does not depend on
|
||||||
|
// the host's main-thread default.
|
||||||
|
const STACK_BYTES: usize = 8 * 1024 * 1024;
|
||||||
|
let code = match std::thread::Builder::new()
|
||||||
|
.name("marqdo-main".to_string())
|
||||||
|
.stack_size(STACK_BYTES)
|
||||||
|
.spawn(dispatch)
|
||||||
|
{
|
||||||
|
Ok(handle) => handle.join().unwrap_or(101),
|
||||||
|
Err(error) => {
|
||||||
|
eprintln!("error: cannot start the marqdo main thread: {error}");
|
||||||
|
1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::process::exit(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dispatch() -> i32 {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let code = match cli.command {
|
match cli.command {
|
||||||
Command::Init(args) => commands::init(args.dir.as_deref()),
|
Command::Init(args) => commands::init(args.dir.as_deref()),
|
||||||
Command::Check(args) => commands::check(
|
Command::Check(args) => commands::check(
|
||||||
args.file.as_deref(),
|
args.file.as_deref(),
|
||||||
@@ -433,6 +454,5 @@ fn main() {
|
|||||||
Command::PluginWorker(args) => {
|
Command::PluginWorker(args) => {
|
||||||
marqdo_plugin_abi::worker::serve(&args.manifest, &args.base_dir)
|
marqdo_plugin_abi::worker::serve(&args.manifest, &args.base_dir)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
std::process::exit(code);
|
|
||||||
}
|
}
|
||||||
@@ -1858,11 +1858,11 @@ capabilities:
|
|||||||
"project:\n name: p\n version: 0.1.0\n",
|
"project:\n name: p\n version: 0.1.0\n",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
// macOS temp_dir is `/var/folders/...` while canonicalize resolves the
|
||||||
|
// `/var -> /private/var` symlink; compare canonical forms on both sides.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
discover_root(&nested).unwrap(),
|
discover_root(&nested).unwrap().canonicalize().unwrap(),
|
||||||
dir.path()
|
dir.path().canonicalize().unwrap()
|
||||||
.canonicalize()
|
|
||||||
.unwrap_or_else(|_| dir.path().to_path_buf())
|
|
||||||
);
|
);
|
||||||
assert!(discover_root(Path::new("/")).is_none());
|
assert!(discover_root(Path::new("/")).is_none());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
//! supervisor used by `marqdo run --mode strict`, then exercise direct
|
//! supervisor used by `marqdo run --mode strict`, then exercise direct
|
||||||
//! syscalls for filesystem, network, process, privilege and resource escapes.
|
//! syscalls for filesystem, network, process, privilege and resource escapes.
|
||||||
//!
|
//!
|
||||||
//! They require a host where [`marqdo_sandbox::probe`] succeeds (Bubblewrap
|
//! They are **opt-in** so an ordinary `cargo test --workspace` on a
|
||||||
//! plus permitted user/mount/PID/net namespaces). On an incapable host they
|
//! namespace-capable but non-disposable host does not become a false G0 gate.
|
||||||
//! are skipped **unless** `MARQDO_REQUIRE_STRICT_SECURITY=1` is set, which the
|
//! Set `MARQDO_REQUIRE_STRICT_SECURITY=1` (the G-C lane does; a missing
|
||||||
//! G-C security lane must set so a missing mechanism can never count as a
|
//! mechanism then fails) or `MARQDO_RUN_STRICT_SECURITY=1` (developer opt-in;
|
||||||
//! pass.
|
//! an incapable host skips).
|
||||||
//!
|
//!
|
||||||
//! The helper path can be supplied with `MARQDO_SECURITY_HELPER` (used when
|
//! The helper path can be supplied with `MARQDO_SECURITY_HELPER` (used when
|
||||||
//! running this test binary inside the disposable security VM). Otherwise the
|
//! running this test binary inside the disposable security VM). Otherwise the
|
||||||
@@ -32,6 +32,15 @@ fn required() -> bool {
|
|||||||
== Some("1")
|
== Some("1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The adversarial matrix is G3-only. Ordinary `cargo test --workspace` on a
|
||||||
|
/// developer host or GitHub-hosted runner must not turn a namespace-capable but
|
||||||
|
/// non-disposable environment into a red G0 gate. The G3 lane sets
|
||||||
|
/// `MARQDO_REQUIRE_STRICT_SECURITY=1`; a developer can opt in with
|
||||||
|
/// `MARQDO_RUN_STRICT_SECURITY=1`.
|
||||||
|
fn enabled() -> bool {
|
||||||
|
required() || std::env::var("MARQDO_RUN_STRICT_SECURITY").ok().as_deref() == Some("1")
|
||||||
|
}
|
||||||
|
|
||||||
/// Compile the escape helper exactly once even when the test binary runs its
|
/// Compile the escape helper exactly once even when the test binary runs its
|
||||||
/// tests in parallel.
|
/// tests in parallel.
|
||||||
fn helper() -> Option<PathBuf> {
|
fn helper() -> Option<PathBuf> {
|
||||||
@@ -65,6 +74,13 @@ fn helper() -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup() -> Option<(PathBuf, PathBuf, PathBuf)> {
|
fn setup() -> Option<(PathBuf, PathBuf, PathBuf)> {
|
||||||
|
if !enabled() {
|
||||||
|
eprintln!(
|
||||||
|
"skipping strict security lane: set MARQDO_REQUIRE_STRICT_SECURITY=1 \
|
||||||
|
(G3) or MARQDO_RUN_STRICT_SECURITY=1 to opt in"
|
||||||
|
);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
if let Err(reason) = probe() {
|
if let Err(reason) = probe() {
|
||||||
if required() {
|
if required() {
|
||||||
panic!("G-C security lane requires strict isolation but probe failed: {reason}");
|
panic!("G-C security lane requires strict isolation but probe failed: {reason}");
|
||||||
|
|||||||
Reference in new issue
Block a user