Skip to content

Fix GitHub App response processor to match GitHub's 201 status#53

Merged
mjbraun merged 1 commit into
mainfrom
fix-github-app-201-response
May 1, 2026
Merged

Fix GitHub App response processor to match GitHub's 201 status#53
mjbraun merged 1 commit into
mainfrom
fix-github-app-201-response

Conversation

@mjbraun
Copy link
Copy Markdown
Contributor

@mjbraun mjbraun commented May 1, 2026

GitHub's installation token endpoint returns 201 Created on success, not 200 OK. The response processor was checking for 200 and silently passing the unwrapped response (containing the plaintext installation token) through to the caller, defeating the sealing protection.

Tests still asserted 200 for the GitHub fixtures, so they passed despite the mismatch with the real API.

Ref: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app

GitHub's installation token endpoint returns 201 Created on success, not
200 OK. The response processor was checking for 200 and silently passing
the unwrapped response (containing the plaintext installation token)
through to the caller, defeating the sealing protection.

Tests still asserted 200 for the GitHub fixtures, so they passed despite
the mismatch with the real API.

Ref: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app
@mjbraun mjbraun requested review from tqbf and removed request for tqbf May 1, 2026 18:31
@mjbraun mjbraun merged commit a60499d into main May 1, 2026
1 check passed
@mjbraun mjbraun deleted the fix-github-app-201-response branch May 1, 2026 18:46
Comment thread processor.go
if resp.StatusCode != http.StatusOK {
// GitHub's installation token endpoint returns 201 Created on success.
// https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app
if resp.StatusCode != http.StatusCreated {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if it's between 200 and 299, given the failure mode is exposing the token. Maybe add a 200 test as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants