-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent sensative information from being logged #65
Merged
Conversation
This file contains 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
This change logs the body of the request after the view has run in order to allow django to mark sensative post parameters and cause them to be replaced with astericts in the logs. See https://docs.djangoproject.com/en/2.2/howto/error-reporting/#django.views.decorators.debug.sensitive_post_parameters for more info
tclancy
reviewed
Apr 29, 2019
… parameters are not logged
tclancy
reviewed
Apr 30, 2019
tclancy
approved these changes
May 1, 2019
This was referenced May 2, 2019
Closed
@wwsean08 or @kennethjiang can you submit a PR either backing this out or fixing #67 ? |
There's a test case to do it in the ticket. |
I'll look into #67 tonight and see if i can come up with a fix for the test case as I never ran into that during my testing. |
Merged
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.
This change uses the
SafeExceptionReportFilter
when logging the body as outlined in issue #64 and also fixes #64. I have done some basic testing with a simple django application which uses thesensitive_post_parameters
decorator and seen that the fields are filtered out.One caveat is that this does change the behavior of logging the body, the decorator that specifies the variables to filter doesn't run until the view is called so logging the body needs to come after
self.get_response( request )
otherwise it'll still have sensitive information in plaintest. Here's an example of what I get using this now on an application using allauth{'csrfmiddlewaretoken': 'xAXmfqD1PYMttgqseguGHh1FQxWPkhxVPu07BHvXA9MICiNtSJJbU1pXrkfzVTFr', 'login': '[email protected]', 'password': '********************', 'next': '/'}
Previously the password would have been revealed. Also because
SafeExceptionReportFilter
is based on request.POST instead of request.body I have left a fallback in case that doesn't exist, I don't think that'll ever get hit though.