Fix GitHub App auth: string JWT issuer (PyJWT >=2.10)#1
Merged
Conversation
PyJWT >=2.10 rejects non-string `iss` claims, but core.py stored
GITHUBAPP_ID as an int and github3.py uses it directly as the JWT
issuer when minting the app token, causing:
TypeError: Issuer (iss) must be a string.
Store the (still validated as numeric) app id as a string so the
issuer claim is valid. Keeps PyJWT current instead of pinning <2.10.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
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.
Problem
The prod sync crashes on startup when authenticating as the GitHub App:
core.pystoredGITHUBAPP_IDas an int, and github3.py 4.0.1 uses that value directly as the JWTissclaim. PyJWT >= 2.10 (we resolve 2.13.0) now rejects non-string issuers, so token minting fails and every sync errors out.Fix
Store the app id as a string (still validated as numeric via
str(int(...))). github3'screate_tokenusesapp_idonly asiss, so this is safe, and the issuer claim is now valid.Chosen over pinning
PyJWT<2.10so we don't hold back a security-relevant dependency.Verification
Locally,
apps.create_token(key, 2156025)raises the TypeError;apps.create_token(key, "2156025")returns a valid token.Merging this rebuilds
ghcr.io/hackucf/github-team-sync:latest; the prod Deployment then needs a rollout restart to pull it.🤖 Generated with Claude Code