fix(scrape): scan full html for CF challenge markers, not an 80KB prefix#216
Merged
Conversation
The prior CF Turnstile fix scanned only the first 80KB, but on the real barcodelookup.com page the challenge markers sit near the END of the body (/cdn-cgi/challenge-platform/ @113706, _cf_chl_opt @115139 of a 118KB page) — so the interstitial still leaked as success:true in prod. The earlier unit test masked this by placing the marker in <head>. Scan the full html with a case-sensitive substring match (fixed-case CF tokens, no lowercase allocation needed), and fix the regression test to place the marker past 80KB. Verified against the captured live response body. Fixes #350
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.
Follow-up to #214. Live re-test showed barcodelookup.com STILL leaked the challenge as
success:true.Root cause of the miss: #214 scanned only the first 80KB, but on the real page the challenge markers sit near the end of the body —
/cdn-cgi/challenge-platform/@ byte 113706,_cf_chl_opt@ 115139 of a 118KB page. The #214 unit test masked this by placing the marker in<head>.Fix: scan the full html with a case-sensitive substring match (these are fixed-case CF tokens, so no lowercased-copy allocation per scrape), and fix the regression test to place the marker past 80KB. Verified against the captured live response body (
_cf_chl_opt/challenge-platformboth match case-sensitively). crw-crawl suite green; pre-commit passed.Will re-verify on live barcodelookup.com after deploy.