From 70d916d69823d4414693807afb0c91c6d61efd6e Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 20 Nov 2026 23:21:09 +0800 Subject: [PATCH] test(security): assert strict refuses TCP resources and --allow-net - G-C lane now runs a .mq.md TCP resource open under strict and requires permission.denied, and rejects the --allow-net grant at the strict flag boundary. - Complements the existing file-resource refusal and host TCP strict test. --- tests/security/run-lane.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/security/run-lane.sh b/tests/security/run-lane.sh index fae32fc..802f3fa 100755 --- a/tests/security/run-lane.sh +++ b/tests/security/run-lane.sh @@ -78,6 +78,27 @@ grep -q "permission.denied" .cache/security/file-resource.err || { exit 1 } +cat > .cache/security/tcp-resource.mq.md <<'MQ' +## main + +> resource.open("tcp", "127.0.0.1:9", ["read", "write"]) + +*None* +MQ +set +e +"$bin" run .cache/security/tcp-resource.mq.md --mode strict >/dev/null 2>.cache/security/tcp-resource.err +code=$? +set -e +if [ "$code" -eq 0 ]; then + echo "error: strict accepted a TCP resource" >&2 + exit 1 +fi +grep -q "permission.denied" .cache/security/tcp-resource.err || { + echo "error: strict TCP-resource refusal had no permission.denied diagnostic" >&2 + cat .cache/security/tcp-resource.err >&2 + exit 1 +} + echo "== external-execution surfaces are refused ==" reject() { set +e @@ -92,6 +113,7 @@ reject() { reject --allow-foreign reject --allow-read 'data/**' reject --allow-write 'data/**' +reject --allow-net 127.0.0.1 reject --trust-native-plugin --plugin examples/plugin-demo/build reject --kernel examples/kernel-mock/kernel.json reject --trace-file /tmp/marqdo-trace.json