Skip to content

Commit fc23f10

Browse files
committed
fix: guard against None app ID before JWT creation
Addresses review feedback — str(None) would produce 'None' as the issuer, which passes PyJWT's type check but gets rejected by GitHub. Raise GitHubAppError with a clear message instead.
1 parent 40d3938 commit fc23f10

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/githubapp/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ def _create_jwt(self, expiration=60):
577577
:param expiration: int
578578
:return string:
579579
"""
580+
if self.id is None:
581+
raise GitHubAppError(
582+
message="GitHub App ID (github_app_id) is not configured; cannot generate JWT.",
583+
status=None,
584+
data=None,
585+
)
580586
now = int(time.time())
581587
payload = {"iat": now, "exp": now + expiration, "iss": str(self.id)}
582588
encrypted = jwt.encode(payload, key=self.key, algorithm="RS256")

0 commit comments

Comments
 (0)