Skip to content

[codex] add complete Keychain context sync - #150

Draft
shubh24 wants to merge 2 commits into
mainfrom
shubh24/keychain-context-sync
Draft

[codex] add complete Keychain context sync#150
shubh24 wants to merge 2 commits into
mainfrom
shubh24/keychain-context-sync

Conversation

@shubh24

@shubh24 shubh24 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changed

  • adds a complete keychain-context-sync skill for migrating a macOS Chrome profile into a Browserbase Context without source CDP
  • snapshots and archives durable profile state including site storage, service workers, bookmarks, history, preferences, and extension state
  • requests Chrome Safe Storage through the native macOS Keychain consent flow and decrypts cookie values in memory
  • implements Chrome's macOS v10 PBKDF2/AES decryption and schema-v24 host-digest verification
  • excludes disposable caches, runtime locks, tab-restore data, raw cookie/login databases, and saved passwords
  • envelope-encrypts the profile ZIP and uploads it through the Browserbase Context API
  • starts a persistent destination session and imports non-expired cookies using the destination browser's encryption environment
  • supports inspect-only validation, new or existing Contexts, domain filters, Verified mode, and residential proxies

Why

cookie-sync requires a live source CDP connection and only transfers cookies. This workflow supports consented access to a closed Chrome profile and migrates broader disk-backed browser state alongside its cookies.

The raw macOS cookie database cannot be copied directly into Browserbase's Linux runtime because encrypted values are bound to the source user's Keychain. The combined flow decrypts locally, uploads the profile without non-portable credential databases, and imports cookies in memory at the destination.

Safety and impact

  • macOS—not the script—collects Keychain authorization
  • the script never requests the user's login password directly
  • Safe Storage secrets, derived keys, cookie contents, profile metadata, and signed upload URLs are never logged or persisted
  • temporary database snapshots and archive files are removed after use
  • --inspect-only performs no Browserbase mutation; --upload is explicit
  • live Chrome profiles are rejected unless the user explicitly passes --allow-live-copy

Validation

  • repository and skill schema validation
  • syntax checks for both scripts
  • deterministic crypto tests covering legacy values, schema-v24 host binding, and digest rejection
  • private end-to-end validation of encrypted Context upload and fresh-session restoration
  • temporary validation resources were deleted after testing

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​browserbasehq/​stagehand@​3.7.16910010099100
Addednpm/​adm-zip@​0.5.18100859887100
Addednpm/​@​browserbasehq/​sdk@​2.16.09710010096100

View full report

@shubh24 shubh24 changed the title [codex] add keychain context sync skill [codex] add complete Keychain context sync Aug 5, 2026
@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @browserbasehq/stagehand is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: skills/keychain-context-sync/package-lock.jsonnpm/@browserbasehq/stagehand@3.7.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@browserbasehq/stagehand@3.7.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

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.

1 participant