You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security/unauthenticated-api and json-sensitive-fields miss an open JSON endpoint called from an inline script #1920
bugSomething isn't workingrelease-blockerMust be resolved before the next CLI releaserulespackages/rules — audit rule definitionssecuritySecurity hardening
Found in a true-positive smoke test on our own test site, which ran a CLI build from main with --aggressive --offline (40 pages).
The page /about contains an inline <script> with fetch("/api/users") and fetch("/api/account"). GET /api/users returned a 200 JSON list with fake email addresses, and GET /api/account returned a 200 JSON object with a password field. Both endpoints were same-origin, unauthenticated and live during the run. Both rules finished as passed (passedRules, pages 0) with no finding. In the same run security/exposed-files did detect the planted /.env, so probing was active and the site was reachable.
A likely cause, unconfirmed: the inline-script fetch call sites never become ctx.endpointSurface candidates on a plain (non-rendered) crawl. packages/rules/src/endpoint-surface.ts collects inline scripts "from a live page DOM".
Acceptance Criteria
A fixture page with an inline <script> calling fetch("/api/users") produces a same-origin, probe-eligible endpoint candidate on a plain crawl, not only a rendered one.
With that fixture serving an unauthenticated JSON list of user records, security/unauthenticated-api reports the endpoint (no field values in the finding).
With a fixture JSON response containing a password field, security/json-sensitive-fields reports the field name and count, never the value.
A test runs both rules end to end through the engine (crawl, then endpoint surface, then probe) rather than with a hand-built candidate list.
This blocks the next CLI release that ships these rules.
When security/unauthenticated-api or security/json-sensitive-fields finds zero candidate endpoints, the rule reports not_checked with a reason (for example "no API endpoints found in page code"), never passed. A pass with 0 pages is a false all-clear on a security rule. Test: a page with no fetch call sites gives not_checked, not passed.
Root cause, found after the lane couldn't reproduce locally: it reproduces only behind Cloudflare. In security/unauthenticated-api (classify ~line 801), any non-2xx status, including 429, 403 or a bot challenge, and any HTML response, which is what challenge pages are, is classified no-records, so the endpoint counts as not exposed and the rule passes. json-sensitive-fields similarly skips any non-success or non-JSON response. During the smoke our zone rate-limited the probe burst (security/exposed-files reported a 429 after 8 of 20 paths), so the API probes most likely got 429s or challenges and the rules gave a false pass. exposed-files already handles this correctly as not checked. Local runs have no rate limiter, so they detect.
bugSomething isn't workingrelease-blockerMust be resolved before the next CLI releaserulespackages/rules — audit rule definitionssecuritySecurity hardening
Activity
nc9 commentedon Nov 15, 2026
Root cause, found after the lane couldn't reproduce locally: it reproduces only behind Cloudflare. In
security/unauthenticated-api(classify~line 801), any non-2xx status, including 429, 403 or a bot challenge, and any HTML response, which is what challenge pages are, is classifiedno-records, so the endpoint counts as not exposed and the rule passes.json-sensitive-fieldssimilarly skips any non-success or non-JSON response. During the smoke our zone rate-limited the probe burst (security/exposed-filesreported a 429 after 8 of 20 paths), so the API probes most likely got 429s or challenges and the rules gave a false pass.exposed-filesalready handles this correctly as not checked. Local runs have no rate limiter, so they detect.test(engine): an open API called only from an inline script is probed…
fix(rules): a 401 or app 403 is protected; a challenge, WAF 403, 429 …
test(engine): an open API called only from an inline script is probed…
fix(rules): a 401 or app 403 is protected; a challenge, WAF 403, 429 …
test(engine): an open API called only from an inline script is probed…
fix(rules): a 401 or app 403 is protected; a challenge, WAF 403, 429 …