Goal of v0.10: any kooky-using CLI on the sink (instacart-pp-cli, bird, future PP CLIs) reads Chrome cookies headlessly from SSH or LaunchAgent context, with no per-binary Always-Allow click and no manual paste.
This runbook covers what the wizard does automatically, what it cannot do on macOS, and the one-time GUI fallback for when programmatic mechanism does not succeed.
After the standard pair / config / LaunchAgent steps, the sink install
auto-runs set-keychain-access, which spawns a one-shot LaunchAgent in
the user's GUI session and iterates strategies, validating each via the
same Apple Security framework call path kooky-CGO uses:
-
delete-and-recreate-with-A (primary; works on fresh installs). Best-effort delete of the existing Chrome Safe Storage item, then
security add-generic-password -Awith a random password. The-Aflag means "any application may access this item without warning." When the item is freshly created, this does not require the login keychain password. -
partition-list:apple-tool,apple (fallback). Tries to broaden the item's partition list. On macOS 15+ this typically requires the login keychain password and will fail from a LaunchAgent context.
-
trust-list:<binary> (fallback per
--extra-binary). Updates the existing item with-T <binary path>to add the specific binary to the per-binary trust list. Requires reading the existing password first, which works from LaunchAgent context when the keychain is unlocked.
The wizard reports which strategy won:
agentcookie wizard: keychain access: delete-and-recreate-with-A
If all strategies fail, the install does not abort. It prints a loud warning and points at this runbook.
After the wizard prints keychain access: <strategy>, every kooky-using
CLI on the sink reads Chrome cookies silently. Validate:
ssh matts-mac-mini '/Users/mvanhorn/go/bin/instacart-pp-cli auth login'
Expected: imported N cookies from Chrome, exit 0, no GUI prompt fires
on the Mac mini desktop during the run.
Then:
ssh matts-mac-mini '/Users/mvanhorn/go/bin/instacart-pp-cli doctor'
Expected:
[ok ] session: N cookies from chrome
[ok ] api: logged in as <Matt>
Note from chrome, not from paste. That confirms the cookies came
through kooky reading Chrome's Cookies file, not from a stale
auth paste session cache.
If the wizard prints keychain access: FAILED (typically because the
Chrome Safe Storage item already exists with a restrictive ACL from a
prior install or from Chrome itself running), do this one GUI step at
the Mac mini desktop (Screen Sharing works):
- Open Keychain Access.app.
- In the search bar, type
Chrome Safe Storage. - Double-click the row. The info window opens.
- Click the Access Control tab.
- Select the Allow all applications to access this item radio button (the top option).
- Click Save Changes.
- macOS prompts for your login keychain password. Type it once.
The change is durable. After this:
ssh matts-mac-mini '/Users/mvanhorn/bin/agentcookie internal keychain-probe'
should print ok len=N (where N is the password byte length; the
password itself is never printed).
If ok len=0, the keychain item exists but the password is empty.
Re-run the wizard:
ssh matts-mac-mini '/Users/mvanhorn/bin/agentcookie wizard set-keychain-access'
The wizard's delete-and-recreate-with-A strategy can now succeed
because the GUI click cleared the prior ACL restrictions, leaving a
clean slate for the recreate.
After install (or after the GUI fallback) the sink should pass:
-
pgrep -f "agentcookie sink"returns the sink PID -
tail -5 ~/.agentcookie/logs/sink.err.logshows recentprobe ok: N cookies round-tripped, meta.version=18 -
agentcookie internal keychain-probeover SSH printsok len=N(N > 0) -
instacart-pp-cli auth loginover SSH printsimported N cookies from Chromeand exits 0 -
instacart-pp-cli doctorover SSH prints[ok] session: N cookies from chrome(not "from paste") -
instacart-pp-cli doctorover SSH prints[ok] api: logged in as
security set-generic-password-partition-list and
security add-generic-password -U -A (update an existing item to set
-A) both call SecKeychainItemSetAccessWithPassword under the hood,
which requires the user's login keychain password. macOS protects this
operation deliberately because broadening keychain access is a
security-sensitive change. There is no headless bypass for modifying
an existing item's ACL. The wizard's delete-and-recreate-with-A
strategy side-steps this by deleting first and creating a fresh item;
this works because SecKeychainAddGenericPassword on a new item
respects the -A flag at creation time without a password prompt
(provided the login keychain is unlocked, which it is inside a
LaunchAgent).
After v0.10, Chrome Safe Storage is readable by any process on the user's account. This is broader than Chrome's default (apps in the Apple-signed partition only). For an agentcookie sink running headless on a Mac mini, the practical threat model already assumes:
- The machine itself is a security boundary
- Any process running as the user can already exfiltrate cookies
via the
~/.agentcookie/cookies-plain.dbsidecar (plaintext, mode 0600) - The bridge's value depends on multiple processes being able to read the cookies
If you do not want this trade-off, pass --skip-keychain-access to
the wizard. Kooky-using CLIs on this sink will then prompt for
Always-Allow on first run, per binary.