feat: Windows cookie import for setup-browser-cookies#64
Open
MichaelTheMay wants to merge 6 commits intogarrytan:mainfrom
Open
feat: Windows cookie import for setup-browser-cookies#64MichaelTheMay wants to merge 6 commits intogarrytan:mainfrom
MichaelTheMay wants to merge 6 commits intogarrytan:mainfrom
Conversation
Bun's subprocess pipe handling and WebSocket client are broken on Windows, which prevents Playwright from launching Chromium. This commit adds a Node.js-based server path for Windows while keeping the original Bun path for macOS/Linux. Changes: - cli.ts: Windows detection, bun path resolution, 20s startup timeout, cross-platform /tmp handling, Windows-compatible process kill (taskkill) - win-server.ts: Node.js entry point with Bun API polyfills (serve, spawn, sleep, file, write) that imports the standard server.ts - cookie-import-browser.ts: Dynamic import for bun:sqlite to avoid crash on Node.js - meta-commands.ts, snapshot.ts, write-commands.ts: Replace hardcoded /tmp with os.tmpdir(), use path.sep for cross-platform path comparison - server.ts: Cross-platform import.meta.dir fallback - package.json: Remove Windows-incompatible glob in build script, add tsx dep Tested on Windows 11 with Node.js v22 + Bun v1.3.10: - browse goto, text, snapshot, screenshot, responsive, js, console, network, tabs, status all verified working Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Types (BrowserInfoBase, DomainEntry, ImportResult, PlaywrightCookie, RawCookie), CookieImportError, Chromium epoch utils, sameSite mapping, profile validation, and DB copy-when-locked helper — shared by macOS and Windows modules.
Windows module (cookie-import-browser-win.ts): Chrome/Edge/Brave detection, DPAPI master key via PowerShell, v10 AES-256-GCM cookie decryption, Network/Cookies path fallback for Chrome 96+. Platform dispatcher (cookie-import.ts): routes to macOS or Windows module based on process.platform. Refactored macOS module to import shared code from cookie-import-shared.ts. Added better-sqlite3 dependency for Node.js/tsx SQLite access on Windows. 27 new tests for Windows decryption pipeline.
- cookie-picker-routes.ts: import from platform dispatcher, await async calls - write-commands.ts: import from dispatcher, platform-detect open command - win-server.ts: remove bun:sqlite error handler (no longer needed) - cli.ts: fix IS_WINDOWS used before declaration (ReferenceError)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
findInstalledBrowsers,listDomains,importCookiesto macOS or Windows module based onprocess.platform.cookie-import-shared.ts.better-sqlite3dependency — prebuilt native SQLite for Node.js/tsx on Windows.Network/Cookiesfallback — both macOS and Windows now check the new path first.cmd /c start(Windows),open(macOS),xdg-open(Linux).cli.tsIS_WINDOWS used before declaration (ReferenceError on Windows).win-server.tssimplified — removed bun:sqlite error handler.Pre-Landing Review
No issues found. (No SQL injection, no LLM outputs, no user-facing HTML. Parameterized queries, sanitized PowerShell inputs, path traversal prevention.)
Eval Results
No prompt-related files changed — evals skipped.
TODOS
Known Limitations
app_bound_encrypted_keyis DPAPI-encrypted with LocalMachine scope + browser-specific entropy, inaccessible to third-party tools. v10 cookies decrypt correctly.Test plan
cookie-import-browserdetects Chrome + Edge, picker UI opens, Edge DB reads + DPAPI decrypts🤖 Generated with Claude Code