forked from bchanot/claude
fix(doctrine): security readers take DEGRADED off the TOOL line, not the VERDICT line
The auditor prints VERDICT: PASS on a DEGRADED scan, so the three parse lists read it as a clean PASS. The PASS branch now reads the TOOL line first, a PASS without one is structural, and loops-light locks it.
This commit is contained in:
1 parent
c7d3677350
commit
981472033a
5 files changed
+44
-15
No files matched your search
@@ -182,14 +182,16 @@ In audit mode, ALSO write this same block (plus per-finding detail) to
|
|||||||
- Dispatch a FRESH auditor each iteration — no context reuse. Input = mode +
|
- Dispatch a FRESH auditor each iteration — no context reuse. Input = mode +
|
||||||
scope + (report) + (context), nothing else.
|
scope + (report) + (context), nothing else.
|
||||||
- Parse the `SECURITY — VERDICT:` line:
|
- Parse the `SECURITY — VERDICT:` line:
|
||||||
- `PASS` → proceed (to commit / next step).
|
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||||
|
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||||
|
is a structural failure (below). Then proceed (to commit / next
|
||||||
|
step); a DEGRADED PASS also surfaces the checklist result +
|
||||||
|
recommends `make plugin` (the tool's absence never blocks).
|
||||||
- `BLOCK(n)` → the dev subagent receives the BLOCKING list + the contract
|
- `BLOCK(n)` → the dev subagent receives the BLOCKING list + the contract
|
||||||
path. After the fix: re-verify the REQUEST first (verifier), THEN re-run
|
path. After the fix: re-verify the REQUEST first (verifier), THEN re-run
|
||||||
this gate — in that order. Max 3 security iterations → STOP + human
|
this gate — in that order. Max 3 security iterations → STOP + human
|
||||||
escalation with the BLOCKING table.
|
escalation with the BLOCKING table.
|
||||||
- `DEGRADED` (semgrep absent) → does NOT block; surface the checklist
|
|
||||||
result + recommend `make plugin`. A DEGRADED BLOCK (grep-caught
|
|
||||||
hardcoded secret etc.) blocks like any other.
|
|
||||||
- Structural failure (`ERROR(…)`, missing/duplicated VERDICT line,
|
- Structural failure (`ERROR(…)`, missing/duplicated VERDICT line,
|
||||||
unparsable, crash, PASS without PROOF) → retry ONCE fresh; 2nd
|
unparsable, crash, PASS without PROOF or without `TOOL:` line) →
|
||||||
structural failure → human escalation. A mute auditor is never a PASS.
|
retry ONCE fresh; 2nd structural failure → human escalation. A mute
|
||||||
|
auditor is never a PASS.
|
||||||
+2
-1
@@ -124,7 +124,8 @@ triggers in CLAUDE.global.md § Workflow):
|
|||||||
security PASS (not DEGRADED), each on its first attempt (any other
|
security PASS (not DEGRADED), each on its first attempt (any other
|
||||||
verdict, a retry, a loop iteration or a verdict no longer in view
|
verdict, a retry, a loop iteration or a verdict no longer in view
|
||||||
runs the call), their summary then reading
|
runs the call), their summary then reading
|
||||||
`skipped (gates clean on first pass)`. A skipped call discharges
|
`skipped (gates clean on first pass)`; DEGRADED shows on the
|
||||||
|
auditor's `TOOL:` line. A skipped call discharges
|
||||||
its point and the trigger it covers. In the six flows that run the
|
its point and the trigger it covers. In the six flows that run the
|
||||||
gates (feat, bugfix, ship-feature, init-project, a11y, guardrails),
|
gates (feat, bugfix, ship-feature, init-project, a11y, guardrails),
|
||||||
the main loop first prints the run's diff stat, a fix the answer
|
the main loop first prints the run's diff stat, a fix the answer
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ HSK="$REPO/skills/hotfix/SKILL.md"
|
|||||||
GSK="$REPO/skills/guardrails/SKILL.md"
|
GSK="$REPO/skills/guardrails/SKILL.md"
|
||||||
ASK="$REPO/skills/a11y/SKILL.md"
|
ASK="$REPO/skills/a11y/SKILL.md"
|
||||||
HSKL="$REPO/skills/hotfix/SKILL.md"
|
HSKL="$REPO/skills/hotfix/SKILL.md"
|
||||||
|
AUD="$REPO/agents/security-auditor.md"
|
||||||
|
EFF="$REPO/lib/effort-shift.md"
|
||||||
PASS=0; FAIL=0
|
PASS=0; FAIL=0
|
||||||
|
|
||||||
tf() { # tf <label> <file> <fixed-string>
|
tf() { # tf <label> <file> <fixed-string>
|
||||||
@@ -108,6 +110,25 @@ tf "hotfix no verifier" "$HSKL" "No verifier is dispatched at hotfix wei
|
|||||||
tf "hotfix skill has Agent" "$HSK" " - Agent"
|
tf "hotfix skill has Agent" "$HSK" " - Agent"
|
||||||
tf "hotfix dispatches hotfixer" "$HSKL" 'subagent_type="hotfixer"'
|
tf "hotfix dispatches hotfixer" "$HSKL" 'subagent_type="hotfixer"'
|
||||||
|
|
||||||
|
echo "── DEGRADED on the TOOL line, feat/bugfix skip (BUGS-FOUND:134) ──"
|
||||||
|
for f in "$FSK" "$BSK"; do
|
||||||
|
n=$(basename "$(dirname "$f")")
|
||||||
|
tf "$n skip not DEGRADED" "$f" "security PASS (not DEGRADED),"
|
||||||
|
tf "$n skip first attempt" "$f" "each on its first attempt;"
|
||||||
|
tf "$n skip out of view" "$f" "a verdict no longer in view runs the call."
|
||||||
|
tf "$n skip names TOOL" "$f" "auditor's \`TOOL:\` line, beside a PASS."
|
||||||
|
done
|
||||||
|
tf "effort-shift names TOOL" "$EFF" "auditor's \`TOOL:\` line. A skipped call"
|
||||||
|
for f in "$INC" "$AUD" "$HSKL"; do
|
||||||
|
n=$(basename "$(dirname "$f")")/$(basename "$f")
|
||||||
|
tf "$n PASS reads TOOL" "$f" "\`PASS\` → read the \`TOOL:\` line first"
|
||||||
|
tf "$n DEGRADED off VERDICT" "$f" "never on the VERDICT line;"
|
||||||
|
tf "$n no TOOL structural" "$f" "a PASS with no \`TOOL:\` line"
|
||||||
|
tf "$n structural (below)" "$f" "structural failure (below)"
|
||||||
|
tn "$n DEGRADED no verdict" "$f" "\`DEGRADED\`"
|
||||||
|
tn "$n DEGRADED no branch" "$f" "DEGRADED (semgrep absent) →"
|
||||||
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||||
[ "$FAIL" -eq 0 ]
|
[ "$FAIL" -eq 0 ]
|
||||||
@@ -110,7 +110,11 @@ stdout-only, no Write).
|
|||||||
|
|
||||||
Parse its single `SECURITY — VERDICT:` line:
|
Parse its single `SECURITY — VERDICT:` line:
|
||||||
|
|
||||||
- `PASS` → done, proceed to commit.
|
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows
|
||||||
|
there, never on the VERDICT line; a PASS with no `TOOL:` line is a
|
||||||
|
structural failure (below). Then done, proceed to commit; a DEGRADED
|
||||||
|
PASS also surfaces the checklist result + recommends `make plugin`
|
||||||
|
(the tool's absence never blocks).
|
||||||
- `BLOCK(n)` → hand the dev the `BLOCKING` list + the CONTRACT path
|
- `BLOCK(n)` → hand the dev the `BLOCKING` list + the CONTRACT path
|
||||||
(re-dispatch a FRESH executor, never fix by hand). Then re-run GATE 0, then
|
(re-dispatch a FRESH executor, never fix by hand). Then re-run GATE 0, then
|
||||||
**re-verify the REQUEST first** (GATE 1, fresh verifier) — a security fix
|
**re-verify the REQUEST first** (GATE 1, fresh verifier) — a security fix
|
||||||
@@ -123,9 +127,6 @@ Parse its single `SECURITY — VERDICT:` line:
|
|||||||
the main loop calls it before the re-dispatch
|
the main loop calls it before the re-dispatch
|
||||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||||
in the dev brief.
|
in the dev brief.
|
||||||
- `DEGRADED` (semgrep absent) → does NOT block on the tool's absence; surface
|
|
||||||
the checklist result + recommend `make plugin`. A DEGRADED run that still
|
|
||||||
BLOCKs (grep-caught secret/injection) blocks like any other.
|
|
||||||
- Structural failure → retry ONCE fresh; 2nd → human escalation. A mute
|
- Structural failure → retry ONCE fresh; 2nd → human escalation. A mute
|
||||||
auditor is NEVER a PASS.
|
auditor is NEVER a PASS.
|
||||||
A 2nd structural failure with no main-loop advisor call since GATE 0
|
A 2nd structural failure with no main-loop advisor call since GATE 0
|
||||||
|
|||||||
@@ -180,16 +180,20 @@ Parse the `HOTFIX-EXEC REPORT`:
|
|||||||
fresh dispatch, never inline-load: the repo convention and the FRESH
|
fresh dispatch, never inline-load: the repo convention and the FRESH
|
||||||
requirement both forbid it) with `MODE: gate`, `SCOPE:` the working-tree
|
requirement both forbid it) with `MODE: gate`, `SCOPE:` the working-tree
|
||||||
diff vs `$PRE`. Parse its `SECURITY — VERDICT:` line:
|
diff vs `$PRE`. Parse its `SECURITY — VERDICT:` line:
|
||||||
- `PASS` (or `DEGRADED` with no BLOCK) → proceed to commit.
|
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||||
|
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||||
|
is a structural failure (below). Then proceed to commit; a DEGRADED
|
||||||
|
PASS sets the summary's SECURITY field to `DEGRADED (checklist only)`.
|
||||||
- `BLOCK(n)` → this is hotfix: do NOT loop. Revert ONLY the executor's
|
- `BLOCK(n)` → this is hotfix: do NOT loop. Revert ONLY the executor's
|
||||||
files (`git restore --source=$PRE -- <FILE(S)>` + delete report-listed
|
files (`git restore --source=$PRE -- <FILE(S)>` + delete report-listed
|
||||||
NEW files), print the `BLOCKING` list, and STOP:
|
NEW files), print the `BLOCKING` list, and STOP:
|
||||||
`"Hotfix introduced a security finding. Reverted. Escalate to /bugfix
|
`"Hotfix introduced a security finding. Reverted. Escalate to /bugfix
|
||||||
for a fix under the full verify+security loop."` The hotfix model is
|
for a fix under the full verify+security loop."` The hotfix model is
|
||||||
one attempt; any gate failure (smoke OR security) reverts and escalates.
|
one attempt; any gate failure (smoke OR security) reverts and escalates.
|
||||||
- Structural failure (mute / unparsable / no VERDICT line) → treat as a
|
- Structural failure (mute / unparsable / no VERDICT line / PASS with
|
||||||
failed gate: retry ONCE fresh; a 2nd structural failure → revert +
|
no `TOOL:` line) → treat as a failed gate: retry ONCE fresh; a 2nd
|
||||||
escalate. A mute auditor is never a PASS.
|
structural failure → revert + escalate. A mute auditor is never a
|
||||||
|
PASS.
|
||||||
3. Commit only after smoke AND security pass, message per
|
3. Commit only after smoke AND security pass, message per
|
||||||
`$HOME/.claude/lib/commit-message.md` (no convention: one subject line,
|
`$HOME/.claude/lib/commit-message.md` (no convention: one subject line,
|
||||||
`fix(<scope>): <what was wrong>`).
|
`fix(<scope>): <what was wrong>`).
|
||||||
|
|||||||
Reference in new issue
Block a user