Skip to content

Commit 015321b

Browse files
johnlarkin1claude
andauthored
docs: update keychain docs to reflect securityCLI as default (#15)
Update CLAUDE.md, CHANGELOG.md, KEYCHAIN_FIX.md, and DEVELOPMENT_SETUP.md to reflect that /usr/bin/security CLI is now the default keychain read strategy, eliminating prompt issues. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 90a7820 commit 015321b

4 files changed

Lines changed: 21 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
- Menu: hide contextual provider actions while Overview is selected and rebuild switcher state when overview availability changes (#416).
3737

3838
### Claude OAuth & Keychain
39+
- **Default to `/usr/bin/security` CLI for Claude keychain reads**, eliminating recurring macOS keychain password prompts after rebuilds/updates. Security.framework remains available as a user override.
3940
- Use a `claude-code/<version>` User-Agent for OAuth usage requests instead of a generic identifier.
40-
- Add an experimental Claude OAuth Security-CLI reader path and option in settings.
41+
- Rename `.securityCLIExperimental``.securityCLI` (now the production default).
4142
- Apply stored prompt mode and fallback policy to silent/noninteractive keychain probes.
4243
- Add cooldown for background OAuth keychain retries.
4344
- Disable experimental toggle when keychain access is disabled.

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Macro support types live in `Sources/CodexBarMacroSupport/`, implementations use
7070
### Authentication Chain
7171

7272
Providers authenticate via a fallback chain configured in their descriptor's `supportedSourceModes`:
73-
1. **OAuth** — Token from macOS Keychain (Claude, Codex, VertexAI)
73+
1. **OAuth** — Token from macOS Keychain (Claude, Codex, VertexAI). Claude defaults to `/usr/bin/security` CLI reader (avoids keychain prompts on rebuild); Security.framework available as user override.
7474
2. **Web/Cookies** — Browser cookie extraction via SweetCookieKit (Cursor, Copilot, Gemini). Default to Chrome-only to avoid other browser prompts.
7575
3. **CLI** — Parse stdout from CLI tools via PTY (Claude, Codex, Augment)
7676
4. **API** — Direct API calls with stored token

docs/DEVELOPMENT_SETUP.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,15 @@ read_when:
88

99
# Development Setup Guide
1010

11-
## Reducing Keychain Permission Prompts
11+
## Keychain Permission Prompts
1212

13-
When developing CodexBar, you may see frequent keychain permission prompts like:
13+
As of v0.18.0-beta.3-jl.2, CodexBar defaults to reading Claude credentials via `/usr/bin/security` CLI, which **does not trigger keychain prompts**. No special setup is needed.
1414

15-
> **CodexBar wants to access key "Claude Code-credentials" in your keychain.**
16-
17-
This happens because each rebuild creates a new code signature, and macOS treats it as a "different" app.
18-
19-
### Quick Fix (Temporary)
15+
If you've switched to the Security.framework reader (via Preferences), you may see prompts like:
2016

21-
When the prompt appears, click **"Always Allow"** instead of just "Allow". This grants access to the current build.
22-
23-
### Permanent Fix (Recommended)
17+
> **CodexBar wants to access key "Claude Code-credentials" in your keychain.**
2418
25-
Use a stable development certificate that doesn't change between rebuilds:
19+
This happens because each rebuild creates a new code signature, and macOS treats it as a "different" app. To reduce these prompts with the Security.framework reader:
2620

2721
#### 1. Create Development Certificate
2822

@@ -135,7 +129,7 @@ pkill -x CodexBar || pkill -f CodexBar.app || true
135129

136130
### "Permission denied" when accessing keychain
137131

138-
Make sure you clicked **"Always Allow"** or set up the development certificate (see above).
132+
With the default `/usr/bin/security` CLI reader, this should not happen. If using the Security.framework reader, make sure you clicked **"Always Allow"** or set up the development certificate (see above).
139133

140134
### Multiple app bundles keep appearing
141135

docs/KEYCHAIN_FIX.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ Load order for credentials:
4545
2. In-memory cache.
4646
3. CodexBar keychain cache (`com.steipete.codexbar.cache`, account `oauth.claude`).
4747
4. `~/.claude/.credentials.json`.
48-
5. Claude CLI keychain service: `Claude Code-credentials` (promptable fallback).
48+
5. Claude CLI keychain service: `Claude Code-credentials` — read via `/usr/bin/security` CLI by default (prompt-free), with Security.framework as fallback.
4949

50-
Prompt mitigation:
50+
Keychain read strategy:
51+
- **Default: `/usr/bin/security` CLI** (`ClaudeOAuthKeychainReadStrategy.securityCLI`). The CLI binary is permanently in the keychain item's ACL (added by Claude Code during login), so reads never trigger macOS keychain prompts — even after app rebuilds or updates.
52+
- **Override: Security.framework** (`ClaudeOAuthKeychainReadStrategy.securityFramework`). Available via user preference. Uses `SecItemCopyMatching`, which requires the calling binary to be in the keychain ACL — invalidated on every rebuild, causing recurring prompts.
53+
- Strategy is stored in UserDefaults key `claudeOAuthKeychainReadStrategy`.
54+
55+
Prompt mitigation (Security.framework fallback path only):
5156
- Non-interactive keychain probes use `KeychainNoUIQuery` (`LAContext.interactionNotAllowed` + `kSecUseAuthenticationUIFail`).
5257
- Pre-alert is shown only when preflight suggests interaction may be required.
5358
- Denials are cooled down in the background via `claudeOAuthKeychainDeniedUntil`
@@ -56,11 +61,14 @@ Prompt mitigation:
5661
- Background cache-sync-on-change also performs non-interactive Claude keychain probes (`syncWithClaudeKeychainIfChanged`)
5762
and can update cached OAuth data when the token changes.
5863

59-
### Why two Claude keychain prompts can still happen on startup
64+
### Why two Claude keychain prompts could happen on startup (Security.framework path only)
65+
> **Note:** With the default `/usr/bin/security` CLI reader, keychain prompts do not occur. This section only applies
66+
> when the user has explicitly switched to the Security.framework reader.
67+
6068
When CodexBar does not have usable OAuth credentials in its own cache (`com.steipete.codexbar.cache` / `oauth.claude`),
6169
bootstrap falls through to Claude CLI keychain reads.
6270

63-
Current flow can perform up to two interactive reads in one bootstrap call:
71+
Under the Security.framework path, the flow can perform up to two interactive reads in one bootstrap call:
6472
1. Interactive read of the newest discovered keychain candidate.
6573
2. If that does not return usable data, interactive legacy service-level fallback read.
6674

0 commit comments

Comments
 (0)