Repository navigation
Keep rejected request bodies out of logs and responses - #2491
Merged
Merged
Conversation
Layer: 1-rejected-body-logs
Layer: 1-rejected-body-logs
kmcginnes
force-pushed
the
t3/redact-body-parser-error-logs
branch
from
October 28, 2026 20:55
b1b1a96 to
94ad82c
Compare
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.
Summary
A request body the parser rejects no longer reaches the logs or the response, since request bodies can hold database queries that the logging docs say are only logged at
debugandtrace.User-facing: a request the server rejects now fails with its real status (400, 413, or 415) instead of a 500, and a request over the 50 MB limit shows "Request Too Large".
Body-parser attaches the raw body to parse errors, and the JSON parse message quotes part of it. The wrapper converts any error from a body parser into a
RejectedRequestBodyErrorthat carries only the status,type, and a message. Parse failures get a fixed message, and the other parser messages are fixed text. The error handler is unchanged, so every other error logs as before. Detection is by origin, not by error shape.Evidence
Before: a malformed
/gremlinbody wrote the raw body to the error log and returned a 500.After:
request bodies the parser rejectsinpackages/graph-explorer-proxy-server/src/app.test.tssends malformed JSON, a bad charset, an oversized body, and an oversized form body containing a marker. Each asserts the marker is absent from every logger call at every level and from the response, with the expected status.createDisplayError.test.tscovers the 413 message.Merge Danger
Door: two-way
Impact: error responses for rejected bodies change status and gain
type. The Graph Explorer client is the only consumer, and it already shows the server message for these statuses.🤖 Written by an AI agent on my behalf.