Skip to content

Commit 33d02c9

Browse files
fix(github): Cast app ID to string for PyJWT 2.12.0 iss claim
PyJWT 2.11.0+ validates that the iss claim must be a string during encoding. The github-app.id and github.integration-app-id options are registered with default=0 (int), so options.get() returns an int, causing InvalidClaimError. Cast to str() in both JWT generation paths. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 661ae7d commit 33d02c9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sentry/integrations/github/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
def get_jwt(github_id: str | None = None, github_private_key: str | None = None) -> str:
1818
if github_id is None:
19-
github_id = options.get("github-app.id")
19+
github_id = str(options.get("github-app.id"))
2020
if github_private_key is None:
2121
github_private_key = options.get("github-app.private-key")
2222
exp_ = datetime.datetime.utcnow() + datetime.timedelta(minutes=10)

src/sentry_plugins/github/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_jwt(self) -> str:
9999
# JWT expiration time (10 minute maximum)
100100
"exp": exp,
101101
# Integration's GitHub identifier
102-
"iss": options.get("github.integration-app-id"),
102+
"iss": str(options.get("github.integration-app-id")),
103103
}
104104

105105
return jwt.encode(payload, options.get("github.integration-private-key"), algorithm="RS256")

0 commit comments

Comments
 (0)