fix(api): sanitize batch gather escapes, admin-route authz walk, production docs gate (audit G-5, G-4, G-2) - #219
Merged
Conversation
…uction docs gate (audit G-5, G-4, G-2) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DORA Metrics
|
…ck (audit G-8) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…odes Local venv lagged uv.lock (fastapi 0.135/starlette 1.0 vs locked 0.139/1.3.1), so the flattened-routes assumption passed locally and failed on CI; venv now synced to the lock and the walk handles both shapes. Mutation-verified again (stripped dependency turns the walk red). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…y2003-code/agentflow into fix/audit-grok-g4-g5-g2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the three code findings from the 2026-07-20 deep audit.
G-5 (P3, S-2 residual):
/v1/batch's gather fallback echoedstr(outcome)to the client for any non-BatchResultoutcome — the one error path that bypassed_safe_item_error. New_unexpected_outcome_errorlogs the raw text server-side under the correlation id and returns a genericbatch item failed (ref ...). Unit test injects an exception carrying a fake DSN and asserts none of it reaches the response.G-4 (P3, latent): admin paths skip the auth middleware by design, so a future
/v1/adminrouter registered withoutDepends(require_admin_key)would ship fully open — the existing matrix test only pins the two known router objects. Added a walk over the assembled app flagging any admin-matching route (incl. mounts) without the dependency, plus a probe test that proves the checker can fail (mutation-verified locally: stripping the dependency fromadmin.pyturns the walk red). No runtime change.G-2 (P3):
/docs,/redoc,/openapi*are auth-exempt, which on a production deploy hands any caller the full route map without a key. Newproduction_docs_guardmiddleware 404s them whenapp.state.profile == "production"— same policy shape as the CORS-wildcard refusal (P2-3); demo/dev unchanged. OpenAPI schema itself is untouched (no route changes).Local: ruff check/format clean; 128 tests green across the touched surfaces (batch, admin authz matrix, docs gate, openapi auth surface, CORS, api metrics, auth fail-closed, export-openapi, production boot gate).
🤖 Generated with Claude Code