Repository navigation
Stop checking maintainer GitHub tokens before each package update - #1989
Merged
Merged
Conversation
The worker made its own request to GitHub to validate a maintainer's token before updating a package. It crashed the update job with "Undefined array key 0" when GitHub sent no response, and its status regex never matched, so it never actually detected invalid or IP allow listed tokens. LoggingHttpDownloader already retries the repository request with the Packagist token when GitHub refuses a maintainer's token (revoked, SAML SSO, IP allow list, rate limit) and reports which of these it was, so the pre-check is dropped. Token selection, including skipping a token an organization IP allow list refused, moves to MaintainerGitHubTokenPicker.
When GitHub refuses a maintainer's token for a package's repository, the update falls back to the Packagist token. The refused token was still picked first on every later update, which hid other maintainers' working tokens. The update now remembers why the token was refused and skips it for a while: an organization IP allow list skips the token for that organization for a week, SAML SSO for a day, and a revoked token for a day across all organizations, or until the maintainer links a new one. Rate limits don't skip the token.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before updating a GitHub package, the update worker made its own request to GitHub to check that the maintainer's token was valid. This check had two bugs:
Undefined array key 0instead of updating the package.HTTP/\s+) never matched a real status line. As a result it never wiped revoked tokens, and its IP allow list detection never ran.The check is not needed anymore. Since #1895, when GitHub refuses a maintainer's token,
LoggingHttpDownloaderretries the repository request with the Packagist token, and it reports why the token was refused.This PR removes the check and makes the update act on that refusal instead. The next updates then skip the refused token, so another maintainer's working token is used rather than the shared Packagist token:
Token selection moves to
MaintainerGitHubTokenPicker. It keeps the existing IP allow list cache key, so skips already in place still apply. An update failure is only blamed on an organization's IP allow list when it was the maintainer's token that the allow list refused.