Repository navigation
logging: Parse request URIs in the query filter like the server does - #8255
Open
jayhemnani9910 wants to merge 1 commit into
Open
jayhemnani9910 wants to merge 1 commit into
jayhemnani9910 wants to merge 1 commit into
Conversation
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 #8254
The
queryfilter parsed the logged URI withurl.Parse, which treats#as a fragment. For a request-target the server has no fragment, so/a?x=1#&token=s3cr3twas logged withtokenunredacted, and/a?token=s3cr3t#%zzfailed to parse and was logged unchanged. Values starting with/are now parsed withurl.ParseRequestURI, the same parser the server uses for the request line; other values still useurl.Parse.Side effect: a relative URL with a fragment in another field (for example
Location: /a?x=1#section) now has the fragment read as part of the query. Absolute-form request-targets are unchanged.Test:
TestQueryFilterHashInRequestURIcovers both requests. It fails without the change.go test -short ./...30 ok, same as master; golangci-lint 0 issues formodules/logging.Manual check with the config in the issue: v2.11.7 logs
/a?x=1#&token=s3cr3tand/a?token=s3cr3t#%zz; with the change they log/a?token=REDACTED&x=1%23and/a.Assistance Disclosure
AI used (Claude Code).