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

Add "token" variables to Sentry's EventScrubber denylist #523

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

michelletran-codecov
Copy link
Contributor

Purpose/Motivation

We want to ensure that tokens don't get sent to Sentry when errors occur.

Links to relevant tickets

https://github.com/codecov/internal-issues/issues/419

What does this PR do?

This change will filter out the _header and token_to_use variables in a stacktrace frame so that the event doesn't push PII to Sentry. I'm currently filtering the whole _header, rather than just the authorization inside the _header. To enable that, I would need to enable recursive in the EventScrubber, which might have potential performance implications.

Notes to Reviewer

We might want to actually store the denylist in the shared repo (so that we can reuse this same list in worker).

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@michelletran-codecov michelletran-codecov requested a review from a team April 25, 2024 13:37
@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found ☺️

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.45%. Comparing base (5f242b9) to head (e57388b).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
- Coverage   91.45%   91.45%   -0.01%     
==========================================
  Files         599      599              
  Lines       16212    16211       -1     
==========================================
- Hits        14826    14825       -1     
  Misses       1386     1386              
Flag Coverage Δ
unit 91.45% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.45% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codecov-public-qa bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.45%. Comparing base (5f242b9) to head (e57388b).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
- Coverage   91.45%   91.45%   -0.01%     
==========================================
  Files         599      599              
  Lines       16212    16211       -1     
==========================================
- Hits        14826    14825       -1     
  Misses       1386     1386              
Flag Coverage Δ
unit 91.45% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.45% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
codecov/settings_base.py 85.86% <100.00%> (-0.08%) ⬇️

Impacted file tree graph

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.76%. Comparing base (5f242b9) to head (e57388b).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #523   +/-   ##
=====================================
  Coverage   95.76   95.76           
=====================================
  Files        774     774           
  Lines      17068   17067    -1     
=====================================
- Hits       16345   16344    -1     
  Misses       723     723           
Flag Coverage Δ
unit 91.45% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.45% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -533,10 +531,13 @@

SENTRY_ENV = os.environ.get("CODECOV_ENV", False)
SENTRY_DSN = os.environ.get("SERVICES__SENTRY__SERVER_DSN", None)
sentry_deny_list = DEFAULT_DENYLIST + ["_headers", "token_to_use"]
Copy link
Contributor

Choose a reason for hiding this comment

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

[very nit] SENTRY_DENY_LIST for consistency

This change will filter out the `_header` and `token_to_use` variables in a
stacktrace frame so that the event doesn't push PII to Sentry.
@michelletran-codecov michelletran-codecov added this pull request to the merge queue Apr 25, 2024
Merged via the queue into main with commit c685e62 Apr 25, 2024
21 checks passed
@michelletran-codecov michelletran-codecov deleted the sentry_token_leak branch April 25, 2024 15:10
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.

None yet

2 participants