fix(strict): bind the bundled stdlib and verify strict resources

- Strict child now gets the verified stdlib tree read-only at
  /run/marqdo-stdlib with MARQDO_STDLIB_DIR set, so Compat-C 打印 works under
  strict without exposing a host path (ADR-0021 update).
- Add a strict-lane negative: resource.open(file) is refused with
  permission.denied; hello/factorial/multi-module and --json still pass.
- StrictHostCommand gains stdlib_dir; CLI discovers the bundle and sandbox
  binds it; sandbox tests constructors updated.

Evidence: G-C lane PASS on the disposable Ubuntu 26.04 VM (7/7 adversarial
matrix, positive CLI, strict language-resource refusal, forged marker), plus
fmt/clippy/423 local tests.
This commit is contained in:
cflmy committed 2026-11-20 22:57:49 +08:00
1 parent 1be4662049
commit 1d87f98539
9 files changed
+65 -4

No files matched your search

+5
View File
@@ -682,6 +682,10 @@ fn launch_strict_process(
.unwrap_or(1024 * 1024)
.min(64 * 1024 * 1024);
let timeout = Duration::from_secs(settings.timeout.unwrap_or(30));
let stdlib_dir = crate::stdlib::StdlibBundle::discover()
.ok()
.flatten()
.map(|bundle| bundle.root().to_path_buf());
let command = marqdo_sandbox::StrictHostCommand {
program: &program,
args: &args,
@@ -690,6 +694,7 @@ fn launch_strict_process(
original_document: document,
output_limit,
timeout,
stdlib_dir: stdlib_dir.as_deref(),
};
match marqdo_sandbox::launch_strict(&command) {
Ok(code) => code,
+5
View File
@@ -89,6 +89,11 @@ impl StdlibBundle {
})
}
/// Bundle root.
pub fn root(&self) -> &Path {
&self.root
}
/// Declared stdlib version.
pub fn version(&self) -> &str {
&self.version