Skip to content

fix(rules): a 401 or app 403 is protected; a challenge, WAF 403, 429 or 5xx is never a clean pass (#1920) - #1921

Merged
nc9 merged 2 commits into
mainfrom
boat/inline-fetch-endpoints-1920
Nov 15, 2026
Merged

nc9 merged 2 commits into
mainfrom
boat/inline-fetch-endpoints-1920

Conversation

@nc9

@nc9 nc9 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1920 (round 3).

Summary

  • Protected vs unverified. One classifier in packages/rules/src/security/probe-http.ts is shared by security/exposed-files, security/unauthenticated-api and security/json-sensitive-fields. A 401, or a 403 the app sent itself (JSON or plain, with no WAF marker), means the endpoint is protected and counts as a pass. A 429, a challenge page, a 403 carrying WAF markers, a 5xx, or a timeout or network error leaves the endpoint unverified.
  • One shared WAF marker list. WAF_CHALLENGE_MARKERS in @squirrelscan/utils/waf-markers has the same entries as the private link checker's WAF_403_MARKERS: cloudflare, akamai, datadome, perimeterx, imperva, sucuri and aws-waf. Markers are only read on a 403, because several of them appear on every answer from a protected site.
  • Partial runs. When some endpoints are verified and others are not, the findings for the verified ones are reported, plus a not-checked note that says how many were not verified (for example "1 of 2"). Such a run is never a clean pass.
  • Kept from round 2. Zero candidates is not checked. A 429 is not checked. A real 404 counts as not exposed. The engine e2e guard stays.
  • Docs. Updated the rule pages for all three rules.

Tests

  • packages/rules/tests/probe-unverified-1920.test.ts: 33 pass. Covers the marker list, the classifier, and these cases for both API rules: 403 JSON passes, 401 passes, 404 passes, 403 Cloudflare challenge is not checked, 429, 5xx, zero candidates, partial with a 5xx, and partial with a challenge.
  • exposed-files.test.ts: new cases for a 403 JSON pass, a WAF-marked 403 that is not checked, and a partial hit plus 5xx paths.
  • Mutation checks: turning off the 403 marker check fails 2 tests. Turning off the partial note in json-sensitive-fields fails 2. Turning off exposed-files 5xx handling fails 1.

Gates

  • rules: exposed-files, unauthenticated-api, json-sensitive-fields-1956 and probe-unverified-1920: 87 pass, 0 fail.
  • audit-engine: inline-fetch-endpoints-1920-e2e, golden-baseline and streaming-rules-canonical-golden: 11 pass. golden-finding-messages-229, streaming-rules-golden, report-stream-v2-golden and rule-cache-replay-golden: 23 pass.
  • bun run typecheck passes in rules (src and tests), audit-engine and utils.
  • scripts/test-suites.ts --check passes, and make validate in docs passes.

Agent skill: no change needed.

@nc9
nc9 force-pushed the boat/inline-fetch-endpoints-1920 branch from fdcf944 to 396dd2f Compare November 15, 2026 09:04
@nc9 nc9 changed the title test(engine): an open API called only from an inline script is probed end to end (#1920) fix(rules): a 401 or app 403 is protected; a challenge, WAF 403, 429 or 5xx is never a clean pass (#1920) Nov 15, 2026
@nc9
nc9 marked this pull request as ready for review November 15, 2026 09:10
nc9 added 2 commits November 15, 2026 23:16
… end to end (#1920)

Crawls a local fixture with a plain HTTP crawl, builds the endpoint surface
and runs security/unauthenticated-api and security/json-sensitive-fields at
aggressive through both engine paths. /about calls /api/users and
/api/account from an inline script only, matching the nut-shop probe faults.

Asserts the call sites become same-origin, probe-eligible static-html
candidates, both rules flag the endpoints, json-sensitive-fields names
$.password and counts PII without values, and no response value appears
in any finding, detail or log.

The false negative from the smoke run does not reproduce on main: the
source CLI and a compiled binary both report the endpoints against the real
nut-shop app (dev server and production build) with --aggressive --offline
--max-pages 40.

Refs #1920

Signed-off-by: Nik Cubrilovic <[email protected]>
…or 5xx is never a clean pass (#1920)

The probing rules (exposed-files, unauthenticated-api, json-sensitive-fields)
share one classifier in probe-http and one WAF marker list,
WAF_CHALLENGE_MARKERS in @squirrelscan/utils/waf-markers (mirrors the cloud
link checker's WAF_403_MARKERS). A 401, or a 403 the app sent itself with no
WAF marker, is a real answer: the endpoint is protected. A 429, a challenge
page, a 403 carrying WAF markers, a 5xx, or a timeout leaves the endpoint
unverified. Zero candidates is not checked. A partial run reports the
findings for the verified endpoints plus a not-checked note naming how many
were not verified, never a clean pass. Docs updated.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the boat/inline-fetch-endpoints-1920 branch from 396dd2f to 3eca40d Compare November 15, 2026 12:16
@nc9
nc9 merged commit 6a6bb3a into main Nov 15, 2026
16 checks passed
@nc9
nc9 deleted the boat/inline-fetch-endpoints-1920 branch November 15, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security/unauthenticated-api and json-sensitive-fields miss an open JSON endpoint called from an inline script

1 participant