fix(captcha): detect active challenge frames - #2615
Merged
esokullu merged 2 commits intoJul 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds language-neutral detection of active CAPTCHA challenge frames across Chrome and Firefox.
Changes:
- Classifies visible reCAPTCHA, hCaptcha, and Arkose challenge routes.
- Uses active-frame signals for gate routing and diagnostics.
- Adds regression and parity coverage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
test/run.js |
Adds challenge-frame regression tests. |
src/chrome/src/agent/captcha-gate.js |
Detects and reports active vendor frames. |
src/firefox/src/agent/captcha-gate.js |
Mirrors Chrome gate detection. |
src/chrome/src/agent/captcha-frame-runtime.js |
Classifies and ranks active frames. |
src/firefox/src/agent/captcha-frame-runtime.js |
Mirrors Chrome frame runtime. |
src/chrome/src/agent/agent.js |
Arms and routes the CAPTCHA gate. |
src/firefox/src/agent/agent.js |
Mirrors Chrome gate routing. |
Comments suppressed due to low confidence (2)
src/firefox/src/agent/agent.js:2851
- The active-frame correlation branch does not require the selected candidate to be visible. If an English challenge dialog coexists with a hidden bframe outside that dialog, the hidden candidate now counts as correlated and routes to
solve_required; previously that unrelated candidate failed closed. Requireselected.visible === truefor the active-frame branch.
const selectedCorrelated = (
detection?.selected?.dialogAssociated === true
|| detection?.selected?.activeChallengeFrame === true
) && detection?.selected?.frameVisible !== false;
src/chrome/src/agent/agent.js:3226
- The active-frame correlation branch does not require the selected candidate to be visible. If an English challenge dialog coexists with a hidden bframe outside that dialog, the hidden candidate now counts as correlated and routes to
solve_required; previously that unrelated candidate failed closed. Requireselected.visible === truefor the active-frame branch.
const selectedCorrelated = (
detection?.selected?.dialogAssociated === true
|| detection?.selected?.activeChallengeFrame === true
) && detection?.selected?.frameVisible !== false;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@esokullu is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Motivation
The gate currently starts from English phrases such as "Security verification".
Localized challenge dialogs therefore remain unguarded even when the page exposes
a language-neutral vendor challenge frame. This advances #505 after the response
token-state work from #512.
Design
The detector now records a separate
activeChallengeFramesignal for exactvendor routes:
/recaptcha/{api2,enterprise}/bframe#frame=challenge/fc/gc/That signal is deliberately narrower than the existing generic
challengeFrameheuristic. Visible reCAPTCHA anchors, hCaptcha checkboxframes, hidden frames, generic application CAPTCHA paths, and spoofed vendor
hostnames cannot arm it.
For an accessibility-tree result, local CAPTCHA detection runs early only when
the tree already exposes a dialog surface. Before the first mutation, the
existing read-only page preflight also recognizes a visible active challenge
frame. Supported visible frames route to
solve_required; Arkose andsolver-disabled cases continue to fail closed as
manual_required.Testing
node test/run.js— 1354 passed; 1 inherited failure becausepackage.jsonis26.0.1while the newestCHANGELOG.mdentry is26.0.0node test/security/injection-corpus.mjs— 60/60 passednode --checkfor bothagent.js,captcha-gate.js, andcaptcha-frame-runtime.jscopies — passedpassed
git diff --check— passedCompatibility and risks
No public API, permission, network, or storage behavior changes. The remaining
risk is vendor URL drift; exact route matching intentionally prefers a missed
new route over a false-positive gate.
Scope
This PR does not add localized phrase tables, rewrite verification-state
cleanup, or detect full-page Cloudflare interstitials. Those remain separate
steps in #505.
Advances #505.