Repository navigation
feat(credentials): load no personal GitHub token off arich-mac - #151
Merged
smartwatermelon-agent[bot] merged 3 commits intoNov 10, 2026
Merged
Conversation
added 3 commits
November 9, 2026 19:38
Andrew's rule (2026-11-09): no GitHub operation by an agent may act as a person. This is layer 3 of three: on any host other than arich-mac (hostname -s, any case, exact match), the wrapper loads no GH_TOKEN, GH_TOKEN_NOS or GH_TOKEN_TWM, and removes those, GH_TOKEN_SWM and GITHUB_TOKEN if inherited. arich-mac is unchanged. GH_TOKEN is set to the existing fetch-failed sentinel rather than unset. With GH_TOKEN unset, gh and the dotfiles gh wrapper fall back to the keyring login (Andrew, admin:org) for any repo that is not App-routed. App-routed calls still work: the gh wrapper replaces GH_TOKEN with the minted App token for that call. The strip runs again in bin/claude-wrapper just before exec, because inject_secrets and the pre-launch hook run after credentials.sh, and a global secrets.op on a personal Mac can set GH_TOKEN. hostname is resolved on PATH so tests stub it like op and security. There is no env-var override. A missing hostname counts as personal. Also: test-wrapper.sh now unsets CLAUDE_WRAPPER_VAULT_VARS, as test-credentials.sh does. Test 3.6 failed on main when run from inside a wrapper session. And the ten SC2312 infos in test-credentials.sh are fixed.
Test 4.3's personal-host launch check is skipped when the wrapper cannot run. Test 4.6 reads bin/claude-wrapper and fails unless creds_enforce_app_only_gh comes after inject_secrets and the pre-launch hook and before the first exec. It fails on main, where the call does not exist.
The token-strip edit dropped it by accident on the secrets-loaded branch. Found by the pre-push full-diff review.
smartwatermelon-agent
Bot
requested a review
from twistedmelonman
as a code owner
November 10, 2026 03:45
twistedmelonman
approved these changes
Nov 10, 2026
smartwatermelon-agent
Bot
deleted the
claude/feat-app-only-github-a895f791
branch
November 10, 2026 04:03
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 3 of the app-only GitHub rule: on any host other than arich-mac, the wrapper loads no personal GitHub token and removes inherited ones. arich-mac is unchanged.
One departure from the brief
The brief said to unset
GH_TOKEN. This PR sets it to the existing fetch-failed sentinel instead. The other four vars are unset.Why: with
GH_TOKENunset and noGH_TOKEN_*set, the dotfiles gh wrapper falls back to the keyring login, which is Andrew._gh_wrapper_scoped_fallbackreturns early (gh-wrapper.sh:467), and the keyring read at 671-688 runs. So a plain unset would make the wrapper's own twistedmelonman, no-owner and third-party calls act as Andrew today, before layer 1 lands.With the sentinel, those calls fail closed. The identity probe fails and the wrapper refuses, or gh fails auth. App-routed calls do not change: that branch returns before the env-token check, and the minted App token replaces
GH_TOKENfor the call.What changed
lib/credentials.sh: readshostname -sonce. Only an exactarich-macmatch, in any case, allows personal tokens. Anywhere else it skips_load_gh_tokenand_load_owner_gh_tokens.creds_enforce_app_only_ghthen unsetsGH_TOKEN_NOS,GH_TOKEN_TWM,GH_TOKEN_SWM,GITHUB_TOKENandCLAUDE_WRAPPER_VAULT_VARS, and exports the sentinel asGH_TOKEN.hostnameis missing or fails, the host counts as personal.hostnamestub onPATH, the same way they stubopandsecurity.bin/claude-wrappercallscreds_enforce_app_only_ghagain just beforeexec.inject_secretsand the pre-launch hook run aftercredentials.sh, and a global~/.config/claude-code/secrets.opon a personal Mac setsGH_TOKENto the CCCLI PAT. Without the second call, that token would reach the session.secrets.opno longer exists is corrected.Accepted consequences
gh api user,gh searchwithout an owner) and gh reads of third-party repos also stop for agents on personal Macs.gh-app-routes.conf). Everything else is refused.Not covered: SSH-key
git fetch,git pullandgit clone. These use no PAT and no OAuth login. Agit pushover SSH acts as Andrew, so layer 1 covers it.Notes for the other layers
OP_SERVICE_ACCOUNT_TOKENis still exported on personal Macs, because secrets-loader needs it. The Automation vault holds both PATs. An agent couldop readthem from inside the session, so layer 2 needs to deny that read.gh api userround-trip first.Also in this PR
tests/test-wrapper.shnow unsetsCLAUDE_WRAPPER_VAULT_VARS, astest-credentials.shdoes. Test 3.6 failed on main when run from inside a wrapper session.tests/test-credentials.sh.Tests
tests/test-credentials.sh: 49/49. The new host-gate section covers:GH_TOKENis the sentinel, children are clean, and no vault read happens.arich-mac2and a missinghostnameare both treated as personal.ARICH-MACandarich-macare unchanged, and presets are kept.tests/test-wrapper.sh: 73/73. Test 4.3 launches the wrapper as a personal host with fake inherited tokens and checks that only the sentinelGH_TOKENreaches the process. Test 4.6 checks that the strip comes after secrets load and beforeexec, and it fails on main.shellcheck -S infois clean on all four changed scripts.