fix(captcha): detect active challenge frames - #2615
Open
alectimison-maker wants to merge 1 commit into
Open
Conversation
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.