feat: plan 16 P1 (SEC-08/09/19/20/21) — fail-open/DoS/authz hardening

- SEC-08 pii-mask: fail-closed on missing rules / broken regex (no unmasked leak)
- SEC-09: input-size cap + fail-closed reads (security-check/drift-detect/context-compress); non-UTF8 no longer crashes
- SEC-19: control-plane store POSIX flock + atomic tmp+rename write
- SEC-20: new toolchain-verify.sh (missing/PATH-shadowed/in-workspace binary -> refuse); wired into harness-preflight
- SEC-21: model-call timeout 180->60s configurable + per-run call budget
- SEC-11 realized by SEC-17 prod profile (no code)
- 5 fail-able test suites wired into ci-harness-gate.sh; test-integrity manifest regenerated

Verify: SEC+integrity gate 16/0, run-casan4 0-FAIL, adversarial 44/44, no regressions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
thanhnv
2026-07-06 22:21:34 +09:00
co-authored by Claude Opus 4.8
parent 8c3c5e8bff
commit e70f0815ab
17 changed files with 611 additions and 62 deletions
@@ -12,6 +12,16 @@ set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROMPT="${1:-}"
# SEC-20 (ARCH-04/09): fail closed if the required toolchain is missing or a
# required binary is PATH-shadowed by a planted copy (default checks only refuse on
# missing / in-workspace binaries; prod can set CASAN_TOOLCHAIN_TRUSTED_DIRS).
if [[ -f "$SCRIPT_DIR/toolchain-verify.sh" ]]; then
if ! bash "$SCRIPT_DIR/toolchain-verify.sh" >/dev/null 2>&1; then
echo "PREFLIGHT_BLOCK toolchain-verify (missing/shadowed binary)" >&2
exit 1
fi
fi
MODEL=""
while [[ $# -gt 0 ]]; do
case "$1" in