Skip to content

Authenticate the identity GitHub reads with an optional read token - #92

Merged
ClaudiuSchuster merged 1 commit into
mainfrom
oss-oo/identity-github-token
Sep 16, 2026
Merged

ClaudiuSchuster merged 1 commit into
mainfrom
oss-oo/identity-github-token

Conversation

@ClaudiuSchuster

Copy link
Copy Markdown
Member

What this changes

Fixes the production identity-enrollment outage found tonight: POST /api/v1/identities answered 503 upstream_unavailable across four clean challenge/gist cycles over ~50 minutes. Root cause: githubJson() called api.github.com anonymously, and anonymous calls leave Cloudflare's shared worker egress addresses whose per-IP quota (60/h) is persistently exhausted by other tenants.

  • identity.mjs: an optional GITHUB_READ_TOKEN secret authenticates the two fixed public reads (gist + user), giving the worker its own quota. A rejected (401/403/429) or absent token degrades to exactly one anonymous retry after a short pause — never a wider request and never a silent failure of enrollment.
  • Unchanged: 404 proof handling, redirect and size guards, fixed-path allowlist, challenge attempt limits.
  • wrangler.example.toml documents the optional secret; two new tests cover token-auth + degradation and the anonymous fail-closed path (suite 85 → 87).

Deployment note

No schema or module-list changes (identity.mjs is already pinned). After merge: standard promotion chain; then the operator sets the GITHUB_READ_TOKEN secret on the live worker (read-only PAT recommended; the current stopgap may be replaced anytime without code changes — an invalid token simply degrades to the anonymous path).

Verification

Full commons suite 87/87 in node:24; agent-data self-tests 84 rejected.

Anonymous api.github.com calls leave Cloudflare's shared worker egress
addresses whose per-IP quota is persistently exhausted, breaking every
new enrollment with 503 upstream_unavailable. An optional
GITHUB_READ_TOKEN secret (read-only) gives the worker its own quota; a
rejected or absent token degrades to exactly one anonymous retry after a
short pause instead of failing enrollment closed. 404 proof handling and
all size/redirect guards are unchanged.
@ClaudiuSchuster
ClaudiuSchuster merged commit 05de22a into main Sep 16, 2026
5 checks passed
@ClaudiuSchuster
ClaudiuSchuster deleted the oss-oo/identity-github-token branch September 16, 2026 21:26
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.

1 participant