fix(stealth): navigator.platform = MacIntel/Win32/Linux x86_64 (was UA-CH value)

platform_string() feeds the CDP Emulation.setUserAgentOverride 'platform' field,
which sets the LEGACY navigator.platform. It was returning the UA-CH form
("macOS"/"Linux") — but real Chrome reports navigator.platform = "MacIntel" on
macOS and "Linux x86_64" on Linux. "macOS" contradicts the UA's "Intel Mac OS X"
and is a trivial bot-detection tell (platform vs UA mismatch). UA-CH
(navigator.userAgentData.platform via platform_hint) stays "macOS"/"Windows"/
"Linux" — that form is correct there.

Verified locally on bot.sannysoft.com (all rows green incl. navigator.platform=
MacIntel) + eval probes: webdriver false, no Headless in UA, real WebGL
(Apple M3 Metal, not SwiftShader), plugins/permissions consistent.
This commit is contained in:
leeguooooo
2026-06-10 08:46:42 +09:00
parent 4bcfe74514
commit fc1699a526
+7 -2
View File
@@ -270,13 +270,18 @@ pub fn strip_source_url_labels(input: &str) -> String {
re_block.replace_all(&output, "").to_string()
}
/// The legacy `navigator.platform` value (set via the CDP
/// `Emulation.setUserAgentOverride` `platform` field). This is NOT the UA-CH
/// platform (see `platform_hint`): real Chrome reports `MacIntel` on macOS and
/// `Linux x86_64` on Linux, so emitting the UA-CH form ("macOS"/"Linux") here is
/// a detectable mismatch against the UA's "Intel Mac OS X" / Linux strings.
fn platform_string() -> &'static str {
if cfg!(target_os = "macos") {
"macOS"
"MacIntel"
} else if cfg!(target_os = "windows") {
"Win32"
} else {
"Linux"
"Linux x86_64"
}
}