Skip to content
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

Do not log contents of body for /user/ paths #1111

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Do not log contents of body for /user/ paths #1111

merged 1 commit into from
Jul 23, 2024

Conversation

tomchop
Copy link
Collaborator

@tomchop tomchop commented Jul 22, 2024

No description provided.

@tomchop tomchop requested a review from udgover July 22, 2024 13:19
@tomchop tomchop added the security-impact Changes that affect security and users should keep an eye on label Jul 22, 2024
@tomchop tomchop changed the title Do not log user paths Do not log contents of body for /user/ paths Jul 22, 2024
Copy link
Collaborator

@udgover udgover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to log this type of event by removing the sensitive field itself?

@tomchop
Copy link
Collaborator Author

tomchop commented Jul 23, 2024

in the current state of the PR, we just drop the body of the request (which contains the sensitive data), but the request itself is still logged. You'll see the HTTP method, the endpoint name, and the originating user, which is usually enough to know what happened.

It would be better to mark specific fields in the Pydantic models as sensitive (https://docs.pydantic.dev/2.0/usage/types/secrets/ supports it) but the layer at which the logger operates intervenes before the parsing into pydantic objects; changing this requires a bit more refactoring, and this PR is a quick solution to the problem.

I opened #1113 to track this

@sebdraven sebdraven merged commit 7a736dc into main Jul 23, 2024
3 checks passed
@sebdraven sebdraven deleted the logging branch July 23, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security-impact Changes that affect security and users should keep an eye on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants