Skip to content

fix: accept GitHub's stateless installation tokens in the upload service - #117

Merged
crypticpy merged 1 commit into
mainfrom
fix/installation-token-format
Oct 17, 2026
Merged

crypticpy merged 1 commit into
mainfrom
fix/installation-token-format

Conversation

@crypticpy

Copy link
Copy Markdown
Owner

Problem

The first live deployment of the upload service refused every upload with github_unavailable. The Vercel log showed minting the installation token failed: GitHub failed, HTTP 201, so GitHub had minted the token, but installationToken rejected it.

Since April 2026 GitHub issues App installation tokens in a stateless form, ghs_<app id>_<JWT>. These are about 520 characters long and contain . and - (notice). The service checked minted tokens against the user-token pattern ^[A-Za-z0-9_]{20,512}$, which rejects them.

Change

  • New INSTALLATION_TOKEN_PATTERN = /^ghs_[A-Za-z0-9._-]{36,}$/, GitHub's published pattern, used only for the minted installation token.
  • TOKEN_PATTERN is unchanged for submitters' sign-in (user-to-server) tokens. The format change covers server-to-server tokens only.
  • The test fixture INSTALL_TOKEN is now the long form, and a new test accepts both forms and rejects whitespace, newlines, short tokens and non-ghs_ tokens.

Evidence

  • node --test "services/uploads/test/*.test.mjs" test/scripts/upload_refs_parity.test.mjs: 47/47 pass. With the old github.mjs and the new tests, 21 fail.
  • eslint services/uploads is clean, and prettier is clean.

🤖 Generated with Claude Code

GitHub now issues App installation tokens as ghs_<app id>_<JWT> (about
520 characters, with . and -). The service checked minted tokens against
the 40-character user-token pattern, so every upload failed with
github_unavailable. Use GitHub's published installation-token pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T12:16:15.806254Z f7ae0ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@crypticpy
crypticpy merged commit b8c3f9d into main Oct 17, 2026
26 checks passed
@crypticpy
crypticpy deleted the fix/installation-token-format branch October 17, 2026 14:13
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.

2 participants