Skip to content

Scrub Passwords with URL Encoded Characters #4433

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

Merged
merged 2 commits into from
Dec 29, 2017

Conversation

montymxb
Copy link
Contributor

Noticed that since login is performed over GET passwords can be urlencoded when trying to screen them from the logs. This can problematic as we check against a decoded version of the same password, which will not match a password with url encoded characters in the url/query.

This fixes it by running encodeURIComponent on our decoded password value, and uses that encoded value to screen against the password in the url/query. Additionally this adds some tests to LogsRouter.spec.js for enforcing that passwords (encoded or not) are properly screened in logs from here on out.

@codecov
Copy link

codecov bot commented Dec 18, 2017

Codecov Report

Merging #4433 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #4433     +/-   ##
=========================================
+ Coverage   92.69%   92.79%   +0.1%     
=========================================
  Files         118      118             
  Lines        8353     8358      +5     
=========================================
+ Hits         7743     7756     +13     
+ Misses        610      602      -8
Impacted Files Coverage Δ
src/Controllers/LoggerController.js 91.39% <100%> (+0.48%) ⬆️
src/RestWrite.js 93.28% <0%> (-0.55%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 96.94% <0%> (+0.1%) ⬆️
src/Routers/LogsRouter.js 94.11% <0%> (+58.82%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bad2179...2746589. Read the comment docs.

@montymxb montymxb added the type:bug Impaired feature or lacking behavior that is likely assumed label Dec 18, 2017
@montymxb montymxb requested a review from flovilmart December 18, 2017 22:58
flovilmart
flovilmart previously approved these changes Dec 19, 2017
@flovilmart
Copy link
Contributor

Looks good, I'm wondering if we should not do something about the logging, perhaps use only the path part of the URL, and rebuild the query string based on the decoded query string?

@montymxb
Copy link
Contributor Author

The matching is a bit iffy as is honestly. Reconstructing via the params and if one is password redacting the value without having to pattern match would be equally effective, if not also less error prone.

@flovilmart
Copy link
Contributor

Yep that's what I'm thinking as well.

@flovilmart flovilmart merged commit 7a9d404 into parse-community:master Dec 29, 2017
flovilmart pushed a commit that referenced this pull request Dec 29, 2017
* scrub passwords with url encoded characters from logs

* compose query string from parsed params, redacting based on key if needed
@montymxb montymxb deleted the better-password-scrubbing branch December 29, 2017 21:11
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* scrub passwords with url encoded characters from logs

* compose query string from parsed params, redacting based on key if needed
@mtrezza mtrezza removed the type:bug Impaired feature or lacking behavior that is likely assumed label Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants