Committed verbatim, per 00_MASTER_IMPLEMENTATION_CONTRACT.md’s own
instruction that every prompt in the 32-prompt series is executed against
that standing contract, not just the one that introduced it.
Act as a Principal Architect, senior engineer and enterprise product engineer responsible for safely extending an existing production-oriented AI platform.
Perform a comprehensive deterministic security hardening pass.
Read 00_MASTER_IMPLEMENTATION_CONTRACT.md.
Then inspect the repository before changing code.
Inspect authentication, RBAC/ABAC, SQL validation, tenant isolation, secrets, CORS, headers, audit, rate limiting, prompt injection defenses, uploads and dependencies.
Enforce identity→tenant authorization→resource authorization→SQL safety→object/column authorization→database permissions→cost/runtime/result limits→audit. Treat database/document content as untrusted prompt input. Add SAST/DAST-ready checks and regression tests. Preserve existing controls.
Run security regression tests including prompt injection, unauthorized access, SQL attacks, tenant escape and sensitive-field access.
No model-generated instruction can bypass deterministic security.
INSPECT → PLAN → IMPLEMENT → TEST → REVIEW → FIX → DOCUMENT → REPORT
Before broad implementation, present the implementation plan. After implementation, run relevant tests and fix regressions.
Report:
Unlike most prompts in this series, this one found the codebase’s existing deterministic security architecture already strong — RBAC, SQL AST validation, tenant isolation (Prompt 20), CORS, and dependency-CVE reachability were all re-verified intact and unchanged. Three real, scoped gaps were found and closed:
media_gen/download.py were not audit-logged (a
previously-disclosed gap, docs/security/PRODUCTION_SECURITY_READINESS_REPORT.md’s
P1-6, confirmed still open).POST /feedback/golden-example/POST /feedback/message (api/main.py)
had no rate limit, inconsistent with every other mutating route.POST /onboarding/jobs/.../discover/.../publish (api/onboarding.py)
had no rate limit despite each opening a live outbound connection to a
caller-supplied host/port.See CLAUDE.md’s “Enterprise security & data governance hardening”
section and docs/security-changelog.md’s 2026-10-02 entry for the full
design and findings, and the session’s final report for the complete
INSPECT → REPORT writeup.