Skip to content

fix(stealth): review fixes — guard plugins, rewrite stack trace cleanup#320

Merged
jackwener merged 1 commit intomainfrom
feat/browser-stealth
Mar 23, 2026
Merged

fix(stealth): review fixes — guard plugins, rewrite stack trace cleanup#320
jackwener merged 1 commit intomainfrom
feat/browser-stealth

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Changes

Review follow-up fixes for the stealth anti-detection module (#319):

Bug fixes

  • Only override navigator.plugins when empty — on a real user browser, plugins are already populated with genuine values. Overwriting them with fakes was counterproductive and detectable.
  • Replace Error.prepareStackTrace (V8/Node-only, doesn't work in browser) with Error.prototype.stack getter override — correctly intercepts new Error().stack reads in browser page context.
  • Fix \\n escaping in template literal — was causing SyntaxError: Invalid or unexpected token in the generated JS.

Improvements

  • Dynamic cdc_ variable scan via Object.getOwnPropertyNames(window) instead of hardcoded 3 variable names — adapts to all ChromeDriver versions.
  • Updated tests to cover 7 patches (was 6).

All 325 tests pass ✅

- Only override navigator.plugins when empty (don't replace real user
  browser plugins with fakes)
- Replace Error.prepareStackTrace (V8/Node-only) with
  Error.prototype.stack getter override that works in browser context
- Fix \\n escaping in template literal for stack trace split/join
- Dynamic cdc_ variable scan via getOwnPropertyNames instead of
  hardcoded names
- Update tests to cover 7 patches
@jackwener jackwener merged commit f852da3 into main Mar 23, 2026
11 checks passed
@jackwener jackwener deleted the feat/browser-stealth branch March 23, 2026 17:41
@jackwener jackwener mentioned this pull request Mar 23, 2026
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