From 67a6d35daf7949fe33e086211ab4b4a7c09c069a Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 20 Nov 2026 23:08:23 +0800 Subject: [PATCH] docs(security): record CM-A11 strict resource verification - Checked-in raw G-C lane log for 00bdcad: 7/7 adversarial helper matrix, positive CLI (Compat-C print via bundled stdlib), strict file-resource refusal, external-surface rejection, forged-marker rejection, lane PASS. - Evidence documents the read-only /run/marqdo-stdlib bind, strict stdio-only policy, refused file/TCP/provider resources, and the remaining no-CI-URL / Windows/macOS limits. - STATUS updated to the current 426-test gate and 00bdcad strict result. Gate: fmt, clippy -D warnings, 426 tests passed; VM lane PASS. --- docs/STATUS.md | 26 ++++--- .../2026-11-20-strict-resource-cm-a11.log | 23 +++++++ .../2026-11-20-strict-resource-cm-a11.md | 69 +++++++++++++++++++ 3 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 docs/evidence/2026-11-20-strict-resource-cm-a11.log create mode 100644 docs/evidence/2026-11-20-strict-resource-cm-a11.md diff --git a/docs/STATUS.md b/docs/STATUS.md index 09503ed..8506c2f 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -40,12 +40,12 @@ byte-identical). cargo fmt --all -- --check PASS cargo clippy --workspace --all-targets -- -D warnings PASS cargo test --workspace --locked PASS - (47 test binaries, 0 failed; includes 7/7 Linux security tests) + 426 passed, 0 failed, 2 ignored; includes 7/7 Linux security tests ``` ### G-C security lane (disposable Ubuntu 26.04 VM, ordinary user `dev`) -Source: `git archive 8af7262` extracted in the VM (not the dev container). +Source: `git archive 00bdcad` extracted in the VM (not the dev container). Host: QEMU/TCG, kernel `7.0.0-43-generic`, `systemd-detect-virt --container` = `none`, bubblewrap 0.11.1 with `bwrap-userns-restrict`, uid 1000. @@ -59,7 +59,8 @@ Host: QEMU/TCG, kernel `7.0.0-43-generic`, `systemd-detect-virt --container` cargo test --workspace --locked (same archive): 47 ok, 0 failed ``` -Logs: [`evidence/2026-11-20-strict-gc-8af7262.md`](evidence/2026-11-20-strict-gc-8af7262.md). +Logs: [`evidence/2026-11-20-strict-resource-cm-a11.log`](evidence/2026-11-20-strict-resource-cm-a11.log) +and [`evidence/2026-11-20-strict-gc-8af7262.md`](evidence/2026-11-20-strict-gc-8af7262.md). This is still a **local VM lane**, not a self-hosted GitHub Actions security URL. ## 2. Work package status @@ -76,7 +77,7 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL | 7 | Independent Tool consumers | **Done locally** | `sample-view`/`sample-knowledge`/`sample-proof` E2E test | | 8 | lock v3 reproducibility | **Implemented; tamper test added** | `package_env` PASS | | 9 | Analysis/Trace/Tool/ABI/Foreign | **Implemented; supported-matrix bounded** | protocol tests, plugin/worker/foreign tests | -| 10 | Linux strict L1 | **VM PASS at 8af7262; no CI URL** | 7/7 + positive CLI | +| 10 | Linux strict L1 | **VM PASS at 00bdcad; no CI URL** | 7/7 + positive CLI + strict resource refusal | | 11 | Linux strict L2 | **NOT IMPLEMENTED / UNSUPPORTED** | strict rejects Worker/Foreign/native ABI | | 12 | Windows Native/Worker ABI | **UNSUPPORTED** | no Windows ABI artifact/claim | | 13 | RC artifact | **Linux candidate only; no release** | clean-install + checksums; macOS not built here | @@ -157,8 +158,8 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL `Memory`; stdout write is capability/output-budget checked and project-file read/write is path/grant checked; file writes buffer until `close` and never flush on drop; a `.mq.md` chunked copy loop reproduces a file without a - Rust `copy_file`; strict refuses every resource open until a provider is - verified. Semantic fixture 66 and CLI/host tests. + Rust `copy_file`; strict permits only the stdio console channel and refuses + file/TCP/provider resources (CM-A11 lane PASS). Semantic fixture 66 and CLI/host tests. - Minimal structure observation/construction (RFC-CM CM-A04, ADR-0023): value-semantics `list.append/concat`, `map.keys/has/get/set/remove`, Unicode scalar `text.codepoints`/`text.from_codepoint`, and non-negative @@ -170,15 +171,15 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL the Linux EAGAIN contract are UNVERIFIED on GitHub. G1/G2/G3 remain FAIL until a real run exists. 2. **G-C is VM-verified but not CI-signed.** No self-hosted security-lane URL - for 8af7262 exists. + for 00bdcad exists. 3. Windows Native/Worker ABI is explicitly UNSUPPORTED (no Windows `cc` fixture lane, Unix-gated worker tests). 4. `fs.write`, `net.request`, `process`, `clock`, `random` are not executed broker services; unsupported requests must return `capability.unavailable`. -5. Resource streams are a **P3 first slice** only: project-file read and - buffered write plus stdout, but no directories, network, process, device, - generic provider or stdlib `print` migration; strict refuses every - `resource.open` until the provider passes the isolation lane. +5. Resource streams cover project-file read/write, stdout, compatible print, + trusted in-process providers and IP-literal TCP; directories, process, + device, DNS/TLS/HTTP, UDP and provider packaging remain open. Strict permits + only stdio and refuses the rest (CM-A11 lane PASS). 6. uv/npm/venv provisioning is not implemented. Only a pre-provisioned, digest-pinned directory with a regular-file executable is supported. 7. No Windows/macOS RC archive exists from this host. The release-candidate @@ -242,6 +243,9 @@ user-written allocator is explicitly **not** claimed. - [`evidence/2026-11-20-tcp-endpoint.md`](evidence/2026-11-20-tcp-endpoint.md) — ADR-0034 blocking TCP endpoint, IP grants, DNS refusal, loopback host/CLI echo tests. +- [`evidence/2026-11-20-strict-resource-cm-a11.md`](evidence/2026-11-20-strict-resource-cm-a11.md) + — CM-A11 strict lane at `00bdcad`: 7/7 adversarial matrix, positive Compat-C + print, strict file-resource refusal, forged-marker rejection and raw log. - [`evidence/RELEASE_CANDIDATE_0.1.0_8af7262.md`](evidence/RELEASE_CANDIDATE_0.1.0_8af7262.md) — G0..G12 matrix and RC decision. - [`security-gate.md`](security-gate.md) — mechanism, attack matrix and strict diff --git a/docs/evidence/2026-11-20-strict-resource-cm-a11.log b/docs/evidence/2026-11-20-strict-resource-cm-a11.log new file mode 100644 index 0000000..181ed98 --- /dev/null +++ b/docs/evidence/2026-11-20-strict-resource-cm-a11.log @@ -0,0 +1,23 @@ +== adversarial helper matrix == + Finished `test` profile [unoptimized + debuginfo] target(s) in 0.90s + Running tests/security_linux.rs (target/debug/build/marqdo-sandbox/73fdd38fdea71ea2/out/security_linux-73fdd38fdea71ea2) + +running 7 tests +test strict_child_cannot_escape_via_proc_or_privileges ... ok +test strict_child_cannot_reach_the_network ... ok +test strict_child_cannot_read_host_files_but_reads_the_project ... ok +test strict_child_cannot_write_outside_or_into_the_project ... ok +test strict_child_identity_is_unprivileged_and_namespaced ... ok +test strict_supervisor_enforces_fd_and_process_limits ... ok +test strict_supervisor_enforces_memory_cpu_and_output_limits ... ok + +test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 7.80s + +== build CLI == + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.67s +strict mechanism: bubblewrap 0.11.1 (user/mount/PID/net/UTS/IPC namespaces + no-new-privs + rlimits) +== positive CLI contract == +== strict language resources are console-only == +== external-execution surfaces are refused == +== forged active marker is rejected == +G-C security lane: PASS diff --git a/docs/evidence/2026-11-20-strict-resource-cm-a11.md b/docs/evidence/2026-11-20-strict-resource-cm-a11.md new file mode 100644 index 0000000..132f792 --- /dev/null +++ b/docs/evidence/2026-11-20-strict-resource-cm-a11.md @@ -0,0 +1,69 @@ +# RFC-CM CM-A11 evidence: strict resource verification + +Date: 2026-11-20 (Asia/Shanghai) +Repository: `marqdo-cli` +Source under test: `git archive 00bdcad` (current HEAD) +Related: [ADR-0021](../adr/0021-linux-strict-isolation.md), +[ADR-0030](../adr/0030-print-compat-b-routing.md), +[ADR-0034](../adr/0034-tcp-resource-endpoint.md), +[STATUS §1](../STATUS.md). +Raw lane log: [`2026-11-20-strict-resource-cm-a11.log`](2026-11-20-strict-resource-cm-a11.log) + +## Environment + +Ubuntu 26.04 disposable QEMU/TCG VM, kernel 7.0.0-43-generic, ordinary user +`dev` (uid 1000), `systemd-detect-virt --container` = `none`, bubblewrap +0.11.1 with the packaged `bwrap-userns-restrict` profile. The dev container +cannot create namespaces, so this is VM-only evidence. + +## What was verified + +```text +./tests/security/run-lane.sh + adversarial helper matrix: 7 passed, 0 failed, 0 ignored + positive CLI contract: PASS + strict language resources are console-only: PASS + external-execution surfaces refused: PASS + forged active marker rejected: PASS + G-C security lane: PASS +``` + +The 7-test helper matrix covers: no host-file reads beyond `/project`, no +writes outside or into the project, no network, unprivileged namespaces, no +capability escalation, fd/process limits, and memory/CPU/output limits. + +The positive CLI contract runs `hello` (Compat-C `打印` through the bundled +stdlib), `factorial --mode strict`, multi-module, and `--json`. + +The new strict-resource check runs a `.mq.md` program that calls +`resource.open("file", "README.md", ["read"])` under `--mode strict`; the run +must be non-zero and the diagnostic must contain `permission.denied`. The +bundled stdlib is bind-mounted read-only at `/run/marqdo-stdlib` and its digest +is still verified in the child; this grants no new OS capability. + +## Policy verified in code/tests + +* Strict permits only `stdio/stdout` with console grant. +* Strict refuses project-file, TCP and registered-provider resource kinds; + `pure` refuses file/TCP/providers too. +* `--allow-read/--allow-write/--allow-foreign/--allow-plugin/--allow-net/ + --trace-file/--kernel/--trust-native-plugin` are rejected at the strict L1 + flag boundary. +* Strict permits the read-only bundled stdlib so `打印` works; file/network/ + process/device remain refused. +* TCP is project-only and strict refuses it (host tests), so the new TCP + endpoint does not widen strict L1. + +## Gate + +Local container: fmt/clippy/426 tests PASS. VM: 7/7 adversarial + full lane +PASS. Log is checked in; this is a **local VM lane**, not a self-hosted GitHub +Actions security URL and not Windows/macOS evidence. + +## Limits + +* No remote CI URL for `00bdcad`; G-C remains VM-verified, not CI-signed. +* Windows/macOS strict behavior is not exercised here. +* Strict L2 (Worker/Foreign/native plugin under real isolation) is still not + implemented; L1 refuses those surfaces. +* TCP/HTTP/DNS under strict are refused rather than isolated.