Repository navigation
fix(cli): stop verification false positives on website-backed CLIs - #5256
Conversation
Anti-bot names and captcha words inside JS/CSS no longer outvote a clean document or XHR, and captcha words in an asset no longer force browser_required. A first-party challenge script and a real document or XHR challenge still do. Novel-host checks accept a registrable apex when one of its subdomains was observed, and ignore schema.org only when it is a string affix rather than a request. verify-skill follows nested flag helpers, bounded by a depth and cycle guard. Closes #4907 Co-authored-by: Trevin Chow <tmchow@users.noreply.github.com>
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 require-ready-label-and-ci
🟢 🚦 Auto-queueWhen all merge protections are satisfied and these conditions match, this pull request will be queued automatically.
|
[Medium impact] The PR appears safe to merge; the inherited-constant finding is fixed and no new blocking issue was found. SummaryThis PR reduces false positives in checks for website-backed CLIs.
The latest update fixes inherited constant expressions at package and local scope. The numbered previous finding is fully addressed. No new actionable issues or rule violations were found. Reviews (3) · Last reviewed commit: "fix(cli): walk inherited const expressio..." · Reviewed by Greptile |
Asset suppression now drops body markers only. Vendor headers and explicit denial or login responses on static assets still count. schema.org affix exemptions require every package use to be an affix, including other files, local const and var, and aliases. A fetch keeps the host checked. Co-authored-by: Trevin Chow <tmchow@users.noreply.github.com>
A const spec that omits its expression list repeats the previous list. Skipping that spec left a fetch of the inherited name off the alias chain, so a vocabulary URL could be exempted while still being fetched. Co-authored-by: Trevin Chow <tmchow@users.noreply.github.com>
|
Mergify will not queue this PR yet. The label signals intent to queue; Mergify's |
Merge Queue Status
This pull request spent 21 minutes 30 seconds in the queue, including 21 minutes 11 seconds running CI. Required conditions to merge
|
Intent
Three press verification checks flagged correct code while printing a website-backed CLI. All three defects were still present on current
main(no existing regression test pinned a fix). This change fixes all three.Closes #4907
Approach
Traffic analysis. Vendor names and captcha words inside JS/CSS no longer outvote a clean document or XHR, and captcha words in an asset never set
browser_requiredon their own. That suppression applies to body markers only. Header challenges (cf-mitigated, Vercel), vendor headers (X-DataDome,CF-RAY,X-Akamai-Transformed), and explicit 403/429 denial or login redirects still count on a static asset. A document or XHR that is itself a challenge still setsbrowser_required, including an HTML challenge whose URL ends in.js. A first-party AWS WAF challenge script still setsbrowser_clearance_httpbeside a clean API response; that existing case was left in place.Novel-feature hosts. A declared registrable apex passes when research artifacts observed one of its subdomains (
www.subito.itcoverssubito.it). Lookalikes do not:evilsubito.it,subito.it.evil.com, and an unobserved sibling such asshop.subito.itstill fail.schema.org/www.schema.orgare ignored only when every use of that name in the package is a string affix (TrimPrefix,HasPrefix, and the same family), or the name only initializes another exempt name. That includes a package-level const used from another file, localconstandvar, a const group that copies the previous expression, and an alias chain. A const spec that omits its expression list is walked as that previous list, at package level and inside a function, soconst (base = "https://schema.org/"; trim = base; fetch)still fails whenfetchis passed tohttp.Get. Fetching that host still fails, including through an alias, a helper in another file, or a use that still refers to the package constant before a local shadow.verify-skill. Flag lookup walks helpers that receive
cmd, nested up to 8 levels, and stops on cycles. A flag that is absent, or that lives past the depth guard, still errors.Scope
Primary area: browsersniff traffic analysis, dogfood novel-host check, verify-skill flag resolution.
Why this belongs in this repo: the false positives come from the Printing Press checks, not from one printed CLI. The same shapes show up on any website-backed print.
Risk
A first-party challenge script body (
awswaf/aws-waf) is still evidence even when a clean document exists, matching the existing hostless-target test. Vendor-name substrings in a static asset with no clean document or XHR still classify asbrowser_http; they do not setbrowser_required. A real vendor header or denial/login response on an asset now keeps that observation even beside a clean document.No generator templates, manifests, or MCP schemas changed. Golden fixtures are unchanged.
Output Contract
N/A
Verification
go test -count=1 -timeout 45m ./...passed for every package exceptinternal/generator, which was still running when the 45m package timeout fired.go test -count=1 -timeout 90m ./internal/generator/then passed.GOTOOLCHAIN=go1.26.10 bash scripts/golden.sh verifypassed (fixtures request go 1.24, which this environment cannot download; the local 1.26.10 toolchain builds them)GOOS=linux,GOOS=darwin, andGOOS=windowsgo vetofinternal/browsersniff,internal/pipeline, andinternal/clipassedgolangci-lint run(v2.11.4) on those three packages: 0 issues327329e0):go test -count=1 -timeout 600s ./internal/pipeline/,go vet ./internal/pipeline/, andgolangci-lint run ./internal/pipeline/(v2.11.4) passed. No generator or golden fixture changes.Self-review gate
Ran before pushing this update.
schema.orgstill fails, including a local const/var, a const copied across files, an alias chain, an inherited const name after an alias (package-level and function-local), and a fetch that occurs before a local shadow; a missing flag, a cyclic helper chain, and a helper past the depth guard still error.evilsubito.it,subito.it.evil.com,shop.subito.it,notschema.org,evil.schema.org,schema.org.evil.com, alias-then-fetch, grouped-const copy then fetch, inherited const alias then fetch, and a parameter that shadows the package const (the fetch host is the argument, notschema.org).AI / Automation Disclosure