Skip to content

fix: UA matches running Chrome, WebGL + worker spoof, tests and CI (0.3.0) - #2

Merged
huanthuyon671 merged 6 commits into
mainfrom
release/0.3.0
Sep 11, 2026
Merged

huanthuyon671 merged 6 commits into
mainfrom
release/0.3.0

Conversation

@huanthuyon671

Copy link
Copy Markdown
Contributor

Summary

  • UA/Client Hints now follow the real Chrome version. They were pinned to 119-121 while Chrome is at 152, which any modern checker flags. The launcher reads the version over CDP and builds UA + userAgentMetadata from it. Explicit fingerprint.userAgent still wins, with a mismatch warning.
  • WebGL renderer no longer leaks the host GPU on the Puppeteer/Playwright paths. Root cause: overrides were applied on the launcher's private CDP session, which pages driven by the user's own connect() never inherited. Scripts are now injected through the automation library's native API and the launcher auto-attaches at the browser target. Vendor/renderer is picked per profile, consistent with platform, and persisted.
  • Worker spoofing (closes can't spoof for web worker ? #1): Worker/SharedWorker are wrapped so navigator + WebGL spoof runs before the worker script. Module/service workers pass through untouched.
  • Adds 37 vitest tests (unit + headless integration, auto-skipped without Chrome) and GitHub Actions CI on Ubuntu/macOS.

Verification

Headless smoke on Chrome 152 against an https page, profile platform Win32:

check before after
navigator.userAgent Chrome/120 Chrome/152
userAgentData brands 120 Chromium/152 Google Chrome/152
WebGL renderer ANGLE (Apple, Apple M5 Max) ANGLE (AMD, Radeon RX 580 Direct3D11)
Worker navigator real values Win32 / hw 8 / Chrome/152

npm run typecheck && npm run build && npm test pass locally.

Closes #1

🤖 Generated with Claude Code

https://claude.ai/code/session_013qesGnPkH8K7y8CZRhvNoi

namvippro and others added 6 commits September 12, 2026 02:16
…nned 119-121 list

Spoofed UA and Client Hints now carry the real major version read via
CDP Browser.getVersion. An explicit fingerprint.userAgent still wins and
drives Client Hints; a warning is logged when its major differs from the
running browser.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qesGnPkH8K7y8CZRhvNoi
The WebGL renderer leaked the real GPU on the Puppeteer/Playwright paths:
CDP addScriptToEvaluateOnNewDocument is per-session, so scripts the launcher
installed on its own CDP client never reached pages the user's Puppeteer
connection drove. The integrations also hand-rolled partial navigator scripts
and injected no WebGL spoof at all.

- Route every integration (withPuppeteer, quickLaunch, withPlaywright,
  quickLaunchPlaywright, patchPage) through the shared getAllProtectionScripts
  bundle via the automation library's native injection API.
- Make the WebGL vendor/renderer deterministic per profile: persist a
  platform-consistent pair at profile creation (Win32 -> Intel/NVIDIA/AMD
  Direct3D, Mac -> Apple, Linux -> Mesa) and seed numeric params from it so
  repeated getParameter calls agree.
- Re-inject navigator + WebGL spoof inside Worker/SharedWorker by loading the
  original worker through a blob prelude, fixing GitHub issue #1. Module and
  service workers are passed through untouched (documented limitation).
- Attach the launcher CDP client at the browser target with setAutoAttach so
  the raw launch() path also covers pages opened later.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qesGnPkH8K7y8CZRhvNoi
- Unit tests for createWebGLScript, pickWebGLForPlatform, getAllProtectionScripts
  and createWorkerSpoofScript (no browser needed).
- Headless integration test launches Chrome via quickLaunch and asserts
  navigator + WebGL match the profile in both window and Worker contexts.
  Auto-skips when no Chrome binary is present so CI without a browser passes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qesGnPkH8K7y8CZRhvNoi
# Conflicts:
#	src/chrome-launcher.ts
#	src/fingerprint.test.ts
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qesGnPkH8K7y8CZRhvNoi
@huanthuyon671
huanthuyon671 merged commit 1e1f00b into main Sep 11, 2026
2 checks passed
@huanthuyon671
huanthuyon671 deleted the release/0.3.0 branch September 11, 2026 20:39
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.

can't spoof for web worker ?

1 participant