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

+25
View File
@@ -53,6 +53,31 @@ echo "== positive CLI contract =="
"$bin" run examples/hello.mq.md --mode strict --json | python3 -c \
'import json,sys; d=json.load(sys.stdin); assert d["success"] is True'
echo "== strict language resources are console-only =="
mkdir -p .cache/security
cat > .cache/security/file-resource.mq.md <<'MQ'
## main
**内存 = memory.new(1, 1)**
> resource.open("file", "README.md", ["read"])
*None*
MQ
set +e
"$bin" run .cache/security/file-resource.mq.md --mode strict >/dev/null 2>.cache/security/file-resource.err
code=$?
set -e
if [ "$code" -eq 0 ]; then
echo "error: strict accepted a project file resource" >&2
exit 1
fi
grep -q "permission.denied" .cache/security/file-resource.err || {
echo "error: strict file-resource refusal had no permission.denied diagnostic" >&2
cat .cache/security/file-resource.err >&2
exit 1
}
echo "== external-execution surfaces are refused =="
reject() {
set +e