Return 400 instead of 500 for malformed JSON request bodies #15
Labels
No labels
automerge
bug
dependencies
duplicate
help wanted
invalid
lang
rust
migrations
opencode
question
security
type
documentation
type
enhancement
type
maintenance
type
refactor
vulnerability
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Personal/kitchenowl-flake#15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Requests with an unparsable JSON body crash the request handler: the backend logs a full traceback at ERROR and returns 500 instead of a 400 InvalidUsage response.
Context
app/helpers/validate_args.pycallsSchema.loads(), which delegates tojson.loads(). Ajson.JSONDecodeErroris not caught by theValidationErrorhandler, so it reaches Flask's generic error handler. The behaviour is identical in 0.7.10 and 0.8.1.Reproduction steps
validate_args:Expected behavior
A 400 response, one warning, and no traceback.
Actual behavior
A 500 response and an ERROR log with the full JSON decode traceback. A crawler produced 134 such requests in about 50 seconds on one deployment.
Scope
json.JSONDecodeErrorwherevalidate_argsparses the body and raiseInvalidUsage.Acceptance criteria
Dependencies