Skip to main content

Module cdp_hardening

Module cdp_hardening 

Source
Expand description

Advanced CDP leak hardening.

Injects a script that runs before all other stealth scripts to:

  1. Delete Playwright / Puppeteer binding remnants from window.
  2. Sanitize Error.prototype.stack to remove CDP-specific frame URLs.
  3. Harden console.debug so a getter-based stack-inspection trap cannot detect CDP from within it.
  4. Ensure the Navigator.prototype.webdriver property descriptor matches Chrome’s native format (accessor descriptor with a getter, no setter).
  5. Mark as non-enumerable any artifact properties that CDP injection may have left enumerable on window.

§Example

use stygian_browser::cdp_hardening::{cdp_hardening_script, CdpHardeningConfig};

let cfg = CdpHardeningConfig::default();
let js = cdp_hardening_script(&cfg);
assert!(js.contains("__playwright"));
assert!(js.contains("Error.prototype"));

Structs§

CdpHardeningConfig
Configuration for CDP leak hardening.

Functions§

cdp_hardening_script
Generate the CDP hardening injection script.