feat(h5-h6-hardening): Plan-07 Track A — A4 telemetry integrity, A5 cost controls
A4 (V9): telemetry-integrity.sh binds provider-usage.jsonl + cost/metrics.jsonl to a signed manifest head. Tampering a token flips the head (MISMATCH); an attacker who rewrites the head cannot re-sign it (SIGNATURE_INVALID) without the off-repo key. sign-audit-head.sh now also signs telemetry (best-effort). Supports CASAN_AUDIT_PRIV/PUB overrides for self-contained verification. A5 (V12/V13/V14): cost-spike-detect.sh adds an absolute per-call cap (CASAN_COST_ABSOLUTE_MAX_TOKENS, enforced from record #1 → catches slow-boil and cold-start) and a cumulative budget (CASAN_COST_CUMULATIVE_BUDGET_TOKENS → catches under-threshold spray), keeping the existing median×mult spike test. Backward compatible: <3 records with no caps still exits 3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ac40c0b281
commit
7e998f67c2
@@ -110,3 +110,8 @@ else
|
||||
openssl dgst -sha256 -sign "$AUDIT_PRIV" -out "$HEAD_SIG" "$HEAD_FILE"
|
||||
echo "SIGN_AUDIT_HEAD_OK head=$HEAD_HASH anchor=local-file"
|
||||
fi
|
||||
|
||||
# A4/V9: also bind token/cost telemetry to a signed manifest so tampering with
|
||||
# provider-usage.jsonl / metrics.jsonl is detectable. Best-effort — never fails
|
||||
# the audit signing step (verify-telemetry-integrity.sh is the gate).
|
||||
bash "$SCRIPT_DIR/telemetry-integrity.sh" sign >/dev/null 2>&1 || true
|
||||
|
||||
Reference in New Issue
Block a user