Conversation
import-chrome read the d cookie with document.cookie through AppleScript, but Slack sets that cookie HttpOnly, so the page context never sees it. Extraction failed on the first check and every failure collapsed into one message: "Could not extract tokens from Chrome." Read the cookie from Chrome's cookie store and decrypt it with the Chrome Safe Storage keychain password, matching the Brave and Slack-desktop paths, and surface the setup failures that used to be swallowed: Apple Events disabled, missing Automation consent, no Slack tab, and App-Bound Encryption (v20). import-chrome now also prints the workspace URLs it keyed tokens to, because a token stored against an Enterprise Grid org shell cannot serve workspace calls. Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Paperclip <noreply@paperclip.ing>
arnaud-gp
force-pushed
the
fix/chrome-import-httponly-cookie
branch
from
September 20, 2026 12:25
f9fbdbe to
02a116a
Compare
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.
Problem
agent-slack auth import-chromealways failed on macOS with a single generic message:It failed even with a signed-in Slack tab open and
Allow JavaScript from Apple Eventsenabled, becausesrc/auth/chrome.tsread thedcookie through the page context:Slack sets
das HttpOnly, sodocument.cookienever contains it. Verified against a real profile:extractFromChrome()therefore bailed at its first check (!cookie.startsWith("xoxd-")) on every run, and the surroundingcatch { return null }collapsed every other cause — no Slack tab, Apple Events disabled, missing Automation consent — into the same message.The Brave and Slack-desktop paths already do this correctly: they read the cookie store and decrypt with the
Safe Storagekeychain password. Chrome was the odd one out.What Changed
src/auth/chrome.ts: read thedcookie from Chrome's cookie store (DefaultplusProfile N, bothCookiesandNetwork/Cookies) and decrypt it with theChrome Safe Storagekeychain password, reusingdecryptChromiumCookieValue. The DB is copied with its-wal/-shmsiblings before reading, so a running Chrome neither blocks the read nor hides recent writes.catch { return null }with typed, actionable errors:ChromeAppleScriptDisabledError,ChromeAutomationNotAuthorizedError(Apple event-1743),ChromeNoSlackTabError, andChromeAppBoundEncryptionErrorfor Chrome 127+v20values that cannot be decrypted outside Chrome.src/cli/auth-command.ts:import-chromenow prints the workspace URLs it keyed tokens to. Tokens are stored per workspace URL, and on Enterprise Grid an entry keyed to the org shell (https://<org>.enterprise.slack.com) cannot serve workspace-scoped calls, which was previously invisible without a separateauth whoami.src/cli/context-client-resolver.ts: the implicit browser fallback swallows the new Chrome errors. They are actionable only for an explicitauth import-chrome, not for every read command that happens to fall through to browser extraction.README.md: document the Automation consent andSafe Storagekeychain prerequisites, and the Enterprise Grid workspace-URL guidance.Verification
bun test— 410 pass, 0 fail. Newtest/chrome-auth.test.tscovers team parsing (including the no-tab sentinel and the xoxc/URL filter), v10 Safe Storage decryption, percent-decoding, thev20App-Bound Encryption error, wrong-password and empty-value handling, and profile/cookie-path discovery.bun run typecheck,bun run lint,bun run format:check— clean.dcookie isis_httponly=1and stored as av10value, i.e. unreachable viadocument.cookieand reachable via the cookie store.Risks
Chrome Safe Storagekeychain item, so the first run prompts for keychain approval. Previouslyimport-chromenever reached a keychain prompt because it failed earlier.v20) still cannot be imported. That is now an explicit error pointing atimport-desktop/import-brave/import-firefoxinstead of a silent failure.extractFromChrome()is nowasyncand can throw instead of only returningnull. Both call sites are updated; the opportunistic resolver path still degrades quietly.