fix(claude): bind Keychain reads to exact macOS account - #2
Merged
Conversation
…ng Claude fallbacks
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.
Intent
Ship the Quota AXI exact-Claude-Keychain-account normalization required for Bridge cutover to the ruby-dlee/quota-axi fork only. Claude quota discovery must invoke fixed /usr/bin/security with both the exact service and OS-account selectors, resist hostile USER/LOGNAME/PATH, preserve non-Keychain fallbacks when the OS account is unavailable, and emit the exact Keychain account consistently in JSON and TOON auth-source and attempt contracts. OAuth-file attempts must not invent an account. This is the source for a future immutable 0.1.7 release consumed by Agent Fleet; it must not read or mutate live credentials, Desktop sessions, or provider homes during validation, must preserve the reviewed fixes already on this branch, and must never push to the upstream repository.
What Changed
/usr/bin/securitybinary with exact service and passwd-derived macOS account selectors, while preserving OAuth-file and cached fallbacks when the account is unavailable.Risk Assessment
✅ Low: The updated change cleanly omits account fields from OAuth-file TOON attempts while preserving exact Keychain account reporting, fixed-binary/account selectors, hostile-environment resistance, and non-Keychain fallbacks.
Testing
After retrying the initial Node 20 setup block with the already-installed Node 22 runtime, focused and full tests passed; an isolated real-CLI JSON/TOON flow demonstrated fixed-binary exact-account lookup under hostile environment variables, safe OAuth-file fallback, correct account propagation and omission, and output redaction. CLI transcripts replace screenshots because this change has no graphical UI.
Evidence: End-to-end JSON/TOON CLI transcript
Evidence: Security invocation and isolation audit
Evidence: Raw full JSON quota output
Evidence: Raw full TOON quota output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
src/render.ts:123- The full TOON renderer setsaccountto the literal"none"for every account-less attempt. An OAuth-file attempt therefore omitsaccountin JSON but emitsaccount: "none"in TOON, contradicting “OAuth-file attempts must not invent an account” and making the contracts disagree. Confirmnoneas an approved sentinel or omit the field for non-Keychain attempts.🔧 Fix: Omit invented OAuth-file accounts from TOON attempts
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Target inspection:git branch --show-current && git status --short && git rev-parse HEADplusgit diff/git logfrom base962844a52d611c5366fa535582fb72029dcd029cto targetInitial setup attempt:pnpm exec vitest run test/providers/claude-auth.test.ts test/cli.test.ts(stopped before tests because Node 20 cannot run pnpm 11.1.1)Focused suites:PATH="$HOME/.nvm/versions/node/v22.22.0/bin:$PATH" pnpm exec vitest run test/providers/claude-auth.test.ts test/cli.test.tsSynthetic end-to-end evidence:PATH="$HOME/.nvm/versions/node/v22.22.0/bin:$PATH" pnpm exec vitest run test/exact-keychain-validation.evidence.test.ts --reporter=verboseFull regression suite:PATH="$HOME/.nvm/versions/node/v22.22.0/bin:$PATH" pnpm testManual evidence audit: inspected captured JSON/TOON and verified fixed/usr/bin/security, exact-s/-aselectors, zero security calls when the OS account is unavailable, OAuth-file account omission, and synthetic-token redactionCleanup verification: removed the transient evidence harness, then rangit status --short && git rev-parse HEAD✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.