Keychain: migrate CodexBar Cache to data-protection keychain and finish prompt-proofing

Open
#2,562 3 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
swift

Research direction

Start with the audit in #2561, then inspect Sources/CodexBar/KeychainMigration.swift, ClaudeOAuthKeychainPromptMode.swift, the seven named token stores, and Scripts/sign-and-notarize.sh/package_app.sh. Review Tests/CodexBarTests/ClaudeUsageTests.swift around line 613 and run the relevant tests. Done means the migration, prompt behavior, entitlements, escalation mode, and live CLI path are addressed without regressions.

Written by the indexing model from the issue text.

Description

clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:needs-security-review clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:auth-provider impact:security impact:ux-friction issue-rating: 🦞 diamond lobster P2

Follow-up to #2561, which stopped the acute "CodexBar Cache" login-keychain password prompts (ACL poisoning by unbundled binaries; test children escaping suppression). The structural fixes remain:

  1. Migrate the cache item to the data-protection keychain. Set kSecUseDataProtectionKeychain: true (+ access group) and drop the SecAccess trusted-app ACL entirely. Data-protection items are keyed to the code-signing identity and can never raise the legacy "wants to use your confidential information" dialog. Needs: keychain-access-groups entitlement plumbing in Scripts/sign-and-notarize.sh / package_app.sh (app + Contents/Helpers/CodexBarCLI), plus one-time migration that reads the legacy item, writes the DP item, and deletes the legacy one (its ACL cannot be repaired in place).
  2. KeychainMigration hygiene (Sources/CodexBar/KeychainMigration.swift:75-133): reads without NoUI and delete-then-re-add drops any existing ACL. Should apply KeychainNoUIQuery and preserve/rebuild access attributes.
  3. Seven provider token stores (CookieHeaderStore, CopilotTokenStore, KimiTokenStore, ZaiTokenStore, SyntheticTokenStore, MiniMaxAPITokenStore, MiniMaxCookieStore) read with kSecReturnData and no NoUI; the preflight+warn pattern explains prompts but does not prevent them. Decide per-store whether silent failure + UI surfacing beats the OS prompt.
  4. effectiveMode escalation (ClaudeOAuthKeychainPromptMode.swift:69-78): selecting the experimental security-CLI read strategy silently forces the Security.framework fallback to .always prompting — should stay at the user's configured mode.
  5. ClaudeUsageTests live path spawns the real claude CLI through a PTY (Tests/CodexBarTests/ClaudeUsageTests.swift:613), whose keychain access CodexBar cannot suppress; consider gating harder or documenting.

Context: full audit in #2561's description; probe/audit session 2026-08-01.

Dominant language
Swift
Stars
23.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
231

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from steipete/CodexBar

All issues in steipete/CodexBar

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.