Skip to content

fix(browse): log decrypt failures behind GSTACK_DEBUG in cookie-import#1114

Open
mvanhorn wants to merge 1 commit intogarrytan:mainfrom
mvanhorn:mvanhorn/fix-cookie-import-decrypt-logging
Open

fix(browse): log decrypt failures behind GSTACK_DEBUG in cookie-import#1114
mvanhorn wants to merge 1 commit intogarrytan:mainfrom
mvanhorn:mvanhorn/fix-cookie-import-decrypt-logging

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Summary

The decrypt loop in importCookies uses a bare catch {} that swallows the error. The failed counter is surfaced in CLI output, but users have no visibility into which cookies failed or why, so partial-import bugs like #1057 become hard to diagnose.

Keep the counter, but log per-row detail on stderr when GSTACK_DEBUG=1 or DEBUG=1 is set. Output is byte-identical for the default path.

Changes

browse/src/cookie-import-browser.ts:282 - replace catch {} with a typed catch that logs host_key/name plus the error code and message when the debug env var is set. importCookiesViaCdp has no parallel bare-catch and is unchanged.

Testing

  • bun test browse/test/cookie-import-browser.test.ts - 22 pass, 0 fail
  • bun run build - clean

The manual repro the reporter describes (browse cookie-import-browser arc --domain slack.com --profile "Profile 14") needs a macOS keychain state that rotated at some point. With GSTACK_DEBUG=1 set, every decrypt failure in that run will now print a line like:

[cookie-import] decrypt failed for .slack.com/d [EACCES]: Keychain entry not found

which is enough to distinguish Keychain rotation, v20 App-Bound Encryption, DB corruption, or a per-cookie format edge case.

Closes #1057

This contribution was developed with AI assistance (Codex).

cookie-import-browser silently drops cookies that fail to decrypt,
leaving users unable to tell which cookies failed or why. The Keychain
entry behind Arc's Safe Storage can rotate, invalidating older
encrypted_value blobs while newer ones still decrypt, producing the
partial-import symptom reported.

Keep the existing failed counter, but surface per-row detail when
GSTACK_DEBUG=1 or DEBUG=1 is set. Log host_key and cookie name plus the
error code and message to stderr. Never log cookie values.

Closes garrytan#1057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cookie-import-browser: most cookies silently dropped — imports 3 of 22 for Arc Profile N

1 participant