-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: support gh refresh tokens #85
Conversation
Codecov Report
@@ Coverage Diff @@
## main #85 +/- ##
=====================================
Coverage 95.28 95.28
=====================================
Files 698 698
Lines 14860 14860
=====================================
Hits 14159 14159
Misses 701 701
|
ab0df81
to
1e5ad03
Compare
9a725b4
to
7c60f91
Compare
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
@@ -70,7 +70,9 @@ def get_generic_adapter_params(owner: Owner, service, use_ssl=False, token=None) | |||
key=getattr(settings, f"{service.upper()}_CLIENT_ID", "unknown"), | |||
secret=getattr(settings, f"{service.upper()}_CLIENT_SECRET", "unknown"), | |||
), | |||
on_token_refresh=get_token_refresh_callback(owner, service), | |||
on_token_refresh=( | |||
get_token_refresh_callback(owner, service) if "username" in token else None |
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.
What is if "username" in token
checking for here?
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.
Oh I saw the code in codecov/worker#69 about checking whether we're using the GH app integration. Is this a proxy for that? If so maybe just a quick comment here
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.
Yeah that's the idea. Since we define "username" in the token on line 62 - IFF we know what's the owner of said token - then we can use that to check if the token belongs to an owner (and thus can/should be refreshed).
I'll update with a comment
Depends on codecov/shared#27 TODO: after that is merged update the sha reference in requirements.in Adds support for github app refresh tokens codecov/engineering-team#162
* update shared * only include on_token_refresh if the token comes from the owner (definetely from the owner) context codecov/engineering-team#162
7c60f91
to
15a2b07
Compare
* ImportError: cannot import name should_write_data_to_storage_config_c… (#104) * ImportError: cannot import name should_write_data_to_storage_config_check * Update VERSION * feat: Django command to enqueue commit backfill tasks (#102) * feat: Django command to enqueue commit backfill tasks * Fetch only commit id and commitid * chore: Update Sentry config keys to be more consistent with other services (#103) * Fix/config error enterprise (#107) * Fix config error * Fix config error * Add RiskyAlterField to utils/migrations (#93) * Add RiskyAlterField to utils/migrations * Remove duplicate RiskyAddField class Signed-off-by: joseph-sentry <[email protected]> * feat: support gh refresh tokens (#85) Depends on codecov/shared#27 Adds support for github app refresh tokens only include token refresh callback if token is from owner * Make uses_invoice field on Owner(#92) * Add uses_invoice field to Owner using RiskyAddField * Set default to False for uses_invoice field on Owner * Make uses_invoice field in Owner non-nullable * Fix uses_invoice column migrations Signed-off-by: joseph-sentry <[email protected]> * fix: Include impacted files with no coverage diff and no indirect changes in direct changes list (#114) * Add 23.9.5 migration * update to handle to redirects (#113) * Adjust donwload_url link (#115) * Add changes for monthly uploads to account for trialing customer (#101) * Add changes for monthly uploads to account for trialing customer * Adjust filtering logic when trialing * Add 23.9.5 migration --------- Signed-off-by: joseph-sentry <[email protected]> Co-authored-by: scott-codecov <[email protected]> Co-authored-by: joseph-sentry <[email protected]> Co-authored-by: Giovanni M Guidini <[email protected]> Co-authored-by: Rula Abuhasna <[email protected]> Co-authored-by: Adrian <[email protected]>
* ImportError: cannot import name should_write_data_to_storage_config_c… (#104) * ImportError: cannot import name should_write_data_to_storage_config_check * Update VERSION * feat: Django command to enqueue commit backfill tasks (#102) * feat: Django command to enqueue commit backfill tasks * Fetch only commit id and commitid * chore: Update Sentry config keys to be more consistent with other services (#103) * Fix/config error enterprise (#107) * Fix config error * Fix config error * Add RiskyAlterField to utils/migrations (#93) * Add RiskyAlterField to utils/migrations * Remove duplicate RiskyAddField class Signed-off-by: joseph-sentry <[email protected]> * feat: support gh refresh tokens (#85) Depends on codecov/shared#27 Adds support for github app refresh tokens only include token refresh callback if token is from owner * Make uses_invoice field on Owner(#92) * Add uses_invoice field to Owner using RiskyAddField * Set default to False for uses_invoice field on Owner * Make uses_invoice field in Owner non-nullable * Fix uses_invoice column migrations Signed-off-by: joseph-sentry <[email protected]> * fix: Include impacted files with no coverage diff and no indirect changes in direct changes list (#114) * Add 23.9.5 migration * update to handle to redirects (#113) * Adjust donwload_url link (#115) * Add changes for monthly uploads to account for trialing customer (#101) * Add changes for monthly uploads to account for trialing customer * Adjust filtering logic when trialing * Add 23.9.5 migration --------- Signed-off-by: joseph-sentry <[email protected]> Co-authored-by: scott-codecov <[email protected]> Co-authored-by: joseph-sentry <[email protected]> Co-authored-by: Giovanni M Guidini <[email protected]> Co-authored-by: Rula Abuhasna <[email protected]> Co-authored-by: Adrian <[email protected]>
* main: (58 commits) Adding beginnings of GHA CI (#127) feat: Filter flags by flags for pathContents (#128) Create checkbox in Owner form in Django admin to set uses_invoice (#109) build(deps): bump certifi from 2020.6.20 to 2023.7.22 (#32) Feature/no compile (#126) Bump django from 4.2.2 to 4.2.3 (#42) Don't compile since source is available (#106) feat: Add firstPull resolver to GraphQL pull type (#108) chore: Upgrade requests and redis dependencies (#124) Update LICENSE (#122) Attempt migration (#121) 359 adjust monthly uploads for trialled customers (#119) Add changes for monthly uploads to account for trialing customer (#101) Adjust donwload_url link (#115) update to handle to redirects (#113) fix: Include impacted files with no coverage diff and no indirect changes in direct changes list (#114) Make uses_invoice field on Owner(#92) feat: support gh refresh tokens (#85) Add RiskyAlterField to utils/migrations (#93) Fix/config error enterprise (#107) ...
* main: (58 commits) Adding beginnings of GHA CI (#127) feat: Filter flags by flags for pathContents (#128) Create checkbox in Owner form in Django admin to set uses_invoice (#109) build(deps): bump certifi from 2020.6.20 to 2023.7.22 (#32) Feature/no compile (#126) Bump django from 4.2.2 to 4.2.3 (#42) Don't compile since source is available (#106) feat: Add firstPull resolver to GraphQL pull type (#108) chore: Upgrade requests and redis dependencies (#124) Update LICENSE (#122) Attempt migration (#121) 359 adjust monthly uploads for trialled customers (#119) Add changes for monthly uploads to account for trialing customer (#101) Adjust donwload_url link (#115) update to handle to redirects (#113) fix: Include impacted files with no coverage diff and no indirect changes in direct changes list (#114) Make uses_invoice field on Owner(#92) feat: support gh refresh tokens (#85) Add RiskyAlterField to utils/migrations (#93) Fix/config error enterprise (#107) ...
Depends on codecov/shared#27
TODO: after that is merged update the sha reference in requirements.in
Adds support for github app refresh tokens
codecov/engineering-team#162
Purpose/Motivation
What is the feature? Why is this being done?
Links to relevant tickets
What does this PR do?
Include a brief description of the changes in this PR. Bullet points are your friend.
Notes to Reviewer
Anything to note to the team? Any tips on how to review, or where to start?
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.