chore(function): remove exchange_github_app_token_with_pat route by thdxr · Pull Request #57630 · anomalyco/opencode · GitHub
Skip to content

chore(function): remove exchange_github_app_token_with_pat route - #57630

Merged
thdxr merged 1 commit into
devfrom
remove-pat-exchange
Oct 21, 2026
Merged

thdxr merged 1 commit into
devfrom
remove-pat-exchange

Conversation

@thdxr

@thdxr thdxr commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Removes the POST /exchange_github_app_token_with_pat route from the api.opencode.ai worker (packages/function/src/api.ts).

The route swapped a user's GitHub PAT for a GitHub App installation token. Its only real use was local testing of the GitHub action (the V1 CLI's opencode github run --token / mock mode, and github/index.ts). In the last 30 days it got about 460 calls and zero 2xx responses. Almost all of them came from probing scripts. This relates to security monitor finding #133.

github/index.ts mock mode called this route when MOCK_TOKEN was set. Mock mode now needs TOKEN (already supported, and used directly as the GitHub token). The README is updated to match.

POST /exchange_github_app_token (OIDC exchange used by the GitHub Action, ~2k calls/day) is unchanged.

How did you verify your code works?

  • bun run check passes
  • packages/function tests pass

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: removes POST /exchange_github_app_token_with_pat and the MOCK_TOKEN env var for local action testing (not backwards compatible; use TOKEN instead)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I checked it by calling the worker app directly in both checkouts: POST /exchange_github_app_token_with_pat returned 401 on the base and returns 404 with this PR. POST /exchange_github_app_token still behaves the same. Nothing left in the repo refers to the route or to MOCK_TOKEN. packages/function tests pass and its type check is clean.

Public API: removes POST /exchange_github_app_token_with_pat from api.opencode.ai and the MOCK_TOKEN env var from github/index.ts. This is not backwards compatible for anyone still calling the route: old local-testing setups (V1 opencode github run --token / mock mode with MOCK_TOKEN) now get a 404 and need to pass a PAT as TOKEN instead. Real usage looks negligible given there were no successful calls in the last 30 days. The OIDC exchange route used by the GitHub Action is unchanged.

No concerns.

@thdxr
thdxr merged commit 17ebb66 into dev Oct 21, 2026
16 checks passed
@thdxr
thdxr deleted the remove-pat-exchange branch October 21, 2026 04:08
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