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

Fix auth issues with Installation.get_repos #2547

Merged
merged 2 commits into from Jun 13, 2023

Conversation

EnricoMi
Copy link
Collaborator

@EnricoMi EnricoMi commented Jun 8, 2023

Fixes #2504.

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (daf62bd) 98.45% compared to head (e1754e2) 98.49%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2547      +/-   ##
==========================================
+ Coverage   98.45%   98.49%   +0.04%     
==========================================
  Files         124      124              
  Lines       12407    12417      +10     
==========================================
+ Hits        12215    12230      +15     
+ Misses        192      187       -5     
Impacted Files Coverage Δ
github/Installation.py 98.07% <100.00%> (+4.74%) ⬆️
github/Requester.py 97.98% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@EnricoMi EnricoMi force-pushed the fix-installation-get-repos branch from 54442e2 to 840b4d7 Compare June 8, 2023 08:09
Copy link
Collaborator

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

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

Going to be completely honest, I don't know anything about installations, so I'm going to have to trust you on this one


auth = self._requester.auth if self._requester is not None else None
# Usually, an Installation is created from a Requester with App authentication
if isinstance(auth, AppAuth):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if it's not? Or there is no Auth? Can you have anonymous access to an installation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The auth should neither be None nor not of type AppAuth, but just in case it is, I don't want to change existing behaviour of user code, which should see an error response by the API.

Maybe there is a valid code path that creates an Installation without auth, because it never uses the requester.

@EnricoMi EnricoMi merged commit 6407512 into PyGithub:master Jun 13, 2023
7 checks passed
@EnricoMi EnricoMi deleted the fix-installation-get-repos branch June 13, 2023 06:35
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.

Installation.get_repos() appears to be broken - always throws BadCredentialsException
3 participants