mirror of
https://github.com/garrytan/gstack.git
synced 2026-07-08 17:18:16 +02:00
feat: buildGStackLaunchArgs adds --gstack-suppress-prepare-stack-trace
Pack 2 / B11 flag plumbing for the new error-preparestacktrace-stealth.patch in gbrowser/chromium/patches/. Always emit --gstack-suppress-prepare-stack-trace unless the caller explicitly sets GSTACK_CDP_STEALTH=off in the environment. Off by default in patch behavior (no-op without the C++ patch), so this is safe on stock Playwright Chromium too. Closes the Cloudflare canary trick where a page sets Error.prepareStackTrace and watches for it to fire during CDP serialization of a logged Error object. Tests: All 33 stealth/browser-manager tests pass. New cases: - GSTACK_CDP_STEALTH=off disables suppression - empty env still emits the always-on flag (count=1) - all-populated env now emits 7 flags (was 6) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -323,6 +323,16 @@ export function buildGStackLaunchArgs(): string[] {
|
||||
const memory = env.GSTACK_DEVICE_MEMORY;
|
||||
if (memory) args.push(`--gstack-device-memory=${memory}`);
|
||||
|
||||
// Pack 2 / B11: suppress user-defined Error.prepareStackTrace during
|
||||
// V8 stack-trace formatting. Closes the Cloudflare Bot Management
|
||||
// canary trick where a page sets prepareStackTrace and watches for
|
||||
// it to fire during CDP serialization. Off by default — only set
|
||||
// when the C++ patch is present (gbrowser builds), gstack hosts
|
||||
// running stock Playwright Chromium leave it unset.
|
||||
if (env.GSTACK_CDP_STEALTH !== 'off') {
|
||||
args.push('--gstack-suppress-prepare-stack-trace');
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user