Skip to content

fix(browser): restore the Chrome-shaped browser identity (STA-7147) - #19927

Merged
brennanb2025 merged 4 commits into
mainfrom
fix/restore-chrome-shaped-browser-identity
Sep 10, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
fix/restore-chrome-shaped-browser-identity

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since v1.4.198 the embedded browser announces itself on every non-Google host as:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Orca/1.4.198 Chrome/150.0.7871.224 Electron/43.4.1 Safari/537.36

No browser sends that. Sites that re-check the identity holding a session reject it — reports of being signed out of x.com, LinkedIn and "most websites."

This escapes our app. One reporter was signed out of LinkedIn in their own Chrome and met LinkedIn's "Quick security check … suspicious activity" SMS flow. Orca's cookie jar cannot touch Chrome's, so that is server-side session revocation.

436ef827dd (#18749, merged Sep 4) is the cause. v1.4.197 does not contain it; v1.4.198 (Sep 8) is the first build that does; first report Sep 9. It is the only identity-touching commit in src/main/browser in that window.

The repo already documented the mechanism, in a comment #18749 edited without acting on (browser-google-auth-ua.ts): copied-in cookies "sent under a UA that doesn't match a real first-party browser get flagged by anti-fraud." That is why the Google auth-host switch exists. #18749 kept it for accounts.google.com and gave every other host an Electron identity.

Not a cookie-import bug. No cookie-import file changed on main since Aug 31, and the import attaches its own debugger (browser-cookie-clear-store.ts:142-177), independent of the attach #18749 removed. Cookies were always written correctly; servers were refusing them.

Fix

Strip the Electron/x.y.z and Orca/x.y.z tokens from the session UA. That is the whole change.

This is deliberately not Chrome impersonation. Chromium's client-hint identity (sec-ch-ua* and navigator.userAgentData) stays browser-owned and internally consistent — the pre-#18749 code also injected synthetic "Google Chrome" brands into two headers, and that is not restored, because it made the header and JS surfaces disagree while buying nothing (see the measurement below).

Kept from #18749, all independent of the UA:

  • anti-detection.ts stays deleted — its premises were measured false on Electron 43 and its overrides are themselves published bot signatures
  • no Runtime.enable into cross-origin iframes
  • no unconditional CDP debugger attach on every browsing guest

Removes the need for #19740 (per-host Electron-token stripping for WhatsApp Web).

Measured tradeoff: this re-opens #13822, and there is no design that avoids it

Ablation on a standalone Electron 43.6.0 / Chromium 150 harness against dash.cloudflare.com/login, 5 reps per arm, fresh profile per run. Controls re-run after the matrix with no drift.

Arm Configuration Pass
A1 Stock Electron UA, no debugger (today's shipped behaviour) 5/5
A2 Stock UA + debugger attached 5/5
A3 Cleaned Chrome UA + the old two-header hint rewrite (pre-#18749) 0/5
A4 CDP Emulation.setUserAgentOverride + complete userAgentMetadata 0/5
A4b A4 + matching header hints — navigation, subresource, OOPIF and userAgentData all agree 0/5
A8 A4b claiming current Chrome 152 0/5
A7 Identical CDP mechanism, publishing Electron's own identity 5/5
A9/A10 Stock UA + Runtime.enable, including into the cross-origin iframe 5/5

Every arm claiming Google Chrome failed 25/25. Every arm publishing the Electron identity passed 25/25.

A7 is the isolating control: same override, same complete metadata, differing only in which identity it publishes. So the trigger is not the debugger attach, not the Emulation override, and not client-hint shape or coherence. A "coherent Chrome identity" fix was the obvious candidate and it is measured dead — three ways (A4, A4b, A8).

Scoping that claim precisely: this rig measured Turnstile outcomes only. It shows a Chrome-claiming
identity cannot clear Turnstile. It does not measure cookie acceptance — that the Electron identity
gets sessions revoked comes from user reports and documented UA-binding, not from this matrix. So
"irreconcilable" rests on measured-Turnstile plus reported-sessions, and this is a forced choice. Taking it knowingly: a Turnstile failure is bounded and confined to our browser; session revocation damages users' real accounts and demands SMS re-verification.

The permanent fix therefore has to scope the identity rather than find a better global disguise, and the
same rig measured why that is hard. Emulation.setUserAgentOverride is target-wide and forward-only:
it reaches only frames created after it is set, a pre-existing cross-origin iframe keeps the old identity
indefinitely, and a cross-host top-level navigation does not clear it. So switching identity on a live
page produces a split-identity page — top frame claiming Chrome while an embedded third-party frame still
says Electron — which is a sharper contradiction than either identity alone. Header-only scoping is arm A3,
which fails, and there is no per-partition or per-session seam either: CDP offers no partition-scoped
identity, and Electron's per-partition primitive (session.setUserAgent) sets only the UA string, which
is A3. The only seam that is both coherent and enforceable is per-WebContents, set before the first
navigation and immutable for that WebContents' lifetime
— identity decided at guest creation, not at
navigation time, with navigation off the host forced into a fresh WebContents carrying the default
identity. That is follow-up work, not this PR, and whether it rescues cookie acceptance at all is
unmeasured.

Incidentally, A9/A10 bear on #18749's premise that OOPIF Runtime.enable is the Cloudflare tell. With
Runtime.enable plus a Runtime.evaluate landed inside the challenge frame itself (verified by
reading location.href in the child session), the challenge still passed 3/3. That refutes the
necessity claim — removing it was not required for Turnstile to clear here — but not the weaker
claim that Cloudflare can observe it: detection is not the same as challenge failure, and it could
be weighted differently on higher-risk paths. That change is harmless and is left in place.

Tests

  • Real-Electron wire-identity test asserts the stripped identity on ordinary hosts and Firefox on Google auth hosts. Ablation-verified: neutering cleanElectronUserAgent turns it red on the Electron-token assertion.
  • Its fixture gained an app name — without one the raw UA carried no app token, so the Orca/x.y.z half of the cleaner was never exercised and the test passed while half-testing.
  • Full CI green.

Caveats, stated rather than buried

  • Scope of what reverting costs. It costs the embedded-widget class, measured: 25/25 pass on the Electron
    identity versus 0/25 on every Chrome-claiming configuration, on dash.cloudflare.com. For the full-page
    interstitial class, no configuration cleared it in this rig — including the shipped one, 0/44 across three
    sites — but that positive control did not reproduce, and the non-reproduction is unattributed (hidden
    never-focused window, fresh profile per run, or Cloudflare tightening since Sep 4 are all live). It should
    not be cited as evidence that the shipped build fails interstitials for users.
    Earning the stronger claim
    needs a visible focused window on an isolated display or CI, which the environment rules prohibit here.
    So the mechanism is well-supported for the embedded-widget class and unverified for the interstitial class.
  • No live LinkedIn/X run was performed. The session-revocation mechanism is inferred from user reports plus documented UA-binding behaviour, not measured here.
  • Not restoring the synthetic Chrome hints is a deviation from the exact v1.4.197 state. It is justified by reasoning and by A3's failure, not by a measurement that sites accept sessions without them.
  • There is no identity epoch, so sessions minted under the Electron UA since Sep 8 may see one further round of logouts on the way back.

Merge Sim added 2 commits September 10, 2026 13:42
#18749 replaced every browser partition's Chrome-shaped UA with Electron's stock
one, so since v1.4.198 the embedded browser announces itself on every non-Google
host as:

  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like
  Gecko) Orca/1.4.198 Chrome/150.0.7871.224 Electron/43.4.1 Safari/537.36

No browser sends that. Sites that re-check the identity holding a session reject
it: users report being signed out of x.com, LinkedIn and "most websites," and at
least one was signed out of LinkedIn in their own Chrome and met LinkedIn's
"suspicious activity" SMS check -- server-side revocation, which reaches beyond
our app. The repo already documented the mechanism in browser-google-auth-ua.ts:
copied-in cookies "sent under a UA that doesn't match a real first-party browser
get flagged by anti-fraud." That is why the Google auth-host switch exists;
#18749 kept it for accounts.google.com and handed every other host an Electron
identity.

Restore the pre-#18749 session identity: strip the Electron and app tokens, and
rewrite sec-ch-ua to match. Nothing in the cookie-import write path changed --
it never did; cookies were always written correctly and servers were refusing
them.

Deliberately KEPT from #18749, all independent of the UA:
- anti-detection.ts stays deleted. Its premises were measured false on Electron
  43 and its overrides are themselves published bot signatures.
- No Runtime.enable into cross-origin iframes (the documented Cloudflare CDP tell).
- No unconditional CDP debugger attach on every browsing guest.

Known tradeoff, measured: this re-opens #13822. On the unmerged predecessor
branch brennan/sta-3905-cloudflare-ua, commit 9f0a477 recorded the stock UA
clearing dash.cloudflare.com 5/5 while every rewritten variant failed 12/12, and
noted that adding client hints does not rescue it. So Cloudflare-gated sites will
show verification failures again until a coherent-identity fix lands. That is a
bounded, in-app annoyance; session revocation damages users' real accounts. A
CDP Emulation.setUserAgentOverride with full userAgentMetadata -- which drives
navigator.userAgentData as well as the headers, and was never tested -- is the
candidate that could satisfy both, and is being measured separately.

Tests: the real-Electron wire-identity test now asserts the stripped identity on
ordinary hosts and Firefox on Google auth hosts. Ablation-verified: neutering
cleanElectronUserAgent turns it red on the Electron-token assertion. Its fixture
also gained an app name -- without one the raw UA carried no app token, so the
Orca/x.y.z half of the cleaner was never exercised.
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 3bca9f9d-6e91-4303-ab27-6bafaccf9c8f

📥 Commits

Reviewing files that changed from the base of the PR and between 6523420 and af7a4ce.

📒 Files selected for processing (14)
  • docs/site/content/docs/browser/profiles.mdx
  • src/main/browser/browser-manager-auth-user-agent.test.ts
  • src/main/browser/browser-manager-navigation.ts
  • src/main/browser/browser-manager-viewport-override.test.ts
  • src/main/browser/browser-manager-viewport-test-fixtures.ts
  • src/main/browser/browser-session-partition-policies.test.ts
  • src/main/browser/browser-session-partition-policies.ts
  • src/main/browser/browser-session-partition-proxy-install.test.ts
  • src/main/browser/browser-session-registry.persistence.test.ts
  • src/main/browser/browser-session-registry.test.ts
  • src/main/browser/browser-session-ua-wire-identity.electron.test.ts
  • src/main/browser/browser-session-ua.ts
  • src/main/browser/browser-viewport-user-agent.ts
  • tests/tools/google-signin-ua-probe.cjs
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/site/content/docs/browser/profiles.mdx
  • src/main/browser/browser-viewport-user-agent.ts
  • src/main/browser/browser-manager-navigation.ts
  • src/main/browser/browser-manager-auth-user-agent.test.ts
  • src/main/browser/browser-manager-viewport-override.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces Chrome and Edge Client Hints synthesis with cleaned session user agents and a Google authentication user-agent override. Non-native sessions apply the cleaned identity, while native sessions bypass it. Tests now cover request headers, navigator identity, authentication-host behavior, navigation restoration, and session persistence. Fixtures, comments, the sign-in probe, and profile documentation describe the updated behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to af7a4

This PR restores the browser's Chrome-shaped user-agent identity for non-Google sites while keeping a scoped Firefox identity for Google authentication, reverting a prior regression that caused session rejections on sites like X and LinkedIn. The change is well-covered by tests across headers, navigator APIs, and navigation flows, and no unresolved code issues were found, so it appears safe to merge, with the known and disclosed caveat that some Cloudflare-protected sites may still reject the cleaned identity.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 14 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed problem, fix, testing, measurements, and caveats, but it does not follow the repository template. It omits the required section headings and information for ELI5, Lin… Restructure the description using the repository template. Add an ELI5 section, explicit What Changed and Why sections, a valid Linked Issue entry using Fixes #..., a Visual Proof section with before/after attachments or N/A and a reaso…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: restoring the Chrome-shaped browser identity. It is specific and includes the relevant issue identifier.
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 14 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description provides detailed problem, fix, testing, measurements, and caveats, but it does not follow the repository template. It omits the required section headings and information for ELI5, Linked Issue with a Fixes # reference, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist.

Resolution

Restructure the description using the repository template. Add an ELI5 section, explicit What Changed and Why sections, a valid Linked Issue entry using Fixes #..., a Visual Proof section with before/after attachments or N/A and a reason, Testing checkboxes and platform details, AI Disclosure if applicable, Review, the Agent skill upstream boundary checkbox, Notes covering the requested compatibility areas, and the Checklist with accurate checkbox states.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The rename to setupClientHintsOverride (plus the new cleanElectronUserAgent dependency) leaves browser-session-registry.persistence.test.ts unmigrated, so 7 of its tests fail and CI will be red. Details are anchored at browser-session-partition-policies.ts:96.

Reviewed changes

  • Chrome-shaped session identity — cleanElectronUserAgent strips the Electron/x.y.z and app-name tokens from the UA, and setupClientHintsOverride (renamed from setupGoogleAuthUserAgentOverride) now also rewrites sec-ch-ua / sec-ch-ua-full-version-list to a Chrome/Edge brand set while keeping the Google auth-host Firefox switch.
  • Partition wiring — installBrowserSessionPartitionPolicies and applyBrowserSessionUserAgentModes now set the laundered UA on the session and install the hints override, skipping userAgentMode: 'native' profiles.
  • Viewport/navigation plumbing — desktop viewport presets republish the cleaned base identity, and sendViewportUserAgentOverride launders guest.session.getUserAgent() so a preset can't re-publish the tokens.
  • Tests — a real-Electron wire-identity test (ablation-verified) plus unit tests for the hints rewrite and the cleaner; the fixture gained an app name so the app-token half of the cleaner is actually exercised.

ℹ️ Dead googleAuthOverride option

setupClientHintsOverride gained a googleAuthOverride option, but no production caller ever passes false — both call sites (browser-session-partition-policies.ts:98 and :198) invoke it with the default true. The two tests exercising googleAuthOverride: false describe an "imported-native profile" flow that production never reaches: applyBrowserSessionUserAgentModes skips native profiles entirely (continue), so nothing aligns their hints while suppressing the Firefox switch.

Technical details
# Dead googleAuthOverride option

## Affected sites
- src/main/browser/browser-session-ua.ts:33 — `options: { googleAuthOverride?: boolean } = {}`
- src/main/browser/browser-session-partition-policies.ts:98, :198 — both call `setupClientHintsOverride(sess, cleanUA)` without the option
- src/main/browser/browser-session-registry.test.ts:674-731 — tests for `googleAuthOverride: false`

## Required outcome
- Either wire the option into the imported/native-profile path (if hint-alignment-without-Firefox is intended for imported profiles), or drop the option and its two tests.

## Open questions for the human
- Is imported-native hint alignment (Chrome hints + imported UA + no Firefox switch) a goal? If so, which code path should pass `googleAuthOverride: false`?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

browser-session-registry.persistence.test.ts still asserted #18749's behaviour
("keeps the stock UA", "keeps the engine UA"), so the shipped code and its test
disagreed. Caught by CI shard 4/8, not locally: I reverted four test files and
went to typecheck without re-running the browser suite.

Also restores the accurate wording that #18749 generalised away, now that the
behaviour it described is back:
- browser-google-auth-ua.ts: names the Electron/Chrome-shaped UA again as what
  anti-fraud flags, which is the reason the auth-host switch exists at all.
- docs/browser/profiles.mdx: documents the cleaned Chrome UA default and the
  --no-ua-spoof escape hatch, which is real again.
- tests/tools/google-signin-ua-probe.cjs: comments name the live handler.

Deliberately left at #18749's version, because those changes stay correct with
anti-detection.ts deleted:
- browser-manager-viewport.ts: its comment no longer cites the retired
  addScriptToEvaluateOnNewDocument injection.
- browser-webauthn-profile-delete.test.ts: its added webRequest mock is REQUIRED
  by the restored setupClientHintsOverride, so reverting it would break the test.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d1b943cf-b7ed-4181-8c9f-f2ce77472df3

📥 Commits

Reviewing files that changed from the base of the PR and between 7456c44 and 6523420.

📒 Files selected for processing (4)
  • docs/site/content/docs/browser/profiles.mdx
  • src/main/browser/browser-google-auth-ua.ts
  • src/main/browser/browser-session-registry.persistence.test.ts
  • tests/tools/google-signin-ua-probe.cjs

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the migration leg is clean. One docs nit inline.

Reviewed changes

  • Migrated the stale test mock — browser-session-registry.persistence.test.ts now vi.doMocks ./browser-session-ua with cleanElectronUserAgent + setupClientHintsOverride and asserts the laundered engine UA, resolving the 7 failing tests from the prior review.
  • Expanded setupClientHintsOverride coverage — the browser-session-registry.test.ts describe block was rewritten with new Edge/Chrome brand-rewrite, non-Chrome-UA, cross-host Chrome-hints, and non-hint-header cases.
  • Switched the auth test fixtures to GUEST_CLEAN_UA — the expected wire identity in the auth/UA tests now reflects the cleaned Chrome shape.
  • Rewrote docs and comments — profiles.mdx and several source comments now describe the reverted Chrome-shaped behavior.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Removed the sec-ch-ua Chrome-brand rewrite — setupClientHintsOverride / buildChromeClientHints are gone; browser-session-ua.ts is back to cleanElectronUserAgent + setupGoogleAuthUserAgentOverride, leaving the client-hint identity (request headers and navigator.userAgentData) browser-owned. This closes the header-vs-JS brand disagreement the intermediate approach introduced and retires the dead googleAuthOverride option flagged in the prior review.
  • Expanded the real-Electron wire-identity test — it now serves a local HTTPS origin and asserts the wire sec-ch-ua / sec-ch-ua-full-version-list match navigator.userAgentData and carry no Electron/Orca brand, so the "browser-owned hints" premise is exercised rather than assumed.
  • Migrated remaining tests and comments — partition-policy, registry, persistence, viewport, and auth-UA tests plus profiles.mdx and google-signin-ua-probe.cjs now describe the browser-owned-hints behavior; the profiles.mdx wording that implied the cleaned UA improves Cloudflare compatibility is corrected.

ℹ️ Nitpicks

  • The PR body's "Fix" section still says "rewrite sec-ch-ua to match", but the final commit leaves client hints browser-owned — a sentence that now contradicts both the code and the "byte-identical to its pre-#18749 original" claim. Worth a one-line body update before merge.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron visual proof — af7a4ce9b0

Ordinary-host HTTPS identity shown inside the real Orca embedded browser, with server-observed and JavaScript User-Agent plus browser-owned client-hint surfaces.

ordinary-host-identity.png

Public Cloudflare Turnstile dummy-login demo rendered inside the same Orca app instance. This public test-key surface is useful rendering evidence, not proof that every production Turnstile deployment will clear.

turnstile-demo.png

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review-until-clean status

Verdict: land — PASS with documented residual risk.

Reviewed and fixed through three same-model review/fix rounds. Final head: af7a4ce9b0.

Judgments

  • Functional correctness: session-level cleanup removes the impossible Orca/… Electron/… identity that caused imported-session rejection. Ordinary request UA, navigator.userAgent, wire client hints, and navigator.userAgentData are covered in real Electron; Google auth retains its scoped Firefox identity with client hints removed.
  • Architecture: the simple UA policy stays owned by the Electron session. The old partial Google Chrome hint synthesis was removed because it disagreed with the browser-owned JS surface. No persistent debugger ownership, anti-detection injection, or unrelated CDP lifecycle was added.
  • Precedent: the implementation follows the established session-boundary ownership pattern for a stable simple UA. Rich CDP metadata/reapply is a materially different lifecycle and is intentionally not introduced here.
  • Performance/resources: clean. Ordinary requests now do less header work; there are no new timers, polling loops, debugger attachments, subprocesses, unbounded collections, or render churn.
  • Scope: focused on the identity regression plus the tests/docs needed to prove it. The known upload-transfer perf assertion was pre-existing, load-sensitive, and untouched.

Validation

  • 130 focused unit tests passed during the review loop.
  • Real-Electron wire identity test passed with ORCA_BACKGROUND_LAUNCH=1.
  • pnpm tc, changed-code quality (0 findings), and git diff --check passed.
  • GitHub CI: all 8 Node shards, typecheck, static analysis, verify, docs, macOS packaging, and Windows packaging passed.
  • Hidden Electron/CDP validation on the pushed commit:

Remaining gaps / risks

  • The public Turnstile test-key flow succeeded, but production Cloudflare variants remain site-specific; native-UA profiles are the documented workaround.
  • Real LinkedIn/X sessions and real-account Google auth were not exercised.
  • Sessions created under the Electron identity since v1.4.198 may see one final identity transition/logout.

No release-blocking P0/P1 issue remains.

@brennanb2025
brennanb2025 merged commit fb85f88 into main Sep 10, 2026
31 checks passed
kukapu pushed a commit to kukapu/orca that referenced this pull request Sep 11, 2026
…tablyai#19927)

* fix(browser): restore the Chrome-shaped browser identity (STA-7147)

stablyai#18749 replaced every browser partition's Chrome-shaped UA with Electron's stock
one, so since v1.4.198 the embedded browser announces itself on every non-Google
host as:

  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like
  Gecko) Orca/1.4.198 Chrome/150.0.7871.224 Electron/43.4.1 Safari/537.36

No browser sends that. Sites that re-check the identity holding a session reject
it: users report being signed out of x.com, LinkedIn and "most websites," and at
least one was signed out of LinkedIn in their own Chrome and met LinkedIn's
"suspicious activity" SMS check -- server-side revocation, which reaches beyond
our app. The repo already documented the mechanism in browser-google-auth-ua.ts:
copied-in cookies "sent under a UA that doesn't match a real first-party browser
get flagged by anti-fraud." That is why the Google auth-host switch exists;
stablyai#18749 kept it for accounts.google.com and handed every other host an Electron
identity.

Restore the pre-stablyai#18749 session identity: strip the Electron and app tokens, and
rewrite sec-ch-ua to match. Nothing in the cookie-import write path changed --
it never did; cookies were always written correctly and servers were refusing
them.

Deliberately KEPT from stablyai#18749, all independent of the UA:
- anti-detection.ts stays deleted. Its premises were measured false on Electron
  43 and its overrides are themselves published bot signatures.
- No Runtime.enable into cross-origin iframes (the documented Cloudflare CDP tell).
- No unconditional CDP debugger attach on every browsing guest.

Known tradeoff, measured: this re-opens stablyai#13822. On the unmerged predecessor
branch brennan/sta-3905-cloudflare-ua, commit 9f0a477 recorded the stock UA
clearing dash.cloudflare.com 5/5 while every rewritten variant failed 12/12, and
noted that adding client hints does not rescue it. So Cloudflare-gated sites will
show verification failures again until a coherent-identity fix lands. That is a
bounded, in-app annoyance; session revocation damages users' real accounts. A
CDP Emulation.setUserAgentOverride with full userAgentMetadata -- which drives
navigator.userAgentData as well as the headers, and was never tested -- is the
candidate that could satisfy both, and is being measured separately.

Tests: the real-Electron wire-identity test now asserts the stripped identity on
ordinary hosts and Firefox on Google auth hosts. Ablation-verified: neutering
cleanElectronUserAgent turns it red on the Electron-token assertion. Its fixture
also gained an app name -- without one the raw UA carried no app token, so the
Orca/x.y.z half of the cleaner was never exercised.

* fix(browser): finish the identity revert in the files CI caught

browser-session-registry.persistence.test.ts still asserted stablyai#18749's behaviour
("keeps the stock UA", "keeps the engine UA"), so the shipped code and its test
disagreed. Caught by CI shard 4/8, not locally: I reverted four test files and
went to typecheck without re-running the browser suite.

Also restores the accurate wording that stablyai#18749 generalised away, now that the
behaviour it described is back:
- browser-google-auth-ua.ts: names the Electron/Chrome-shaped UA again as what
  anti-fraud flags, which is the reason the auth-host switch exists at all.
- docs/browser/profiles.mdx: documents the cleaned Chrome UA default and the
  --no-ua-spoof escape hatch, which is real again.
- tests/tools/google-signin-ua-probe.cjs: comments name the live handler.

Deliberately left at stablyai#18749's version, because those changes stay correct with
anti-detection.ts deleted:
- browser-manager-viewport.ts: its comment no longer cites the retired
  addScriptToEvaluateOnNewDocument injection.
- browser-webauthn-profile-delete.test.ts: its added webRequest mock is REQUIRED
  by the restored setupClientHintsOverride, so reverting it would break the test.

* fix(browser): keep restored UA hints browser-owned

---------

Co-authored-by: Merge Sim <sim@local>
(cherry picked from commit fb85f88)
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