Repository navigation
Refused request bodies are never echoed back - #47
Merged
Merged
Conversation
FastAPI's default 422 reply repeats the refused input; for a missing field that is the whole body, so a bad key change, key rotation, AI runtime update or memory reset sent the current admin key (and a provider key) straight back. Every route now returns only where and why (loc, msg, type). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
FastAPI's default 422 reply repeats the refused input. For a missing field pydantic's
inputis the whole body, so a malformedPOST /auth/change-keyorPUT /system/ai-runtimesent the current admin key (and a provider API key) back in the error body.services/api/app/main.py: a RequestValidationError handler that returns onlyloc,msgandtypeper error, neverinputorctx.services/api/tests/test_validation_no_echo.py: change-key (missing and short new key), ai-runtime with an api_key, rotate-key and memory-reset with wrong types: 422, neither secret in the reply, each error is exactly loc/msg/type in the body.Evidence: the new test failed 5/5 before the fix and passes 5/5 after; full suite 411 passed; ruff, file sizes and package boundaries pass.
🤖 Generated with Claude Code