feat(tool): negotiate protocols and verify the whole tool bundle (B-09 B-10)
- replace the hand-rolled version matcher with semver; require valid tool versions and marqdo ranges - declare SupportedProtocols (tool 1, analysis 2, trace 2) and negotiate tool Analysis/Trace declarations at install and dispatch; disjoint/empty sets fail closed with tool.protocol_incompatible - record a v2 whole-bundle manifest (path/size/sha256 + deterministic bundle digest), copy exactly that bundle into staging, re-verify it, and recompute it before every dispatch - reject auxiliary-file, extra-file, missing-file and entrypoint tampering, record/command mismatches, traversal and a source root record.json - remove tools by detaching with rename before deletion - expose negotiated protocol environment variables to declared tools - update tool-v1 and STATUS; add negotiation/bundle tests
This commit is contained in:
1 parent
d890686a2b
commit
9bceac910b
7 files changed
+449
-130
No files matched your search
+22
-1
@@ -150,6 +150,26 @@ Trace v2 (`spec/trace-v2.md`, `spec/schemas/trace-v2.schema.json`):
|
||||
* Tests: event module ownership, 20-event truncation of a 500-iteration loop,
|
||||
worker frame round-trip/EOF/partial/oversized/truncated cases.
|
||||
|
||||
### S3-A/H2-C Tool protocol record (current)
|
||||
|
||||
Tool Protocol hardening (`spec/tool-v1.md`):
|
||||
|
||||
* `semver` replaces the hand-rolled matcher. Tool versions and `marqdo`
|
||||
requirements must parse; malformed ranges/versions are rejected.
|
||||
* The core declares `SupportedProtocols { tool: 1, analysis: [2], trace: [2] }`.
|
||||
Declared Analysis/Trace lists are negotiated at both install and dispatch;
|
||||
empty or disjoint lists fail with `tool.protocol_incompatible`. Absent
|
||||
declarations remain valid and are not forced.
|
||||
* Installed records are `record_version: 2` with a whole-bundle file manifest
|
||||
(path, size, SHA-256) and a deterministic bundle digest. Dispatch recomputes
|
||||
the full bundle, rejects entrypoint/auxiliary/extra/missing-file tampering,
|
||||
requires the record command to match and the entrypoint to be listed.
|
||||
* Install copies exactly the verified bundle into staging, re-verifies it, and
|
||||
rejects a source package that ships a root `record.json`. Removal detaches
|
||||
the directory by rename before deleting it.
|
||||
* Tests cover accepted/rejected protocol declarations, auxiliary-file/extra-file
|
||||
tampering, entrypoint tampering and reserved `record.json`.
|
||||
|
||||
### M0.6 implementation progress
|
||||
|
||||
| Step | State | Evidence |
|
||||
@@ -159,10 +179,11 @@ Trace v2 (`spec/trace-v2.md`, `spec/schemas/trace-v2.schema.json`):
|
||||
| S2-A/H1-B source locations | **Done** | ADR-0017; `RuntimeError`/`CallFrame` carry `module_id`; callsite origin; CLI module-aware resolution with no entry fallback (see §S2-A/H1-B) |
|
||||
| S2-B/H2-A Analysis v2 | **Done** | logical project identity, resources array, machine-path-free diagnostics, emitted-bytes digest, v2 schema + independent consumer (see §S2-B/H2-A) |
|
||||
| S2-C/H2-B Trace v2 | **Done** | logical root/digest, module-owned events, bounded/truncated trace, independent consumer, hardened worker frames (see §S2-C/H2-B) |
|
||||
| S3-A/H2-C Tool protocol | **Done** | SemVer negotiation at install+dispatch, whole-bundle manifest/digest verification, atomic install/remove, reserved record file (see §S3-A/H2-C) |
|
||||
| R0 baseline + ADRs | **Done** | this section; `docs/adr/0008`–`0012`; full workspace gate |
|
||||
| R1 package-aware identity + callable registry | **Done for statics; superseded by S1 lock v3** | `ModuleId { instance, relative_path }`; `PackageResolver` path sources; lock v3 transitive graph (ADR-0016) replaces the flat v2 lock; `CallableRegistry` for builtins/marqdo/declared ABI exports; external manifest wiring is R2 |
|
||||
| R2 ABI/Kernel/Broker | **Done (worker = crash isolation)** | `KernelRegistry` external providers; complete-name export routing; `CapabilityBroker`; static `check --plugin`; multi-export C test; isolated worker with timeout/crash tests; host handle table. Native/worker are not an OS sandbox |
|
||||
| R3 Tool Protocol | **Done** | `tool install/list/remove`; unknown-command fallback; atomic local install; SHA/tamper checks; black-box tests for arbitrary names, Unicode args, conflicts, traversal and PATH hijacking |
|
||||
| R3 Tool Protocol | **Done (S3 hardened)** | `tool install/list/remove`; unknown-command fallback; SemVer + Analysis/Trace negotiation; whole-bundle digest verification; staged install and rename-based removal; black-box tests for arbitrary names, Unicode args, conflicts, traversal, PATH hijacking and bundle tampering |
|
||||
| R4 Analysis/Trace v2 | **Done** | `check --emit` Analysis v2 and `run/call --trace-file` Trace v2 with logical identity, resources, module-owned events, capacity bounds, schemas and independent Python consumers; stale-artifact removal; value redaction |
|
||||
| R5 environment/isolation | **Partial** | Pinned Git fetch with verified cache markers, transitive `@alias` resolution, full-closure atomic `.marqdo/env` materialization, foreign process-group cleanup. Strict OS isolation remains explicitly unavailable (fail-closed) |
|
||||
| R6 release/consumers | **Done for Linux** | examples for unknown-name Tool, multi-export plugin, external kernel and multi-version packages; Analysis/Trace/Tool JSON Schemas; CI Linux gate + Windows/macOS `cargo check`; R6 example tests |
|
||||
|
||||
Reference in new issue
Block a user