fix: post-1.0.0 audit remediation — close the code-pack I2 bypass + 19 P11/P12 defects#53
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.gobyte-identical,go.modunchanged, zero Charm in the default binary, no host-side reach).🔴 Blocker (1)
validateSelectoraccepted a leading dash, so a workerEvidence.Valueof-run=^$rango 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=^$/--listare Unverifiable with no box call.🟠 Major (8)
shnever expanded it. Resolved key-bearing URL now rides a double-quoted$NILCORE_KEYED_URLenv 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.)--dir; a stale artifact blocked a fresh green run. Now namespaced per run (.nilcore/swarm/<runID>, git-ignored).effectiveCapkeyed 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-allowwas a dead flag — now applied to the worker box viaroster.EgressFor(narrow-only, R9).IntegrateFuncnow threadsbaseRef=st.TipSHAso each pass folds onto the prior verified tip (was re-integrating from HEAD every pass).🟡 Minor (8) + Polish (3)
Hard
MaxPasses+ no-progress rails; boardstatus/srcrouted 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 verifygreen ·go test -race ./internal/swarm/... ./internal/pool/green ·go.mod/go.sumunchanged (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)
board.Traces()/ShardOutcometrace) is removed; the real source→claim trace flows viareport.ClaimTraces → render.RenderMatrix.HardMaxPasses(default 50) backstop and the no-progress "stalled" rail (two passes resolving zero new red units).Total()vsGlobalCeiling), no sub-cent probe residue..nilcore/swarm/<runID>(git-ignored), isolating runs.finance.fred_series/audit.finding_reproduceswording — keyed reach via$NILCORE_KEYED_URL; reproduction now anchors at the cited line (±2).🤖 Generated with Claude Code