fix(security-gate): resolve tool-calls audit signature key mismatch
Root cause: tool-audit-lib.sh signs tool-calls-head.sig with a local RSA key (~/.casan/audit-keys/), but sign-audit-head.sh (called as a CI step) overwrites audit-public.pem with the Vault KMS public key. On the second run inside security-gate.sh, the local key still exists so audit-public.pem is NOT updated, leaving a Vault key vs local-key mismatch that causes verify-tool-audit.sh to exit 1. Fix 1 — sign-audit-head.sh: after signing the audit.jsonl chain via Vault KMS, also re-sign the tool-calls chain head with the same casan-audit-key. Both chains are now anchored to the same Vault public key in audit-public.pem. Fix 2 — run-casan4-harness-tests.sh: call sign-audit-head.sh just before the inline verify-tool-audit.sh check (line 217). This re-signs both chains with Vault KMS so the inline check sees anchor=signed instead of mismatched local key vs Vault pub. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
cf467ed829
commit
3e7690fe37
@@ -213,6 +213,12 @@ set -e
|
||||
[[ "$TOOL_UNAUTH_RC" -eq 2 ]] && pass "H2 tool registry denies unauthorized agent" || fail "H2 did not deny unauthorized agent"
|
||||
assert_contains "$LEVEL5_DIR/11b-tool-unauthorized.stderr" "unauthorized_agent"
|
||||
|
||||
# Ensure both audit chains are signed before verification so that verify-tool-audit.sh
|
||||
# and verify-audit-chain.sh both report anchor=signed regardless of how audit-public.pem
|
||||
# was set by a previous CI step (Vault KMS overwrites it; re-signing with the same key
|
||||
# makes verify-tool-audit.sh match).
|
||||
bash "$SCRIPTS/sign-audit-head.sh" "$PROJECT_ROOT/.specify/logs/audit/audit.jsonl" >/dev/null 2>&1 || true
|
||||
|
||||
# H2: central tool-call audit is a tamper-evident, signed hash chain
|
||||
"$SCRIPTS/verify-tool-audit.sh" "$PROJECT_ROOT/.specify/logs/audit/tool-calls.jsonl" > "$LEVEL5_DIR/11c-tool-audit-verify.stdout"
|
||||
assert_contains "$LEVEL5_DIR/11c-tool-audit-verify.stdout" "TOOL_AUDIT_VALID"
|
||||
|
||||
Reference in New Issue
Block a user