Repository navigation
Escape control characters in logged request headers - #2499
Merged
Merged
Conversation
Layer: 1-proxy-hardening
Layer: 1-proxy-hardening
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
Two follow-ups from Rank the database policy over the origin allowlist (#2493): the error handler's request-header log line now gets the same control-character escaping as client logs, and the origin allowlist gets test coverage for signed requests.
User-facing: none
errorHandlingMiddleware logger.error("Request headers: %s", - allowlisted headers → redactUrlCredentials + escapeControlCharacters(allowlisted headers → redactUrlCredentials) )escapeControlCharactersfromlogging.ts, added in Escape DEL and C1 control characters in client logs (#2488). Escaping runs after URL credential redaction, so redaction output is unchanged.PROXY_SERVER_ALLOWED_DB_ORIGINSset, a signed request (aws-neptune-region+service-type) to an origin outside the list returns 403 on every forwarding route, names the allowlist in the error, and fetches nothing.Evidence
Before: a DEL or C1 character in an allowlisted header value was written to the header log line as-is.
After: new tests pass, and each fails with its change removed:
error-handler.test.ts› escapes DEL and C1 control characters in a header valueapp.test.ts› escapes a C1 control character in a logged header value (through the real HTTP server)app.test.ts›$method $routereturns 403 for a signed request without fetching the disallowed originVerified live: ran the app on loopback with a header value containing a C1 character; the log line showed it as
\u0085, and URL credentials stayed redacted.Merge Danger
Door: two-way
Impact: logging
Only the format of the error-path header log line changes. Responses are unchanged.
🤖 Written by an AI agent on my behalf.