Skip to content

Keychain authorization prompt on every launch of a dev build — make grants stick or avoid the cross-app read (chatbox reference) #101

Description

@kiki830621

Problem

Original text:
https://github.com/chatboxai/chatbox 這裡面好像有不用每次開都要授權一次鑰匙圈的方法,我也想要用」
— Source: user report, 2026-07-27

Every launch of a locally-built Logos pops the macOS keychain authorization dialog (「Logos」想使用你在鑰匙圈中的「Claude Code-credentials-…」). Clicking 永遠允許 does not stick across rebuilds. The user wants what chatbox delivers: open the app, no keychain prompt, ever.

Type

feature

Priority

P2

Expected

Launching Logos (including day-to-day dev builds) never interrupts with a keychain authorization dialog. A one-time grant, if any, persists.

Actual

The dialog reappears on (nearly) every launch of a rebuilt app, blocking the terminal/claude spawn until dismissed.

Initial evidence (to confirm at diagnose)

Two compounding causes on the Logos side, plus what chatbox actually does:

  • Cross-application keychain read: Sources/LogosUsage/ClaudeKeychain.swift reads the claude CLI's own credential items (Claude Code-credentials / Claude Code-credentials-<hash>, read-only SecItemCopyMatching — used e.g. for needs-login/usage surfacing). Those items were created by a different binary, so macOS requires user authorization, and an 永遠允許 grant is recorded against Logos's code signature.
  • Ad-hoc signature churn: make bundle / make install sign with codesign --sign - — every rebuild gets a fresh ad-hoc identity, so the previously granted ACL no longer matches → macOS asks again. (make release-signed uses a stable Developer ID, where a grant would stick.)
  • What chatbox actually does (local reference clone of chatboxai/chatbox): it never touches the macOS keychain at all — settings and API keys live in localStorage / electron-store plain files (its safeStorage.ts is a localStorage wrapper, not Electron's safeStorage). Zero keychain use → zero prompts, at the cost of plaintext credential storage.

Fix directions to evaluate (diagnose decides)

  1. Stable dev signing: sign dev bundles with the Apple Development identity instead of ad-hoc (the Track-B signing identity already exists per project docs), so one 永遠允許 grant persists across rebuilds. Lowest-effort, keeps the security posture.
  2. Drop or defer the cross-app keychain read: detect needs-login/usage state without SecItemCopyMatching on claude's items (e.g. probe via the claude CLI itself, config-dir artifacts, or lazily on explicit user action rather than at launch), so routine launches perform no keychain access at all — chatbox's UX without chatbox's plaintext trade-off.
  3. Not recommended as-is: copying chatbox's storage model (plaintext files) — conflicts with Logos's documented security posture (secrets live in the keychain; README "Local data & privacy").

Impact

  • Every dev-build launch is interrupted; the dialog also blocks the hosted claude spawn until dismissed.
  • Automated launches (smoke tests, dogfooding) inherit the same modal interruption.

Clarification (added post-filing)

Original text:
「我想用鑰匙圈但是卻不用每次都要重新授權的方法」
— Source: user, 2026-07-27

Scope locked: the solution MUST keep credentials in the macOS keychain (no chatbox-style plaintext storage — fix direction 3 is now formally out of scope). The goal is chatbox's outcome (zero authorization prompts), achieved via directions 1 and/or 2: a stable code-signing identity for dev builds so a one-time grant persists, and/or removing or deferring the launch-time cross-application keychain read so routine launches perform no ACL-prompting access. Storage stays in the keychain either way.

Current Status

Phase: closed

Clarity Surface(idd-clarify run 2026-07-27T07:51:20Z)

Type Source Suggested canonical Status
ambiguity "我也想要用" Wanting chatbox's (a) outcome — zero prompts — vs (b) exact method — no keychain, plaintext storage. Body interprets as (a) with Logos's keychain security posture preserved (fix direction 3 rejects (b)); confirm at diagnose. resolved @ 2026-07-27T07:55:33Z (reason: user confirmed — keep the keychain, eliminate re-authorization; see Clarification below)
missing-context "the dialog reappears on (nearly) every launch" Full inventory of which keychain accesses fire at launch is unverified — the observed dialog names claude's credential item, but whether Logos's own service item or other reads also prompt after a signature change needs confirmation at diagnose. resolved @ 2026-07-27T08:00:51Z (reason: inventory complete — the ONLY keychain access in Logos is LogosUsage's read-only SecItemCopyMatching on claude's items, launch-triggered by the status bar's usage fetch; LogoSwitch has a red-line test making any SecItem call a compile error, and Logos stores no own-service secrets. Details in Diagnosis)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions