wai-extra: redact Authorization header when logging a request#950
Open
austin-artificial wants to merge 1 commit intoyesodweb:masterfrom
Open
Conversation
This is similar to what is done for cookies
Contributor
|
I don't see any problem with this change 🤔 When using a default logger, you'd probably want to err on the safe side, so not leak credentials. If anyone wants to log delicate data, they can implement it themselves. I'd appreciate a bump in version, update to the ChangeLog and maybe find where describing this redaction (and maybe also the cookie redaction) would make sense and add it there? EDIT: I just saw Snoyberg's comment on this exact change in #792 and they feel it's a major version bump. And I can see the reasoning behind that. It might be better to just provide a version of this function that takes a function to redact certain header values? -- | Like 'requestHeadersToJSON', but takes a list of 'HeaderName's to redact
requestHeadersToJSONRedact :: [HeaderName] -> RequestHeaders -> Value
...
requestHeadersToJSON :: RequestHeaders -> Value
requestHeadersToJSON = requestHeadersToJSONRedact [hCookie]🤷 Something like that? |
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.
The
Authorizationrequest header normally contains sensitive data which we probably don't want to log.This redacts it in a similar way to what is done for cookies.
Happy to bump the version number if needed and add a changelog if the idea is approved.
Before submitting your PR, check that you've:
@sincedeclarations to the HaddockAfter submitting your PR: