Repository navigation
fix(browse): stop faking chrome.runtime.connect/sendMessage in Layer C stealth - #2781
Closed
AyushRajgor wants to merge 1 commit into
Closed
AyushRajgor wants to merge 1 commit into
AyushRajgor wants to merge 1 commit into
Conversation
…C stealth Real Chrome exposes callable chrome.runtime.connect / sendMessage to a web page only when an installed extension lists that origin in externally_connectable. On an ordinary page they are undefined. Layer C injected stubs that throw "No matching signature" for any call, a shape real Chrome never produces. Sites that probe chrome.runtime.sendMessage to detect their own companion extension concluded it was installed and routed auth through the extension flow, which fails and loops back to login. Keep the enum shape (OnInstalledReason, PlatformOs, ...) that presence checks look at; drop only the two callable stubs. Update the Layer C static tests and the Chromium runtime test accordingly.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
An error occurred while submitting your PR to the queue: |
Contributor
|
Thanks for this, @AyushRajgor. The fix is now on main: the stealth chrome.runtime stub no longer fakes connect/sendMessage (browse/src/stealth.ts) (fixed in v1.91.2.0, #2959). Closing as superseded; if you still see the problem on the latest gstack, please open an issue with ./setup --status output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why (in your own words)
Layer C stealth injects a fake
window.chrome.runtimethat includes callableconnectandsendMessagestubs which throwNo matching signaturefor any input. Real Chrome never shows that to an ordinary web page:chrome.runtimeis either undefined, or (only when an installed extension lists the origin inexternally_connectable) carries real, working methods. Web apps that ship a companion Chrome extension probechrome.runtime.sendMessageto detect it. In GStack Browser the probe finds a function, the app assumes its extension is installed, routes auth through the extension flow, that flow 403s, and the user is bounced back to the login page in a loop. The same site logs in fine in stock Chrome, Edge, and incognito. There is no opt-out because Layer C is always-on.This PR drops the two callable stubs and keeps the enum shape (
OnInstalledReason,PlatformOs, ...) that the Cloudflare/DataDome presence checks actually look at. That is the shape real Chrome shows a page with no connectable extension, so it is also the more consistent fingerprint (the v1.28 / #1363 principle: inconsistent fakes make detection easier, not harder).Fixes #2780
Live evidence
Before (v1.79.0.0 unpatched, headed
browse connect, on the affected site's login page):.gstack/browse-console.logduring the login attempt:.gstack/browse-network.log(site redacted): login POST 200 → tenant/login/callback→ app POSTs/logout→ redirect to/logout?org=...&client_id=<extension-id>&client_name=extension→ 403 → back on the login page.After (this branch, rebuilt with
./setup, headedbrowse connect):Logging into the same site in the patched GStack Browser now succeeds on the first try and the session persists in the profile.
Static tests:
Scope
browse/src/stealth.ts(removeconnect/sendMessagefrom the injectedchrome.runtime; enum shape,id,chrome.app,csi,loadTimesuntouched),browse/test/stealth-layer-c.test.ts(new test asserting the two methods are absent; markNative floor 7 → 6),browse/test/stealth-webdriver.test.ts(runtime test now assertstypeof runtime.connect/sendMessage === 'undefined'instead of expecting a throw)../setup,browse connect(headed, Windows 11, bundled Chromium 151), thebrowse jsprobe above, and a real login on the affected site that previously looped.stealth-webdriver.test.tscould not run on this machine. Playwright'schromium.launch()forchrome-headless-shellhangs underbun testhere (120 s launch timeout before any test body runs). This matches the reasonscripts/test-free-shards.tsexcludes browser-launching tests from the Windows shard. The updated assertions mirror the livebrowse jsresult above; CI's macOS/Linux runners should exercise them. Not re-checked against bot.sannysoft.com / Cloudflare-fronted sites after the change; the enum shape they check is unchanged.Liveness proof (required)
(maintainer note: the PR author will attach the
GSTACK PRscreenshot in a comment.)Checklist
GSTACK PRtyped live into a real surface (not edited onto the image)