-
Notifications
You must be signed in to change notification settings - Fork 478
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
Mask JWT tokens in logs in case of post-auth errors #1457
Conversation
The JWT tokens are valid for 1 minute, but still can be enough to steal the tokens from logs (if a hacker has access to the log stream or the log service) and use the token to access the data, potentially to change the user's credentials — if done in an automated way.
Codecov Report
@@ Coverage Diff @@
## main #1457 +/- ##
==========================================
+ Coverage 81.84% 81.89% +0.05%
==========================================
Files 60 60
Lines 8599 8596 -3
Branches 1271 1271
==========================================
+ Hits 7038 7040 +2
+ Misses 1230 1223 -7
- Partials 331 333 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
data = json.dumps(decoded_data) | ||
except Exception: | ||
logger.info("data is not JSON") | ||
_, masked_data, err_str = SecretDetector.mask_secrets(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also check the first returned value to see if the data is masked? Or is this more like a best effort?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if data is not masked, then original data is returned. It basically means that no secrets were detected. I'm not sure how we would use the masked
value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for the explanation :)
test pr for #1455
The JWT tokens are valid for 1 minute, but still can be enough to steal the tokens from logs (if a hacker has access to the log stream or the log service) and use the token to access the data, potentially to change the user's credentials — if done in an automated way.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-750898: Connector is leaking JWT tokens to logs #1454
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Fixes a bug where JWT tokens got leaked into logs in case of post-auth errors.