fix(captcha): consume response token state - #2637
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Consumes correlated CAPTCHA response-token state while preserving fail-closed challenge handling across Chrome and Firefox.
Changes:
- Persists exact widget identity and token-cleared recheck markers.
- Clears gates only when the correlated token exists without an active frame.
- Adds multi-widget, restart, hCaptcha, and rejection regression coverage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/chrome/src/agent/agent.js |
Adds token-driven gate transitions for Chrome. |
src/firefox/src/agent/agent.js |
Mirrors token-driven transitions for Firefox. |
test/run.js |
Adds token correlation and persistence tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Aug 9, 2026
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
responseTokenPresentstate after a solveMotivation
#505 identified that the gate inferred solve state from dialog wording and disappearance even after #512 made the widget response-token state available. #2615 added language-neutral active-frame signals, but the gate still did not consume the token boolean.
This change connects those two primitives without treating a widget token as proof that the site's server accepted it.
Safety and behavior
The token is reduced to a boolean by the existing detector; no raw token is retained or serialized. Token-backed clearance requires the original frame, frame path, type, site key, and exact response-field id or index to match. A sibling widget's token cannot clear the gate.
A visible active challenge frame always wins over token presence. After clearance, every mutation still runs the read-only preflight. If the server rejects the token and re-renders the challenge, the gate is restored before the mutation dispatches.
Testing
node test/run.js— 1,396 passed; 1 inherited failure becausepackage.jsonis26.0.3while the newestCHANGELOG.mdentry is26.0.0npm run test:security— 60/60 passednpm run test:fixtures— 125/125 passednpm run test:ci— passednode --checkfor both agent builds andtest/run.js— passedgit diff --check— passedRegression coverage includes exact multi-widget correlation, hCaptcha's compatibility response field, visible-frame fail-closed behavior, token clearance, worker restart persistence, stale dialog text, and challenge re-arming.
Scope
This PR does not remove the legacy verification retry/read ladder, consolidate English regexes, or add full-page Cloudflare interstitial detection. Those remain separate unchecked items in #505.
Advances #505.