Skip to content

feat(recon): let GITHUB_TOKEN lift the GitHub recon rate limit - #337

Open
tsstod wants to merge 1 commit into
simplifaisoul:masterfrom
tsstod:feat/github-token
Open

tsstod wants to merge 1 commit into
simplifaisoul:masterfrom
tsstod:feat/github-token

Conversation

@tsstod

@tsstod tsstod commented Sep 11, 2026

Copy link
Copy Markdown

Summary

The RECON GitHub Recon tool calls api.github.com with no credentials, so a deployment shares GitHub's anonymous allowance of 60 requests per hour per IP across every visitor. A handful of lookups exhausts it, and the route then reports the 403 as a generic "GitHub lookup failed" with no hint that waiting is the fix.

This sends an Authorization header when GITHUB_TOKEN is set, which raises the limit to 5,000 requests per hour. It stays optional: with no token the tool behaves exactly as before, which is how the public demo runs.

Changes

  • src/app/api/osint/github/route.ts builds the request headers once and adds Authorization: Bearer $GITHUB_TOKEN when the variable is set. Both GitHub calls (profile and recent repos) use them.
  • .env.example documents GITHUB_TOKEN in its own block beside the other keys the code actually reads. It notes that the token needs no scopes, since profile and repo data are public.

Testing

Checked against the running dev server:

Condition Result
No token 200 with full profile and 5 recent repos
Missing user param 400 Missing username parameter
Unknown user 404 User not found
Deliberately fake GITHUB_TOKEN 502 with detail: "GitHub API HTTP 401"

The 401 is what proves the header is attached: GitHub only rejects a request that carries credentials. Before this change the same request returned 200.

Full npx vitest run passes on a local branch combining this PR with #334 and #338 on current master (8781ae3): 49 test files passed, 614 tests passed. The 2 skipped files and 16 skipped tests are pre-existing skips of the network-gated tests. No unit test added for the header itself; the live check above covers it.

Notes

🤖 Generated with Claude Code

/api/osint/github called api.github.com with no credentials, so every
deployment shared GitHub's anonymous allowance of 60 requests per hour per
IP. A handful of lookups exhausts it, and the route then reports the 403 as
a generic "GitHub lookup failed" with no hint that waiting is the fix.

Send an Authorization header when GITHUB_TOKEN is set, which takes the limit
to 5000/hour. It stays optional: with no token the tool behaves exactly as
before, which is how the public demo runs.

The token needs no scopes at all, since profile and repo data are public.
Document that in .env.example, in its own block beside the other keys the
code actually reads rather than under the "not read by current code" list.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

@tsstod is attempting to deploy a commit to the Developing Osiris' projects Team on Vercel.

A member of the Team first needs to authorize it.

@tsstod

tsstod commented Sep 11, 2026

Copy link
Copy Markdown
Author

The red Vercel – osiris check here is Vercel waiting for a team member to authorize a deploy from a fork. No build has run, so here's a local one instead:

🤖 Generated with Claude Code

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants