Skip to content

Commit f8e70b6

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 f8e70b6

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
@@ -28,7 +28,7 @@ def get_jwt(github_id: str | None = None, github_private_key: str | None = None)
2828
# JWT expiration time (10 minute maximum)
2929
"exp": exp,
3030
# Integration's GitHub identifier
31-
"iss": github_id,
31+
"iss": str(github_id),
3232
}
3333
return jwt.encode(payload, github_private_key, algorithm="RS256")
3434

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)