Skip to content

fix: post-1.0.0 audit remediation — close the code-pack I2 bypass + 19 P11/P12 defects#53

Merged
RNT56 merged 3 commits into
mainfrom
fix/p11-p12-audit-remediation
Jun 21, 2026
Merged

fix: post-1.0.0 audit remediation — close the code-pack I2 bypass + 19 P11/P12 defects#53
RNT56 merged 3 commits into
mainfrom
fix/p11-p12-audit-remediation

Conversation

@RNT56

@RNT56 RNT56 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

A full adversarial audit of the merged P11 (artifact factory) + P12 (verified swarm) surface (28.6k lines, 8 reviewers → independent verify → synthesis) found 20 confirmed defects (1 refuted). All are fixed here. Invariants I1–I7 hold throughout — confirmed independently (backend.go byte-identical, go.mod unchanged, zero Charm in the default binary, no host-side reach).

v1.0.0 was cut before this audit ran, so it shipped with the blocker below. This is a post-1.0.0 patch.

🔴 Blocker (1)

  • Code-pack flag injection bypassed the verifier (I2 erosion). validateSelector accepted a leading dash, so a worker Evidence.Value of -run=^$ ran go test -run=^$, selected zero tests, exited 0, and laundered a green verdict on the default swarm path. Fix: reject a leading - + insert a literal -- separator (defense in depth); a test asserts -run=^$/--list are Unverifiable with no box call.

🟠 Major (8)

  • Finance keyed checks could never pass — the key var was single-quoted, so sh never expanded it. Resolved key-bearing URL now rides a double-quoted $NILCORE_KEYED_URL env var; key stays out of the command/SourceURL/events (I3). (This is a P11 bug a masking test hid — the deep audit caught what the first targeted pass missed.)
  • Swarm false-RED on repeat runs — collate root was the persistent --dir; a stale artifact blocked a fresh green run. Now namespaced per run (.nilcore/swarm/<runID>, git-ignored).
  • Pool cap-sharingeffectiveCap keyed on the raw tier spec while the stack cache keyed on the resolved primary, so an inherited strong tier got an uncapped second stack. Now keyed on the resolved primary.
  • --egress-allow was a dead flag — now applied to the worker box via roster.EgressFor (narrow-only, R9).
  • TipSHA feedback seam absentIntegrateFunc now threads baseRef=st.TipSHA so each pass folds onto the prior verified tip (was re-integrating from HEAD every pass).
  • 3 masking tests (TipSHA, benchmark I2-guarantee, finance keyed) rewritten to actually discriminate.

🟡 Minor (8) + Polish (3)

Hard MaxPasses + no-progress rails; board status/src routed through a shared redactor+sanitizer; dead source-claim trace surface deleted; non-recording budget-headroom check; ShipGate nil-guard + honest docstring; audit reproduction anchored at the cited line; runner cap-binding test with a fan-in barrier; lying-green non-convergence test; pool sentinel no-key-leak test; stale comments corrected.

Verification

make verify green · go test -race ./internal/swarm/... ./internal/pool/ green · go.mod/go.sum unchanged (I6) · every strengthened test passes (the guarantees are now guarded, not asserted). Reviewed the four structural fixes (blocker, finance I3, pool keying, swarm tip-threading) by hand + reproduction.

📝 docs/SWARM.md deltas to apply (kept out of this PR to avoid colliding with the docs workstream)

  • §7.1 — the board source-claim trace surface (board.Traces()/ShardOutcome trace) is removed; the real source→claim trace flows via report.ClaimTraces → render.RenderMatrix.
  • Termination rails — document the absolute HardMaxPasses (default 50) backstop and the no-progress "stalled" rail (two passes resolving zero new red units).
  • Budget — the per-pass global headroom check is now non-recording (Total() vs GlobalCeiling), no sub-cent probe residue.
  • Collate root — now .nilcore/swarm/<runID> (git-ignored), isolating runs.
  • finance.fred_series / audit.finding_reproduces wording — keyed reach via $NILCORE_KEYED_URL; reproduction now anchors at the cited line (±2).

🤖 Generated with Claude Code

RNT56 and others added 3 commits June 20, 2026 20:20
From the post-1.0.0 adversarial audit of the P11+P12 surface:

- BLOCKER: code pack flag-injection (internal/artifact/packs/code) — validateSelector
  accepted a leading dash, so a worker Evidence.Value of '-run=^$' ran 'go test -run=^$',
  selected zero tests, exited 0, and laundered a GREEN verdict past the verifier (I2).
  Now rejects a leading '-' AND inserts a literal '--' positional separator (defense in
  depth); a test asserts '-run=^$'/'--list' are Unverifiable with no box call.
- MAJOR: finance keyed checks could never pass — the key var was single-quoted so sh
  never expanded it. The fully-resolved key-bearing URL now rides a double-quoted
  $NILCORE_KEYED_URL env var (key only in the env map; command string, persisted
  SourceURL and events stay key-free, I3). A real-shell test proves expansion.
- MAJOR: pool shared-cap bug — effectiveCap keyed on the raw tier Spec while the stack
  cache keyed on the resolved primary, so an inherited strong tier (the default swarm
  path) got a second, uncapped stack. Now keyed on the resolved primary.
- Test hardening (the masking-test class that hid these): benchmark now asserts the
  in-box re-measure governs when worker samples DISAGREE; finance shells out for real;
  audit anchors reproduction at the cited line (±2); pool pins I3 no-key-leak with a
  sentinel credential.

make verify green; go.mod/go.sum unchanged (I6).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rd redaction

From the post-1.0.0 audit of the verified-swarm subsystem:

- MAJOR: collate root was the persistent --dir repo, so requeue.Scan ingested a stale
  red artifact from an abandoned run and a fresh fully-green run false-RED'd
  (exhausted/exit 1). Now namespaced per run at .nilcore/swarm/<runID> (git-ignored).
- MAJOR: --egress-allow was a dead flag (stored, never read). Now applied to the worker
  box via roster.EgressFor (narrow-only intersection, R9 preserved).
- MAJOR: TipSHA feedback seam — Integrator.BaseRef was never set, so every pass
  re-integrated the whole green set from HEAD and persisted TipSHA was dead on resume.
  swarm.IntegrateFunc now threads baseRef=st.TipSHA so each pass folds onto the prior
  verified tip (tip stays verifier-green, I2). The masking test now drives a 2-pass run
  and asserts pass-2 receives pass-1's verified SHA.
- MINOR: hard MaxPasses backstop + a no-progress 'stalled' rail bound a claim-rotating
  worker; board status/src routed through a shared redactor+sanitizer (I3/I7); dead
  board source-claim trace surface deleted (the real trace flows via report.ClaimTraces);
  non-recording budget-headroom check (no sub-cent probe residue); ShipGate nil-guard +
  honest docstring; a lying-green (res.Passed=true, disk Fail) non-convergence test; a
  fan-in barrier proving the runner cap binds.

make verify + go test -race green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@RNT56 RNT56 merged commit e197069 into main Jun 21, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant