Skip User-Agent spoofing on Google auth domains to fix login rejection

Google's login detects UA mismatches and blocks sign-in as "insecure."
Skip UA/Accept-Language header modification and JS navigator.userAgent
override on accounts.google.com and accounts.youtube.com. All other
fingerprint vectors (canvas, WebGL, screen, etc.) remain active.
This commit is contained in:
sal
2026-03-01 16:13:18 -06:00
parent 159cbdf5ed
commit 930814015b
2 changed files with 40 additions and 5 deletions

View File

@@ -170,6 +170,16 @@
// =========================================================================
if (vectorEnabled("navigator")) {
// Auth domains where UA spoofing breaks login — return real values there
const AUTH_BYPASS_DOMAINS = ["accounts.google.com", "accounts.youtube.com"];
const UA_PROPS = new Set(["userAgent", "appVersion", "oscpu"]);
// Capture real values before any overrides
const realNav = {};
for (const p of UA_PROPS) {
try { realNav[p] = window.navigator[p]; } catch(e) {}
}
const navOverrides = {
hardwareConcurrency: CONFIG.nav.hardwareConcurrency,
platform: CONFIG.nav.platform,
@@ -182,11 +192,27 @@
for (const [prop, value] of Object.entries(navOverrides)) {
if (value !== undefined) {
Object.defineProperty(pageWindow.Navigator.prototype, prop, {
get: exportFunction(function() { return value; }, pageWindow),
configurable: true,
enumerable: true
});
if (UA_PROPS.has(prop)) {
// UA-related props: return real value on auth domains
const realValue = realNav[prop];
Object.defineProperty(pageWindow.Navigator.prototype, prop, {
get: exportFunction(function() {
try {
const h = pageWindow.location.hostname;
if (AUTH_BYPASS_DOMAINS.indexOf(h) !== -1) return realValue;
} catch(e) {}
return value;
}, pageWindow),
configurable: true,
enumerable: true
});
} else {
Object.defineProperty(pageWindow.Navigator.prototype, prop, {
get: exportFunction(function() { return value; }, pageWindow),
configurable: true,
enumerable: true
});
}
}
}