Repository navigation
fix(credstore): stabilize macOS Keychain reads across rebuilds - #76
Merged
Merged
Conversation
monit-reviewer
approved these changes
Sep 26, 2026
monit-reviewer
left a comment
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 8f62857b25bb
Profile: open-cli-collective-review - Posting as: monit-reviewer
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
| policies:conventions | 0 |
| documentation:docs | 1 |
documentation:docs (1 finding)
Minor - docs/working-with-secrets.md:54
Never ... use security -i for writescontradicts the repository'sscripts/repair-macos-keychain-credentials.sh, which intentionally pipes generated input tosecurity -ito repair existing Keychain items. Qualify this as a rule for normal CLI credential writes, and point readers needing ACL repair to the supported script; make the matching warning indocs/distribution.mdconsistent.
Reviewer Coverage
go:implementation-tests— complete (broad); inspected 3 assigned files (5 inspected across reviewers):credstore/osbackend_byteness.go,credstore/osbackend_keychain_stable_read.go,credstore/osbackend_keychain_stable_read_test.go; skipped: none; constraints: Review limited to assigned Go implementation and tests; read-only tooling could not execute macOS Keychain integration tests.policies:conventions— complete (broad); inspected 4 assigned files (5 inspected across reviewers):credstore/osbackend_byteness.go,credstore/osbackend_keychain_stable_read.go,docs/distribution.md,docs/working-with-secrets.md; skipped: none; constraints: nonedocumentation:docs— complete (broad); inspected 2 assigned files (5 inspected across reviewers):docs/distribution.md,docs/working-with-secrets.md; skipped: none; constraints: none
Inspected files (5)
credstore/osbackend_byteness.gocredstore/osbackend_keychain_stable_read.gocredstore/osbackend_keychain_stable_read_test.godocs/distribution.mddocs/working-with-secrets.md
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 1m 15s | $0.06 | openai-codex/gpt-5.6-terra | cr 0.10.316
| Field | Value |
|---|---|
| Model | openai-codex/gpt-5.6-terra |
| Reviewers | go:implementation-tests, policies:conventions, documentation:docs |
| Engine | pi_rpc · openai-codex/gpt-5.6-terra |
| Reviewed by | cr · monit-reviewer |
| Duration | 1m 15s wall · 2m 13s compute |
| Cost | $0.06 |
| Tokens | 15.7k in / 1.9k out |
Per-workstream usage
orchestrator-selection— openai-codex/gpt-5.6-terra- In: 6.4k
- Out: 463
- Cache read: 0
- Cache create: 0
- Cost: $0.02
- Duration: 10s
go:implementation-tests— openai-codex/gpt-5.6-terra- In: 2.9k
- Out: 565
- Cache read: 14.8k
- Cache create: 0
- Cost: $0.02
- Duration: 53s
policies:conventions— openai-codex/gpt-5.6-terra- In: 821
- Out: 107
- Cache read: 12.8k
- Cache create: 0
- Cost: $0.01
- Duration: 26s
documentation:docs— openai-codex/gpt-5.6-terra- In: 1.3k
- Out: 679
- Cache read: 8.7k
- Cache create: 0
- Cost: $0.01
- Duration: 40s
orchestrator-rollup— openai-codex/gpt-5.6-terra- In: 4.3k
- Out: 66
- Cache read: 0
- Cache create: 0
- Cost: $0.01
- Duration: 3s
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.
Problem
macOS Keychain grants can be tied to the hash of an ad-hoc-signed CLI, so replacing a binary can prompt again for each stored credential.
Change
Read generic passwords through the fixed system-signed /usr/bin/security executable while preserving the existing service/account mapping. Keep native Keychain writes, metadata, listing, and deletion. No secrets are placed on command lines. Hermetic tests cover argument mapping, missing items, credential bytes, and the native-write boundary; the shared guidance is updated.
Verification
Real macOS Keychain rebuild probe
On a local Mac, I created a disposable Keychain and one synthetic generic-password item under a unique service/account, with its ACL explicitly trusting /usr/bin/security. I put that Keychain first in the user search list, built two reader executables from this PR with different build markers, and used each executable to open the Keychain backend and call Store.Get for the same item. Neither execution prompted. The original search list was restored and the temporary Keychain deleted.
This exercises the real macOS Keychain and the actual Store.Get path across two different binary identities. It does not test the interactive first-time Always Allow click or an installed CLI upgrade; those remain release verification steps. The local probe used synthetic data only.
Consumer verification boundary
The current codereview-cli release still embeds cli-common v0.4.1, so it does not contain this read path. Its signing identity alone is not evidence that every existing Keychain item grants access; a consumer upgrade must be tested separately.
Release follow-up
Build a consumer against this commit, grant Keychain access once through the normal user flow, rebuild or upgrade it, and verify a second read without a prompt. Coordinate consumer dependency bumps and releases after that check.