test(e2e): keep the spawned entire binary off the real OS keychain#1368
Merged
Conversation
1ea54e2 added keyring.MockInit() to the cli package TestMain so in-process tests don't read the developer's keychain. But the e2e suite (run by `mise run test:ci` via the canary, and by `mise run test:e2e`) drives the REAL entire binary as a subprocess, which MockInit can't touch — so a credential-resolving flow (e.g. the pre-push hook) still triggers a macOS keychain unlock prompt. Two stores are reachable: the unconditional internal/entireclient/tokenstore, and the auth package's legacy keyring store (auth.NewStore().GetToken fallback in contexts.go), which queries the keychain even when no token is present. Neutralize both in the e2e environment: - Add a shared build:e2e task that builds entire with -tags=authfilestore (so the auth file backend is compiled in), and point the canary, roger-roger, and default e2e tasks at it. Production `mise run build` stays untagged. - In e2e TestMain, set ENTIRE_TOKEN_STORE=file/_PATH (covers tokenstore, no tag needed) and ENTIRE_TEST_AUTH_STORE_FILE (covers the auth keyring store under the authfilestore tag), pointing at files in the run's artifact dir. Child processes (the binary, git hooks) inherit these. With these set, resolveBackendLocked returns a fileStore and chooseBackend returns the file backend, so no keyring/keychain call can occur. Canary verified green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 6d64e8760acb
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the e2e build/test path so that the entire binary executed as a subprocess (and any git hooks it spawns) uses file-backed credential storage instead of the OS keychain, preventing macOS keychain unlock prompts during e2e runs.
Changes:
- Add a
build:e2emise task that buildsentirewith-tags=authfilestorefor e2e usage. - Update e2e mise task scripts to use
build:e2einstead of the defaultbuild. - Set e2e
TestMainenvironment variables to force file-backed token/auth stores under the e2e artifact/run directory.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
mise.toml |
Adds build:e2e task to build an e2e-friendly binary using the file-backed auth store tag. |
mise-tasks/test/e2e/roger-roger |
Switches e2e build step to build:e2e. |
mise-tasks/test/e2e/canary |
Switches e2e build step to build:e2e. |
mise-tasks/test/e2e/_default |
Switches default e2e build path to build:e2e when E2E_ENTIRE_BIN isn’t provided. |
e2e/tests/main_test.go |
Sets env vars in TestMain to route spawned binaries/hooks to file-backed token/auth stores. |
build:e2e tagged the entire binary but not git-remote-entire. The remote helper imports cmd/entire/cli/auth, so it can reach the keyring-backed auth store and still prompt the OS keychain when e2e flows invoke it (e.g. via a push). Build it with -tags=authfilestore as well so ENTIRE_TEST_AUTH_STORE_FILE routes it to the file backend, keeping the whole e2e environment keychain-free. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: bf4acb0b808b
pfleidi
approved these changes
Jun 4, 2026
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.
https://entire.io/gh/entireio/cli/trails/519
Problem
1ea54e2addedkeyring.MockInit()to the cli packageTestMainso in-process tests don't read the developer's keychain. But that's process-local — the e2e suite drives the realentirebinary as a subprocess (viaE2E_ENTIRE_BIN), whichMockInitcannot touch. Somise run test:ci(which runs the canary) andmise run test:e2estill trigger a macOS keychain unlock prompt whenever a canary flow resolves credentials (e.g. thepre-pushhook).Two stores are reachable from the spawned binary:
internal/entireclient/tokenstore(always compiled).authpackage's legacy keyring store —auth.NewStore().GetToken()fallback incontexts.go, which queries the keychain even when no token is present.This was never a regression of
1ea54e2(itsMockInitis intact and only ever covered in-process tests) and is unrelated to the path-traversal work in #1365.Fix
Neutralize both stores in the e2e environment:
build:e2etask buildsentirewith-tags=authfilestore(compiles in the auth file backend). The canary, roger-roger, and default e2e tasks now use it. Productionmise run buildstays untagged.TestMainsets, pointing into the run's artifact dir (inherited by the binary and the git hooks it spawns):ENTIRE_TOKEN_STORE=file+ENTIRE_TOKEN_STORE_PATH— coverstokenstore(no tag needed).ENTIRE_TEST_AUTH_STORE_FILE— covers the auth keyring store (honored only underauthfilestore).With these set,
resolveBackendLockedreturns afileStoreandchooseBackendreturns the file backend, so no keyring/keychain call can occur.Testing
mise run test:e2e:canarygreen (vogon + roger-roger), now keychain-free by construction.🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit 2965add. Configure here.