Repository navigation
fix: stop repeated Keychain password prompts - #8
Merged
Merged
Conversation
Read the Claude credential through /usr/bin/security instead of SecItemCopyMatching. Claude Code writes the item with that tool, so its partition list holds only "apple-tool:". A direct read fails that check and macOS asks for the login password even when the app is already on the access list, so "Always Allow" never stopped the prompts. The read is bounded by a five-second timeout, so a stuck read cannot stall the refresh loop the way an open dialog did. Claude-Session: https://claude.ai/code/session_01EFLAijFNmWssUbxYQDQR9N
SIGTERM only bounded the read when the child honoured it. A child ignoring SIGTERM kept stdout open and blocked the read past the five-second limit. Claude-Session: https://claude.ai/code/session_01EFLAijFNmWssUbxYQDQR9N
Contributor
Author
Review ledger
P2,
|
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.
Summary
Stops the repeated macOS password prompt for
Claude Code-credentials. InferenceMeter now reads the credential through/usr/bin/security, the same way Claude Code reads it, instead of callingSecItemCopyMatching.securitydlogged the cause on an affected machine:The app was already on the item's access list, but Claude Code writes the item with
security, so its partition list holds onlyapple-tool:. A direct read fails that check and macOS prompts, so Always Allow did not stop it.The read has a five-second timeout. The old call blocked a worker thread for as long as the dialog stayed open.
Related issue
No linked issue; reported directly by the owner.
Verification
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test(not run locally: the Xcode license is unaccepted on the dev Mac; covered by the requiredTest and buildcheck)DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make build(same)git diff --checkRun with the Command Line Tools toolchain instead:
ClaudeProviderandKeychain, compiled into a binary whose signature was on no access list, read the real item and returnedstate=okfrom the usage endpoint, with nosecuritydprompt events and no access-list change.security -i add-generic-password -U -X(the Claude Code write path) stayed at partitionapple-tool:, and each read returned the new value with no prompt. The item was then deleted.itemNotFound(exit 44). Fake tools that hang, ignoreSIGTERM, or suspend themselves were each stopped after about 5.3s and threwunhandled(9), with no leftover process.SecItemsymbols.Not yet observed: a real Claude Code token renewal against the new build. The dummy-item rewrite stands in for it.
Security and privacy
The credential travels over a pipe and only the service and account are arguments; stderr is discarded. This removes the consent dialog for this read. The item already trusts
/usr/bin/security, so any process running as the user could already read it this way, and the README now says so.https://claude.ai/code/session_01EFLAijFNmWssUbxYQDQR9N