Skip to content

feat(rules): flag auth and session endpoints that leak password hashes or the user record (repo#1968) - #1885

Merged
nc9 merged 2 commits into
mainfrom
boat/auth-endpoint-overdisclosure-1968
Nov 16, 2026
Merged

nc9 merged 2 commits into
mainfrom
boat/auth-endpoint-overdisclosure-1968

Conversation

@nc9

@nc9 nc9 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Summary

New site-scoped probing rule security/auth-endpoint-disclosure for squirrelscan/repo#1968 (part of the API and data exposure epic, repo#1952). Implements repo#1968 (private tracker; no auto-close across repos).

  • What is probed: same-origin current-user and session endpoints. These are the ones the endpoint discovery pass found (last segment me, session, user, whoami, userinfo, current-user, self, profile, account, under an API or auth segment unless a call site named it) plus /api/me, /api/session, /api/auth/session and /api/user. At most six.

  • What is sent: one GET per endpoint, with no query string, no body, no cookies (credentials: "omit"), no Authorization header and no redirect following. At most 256 KB of the decoded body is read (shared readCapped in probe-http.ts). Credentials are never submitted.

  • Never probed: other origins (the origin is re-checked; probeEligible and sameOrigin are not trusted), state-changing paths (graphql-probe's list), credential-flow paths (login, signup, register, password, token, verify, callback, authorize, ...), call sites that declare any method other than GET or HEAD, and robots-disallowed paths below aggressive.

  • Flagged (fail, error severity, weight 8): a 2xx JSON answer that contains any of:

    • a password hash, recognised by format under any key: bcrypt, argon2, scrypt, sha-crypt, md5-crypt, Django, Werkzeug;
    • a plaintext password, by key;
    • a credential secret: reset, confirmation, remember or refresh tokens, OTP or MFA secrets, recovery codes, signing keys;
    • two or more internal user-table columns on one object: Devise, Laravel or Supabase sign-in counters and IPs, lockout state, salt.

    There is one check per endpoint. Items name the JSON path and kind, never the value.

  • Gating (repo#1931): the rule runs only through ctx.probe, quiet tier, so active or above. A passive run, a cloud audit of an unverified website, and --disable-discovery-probes all resolve to passive: nothing is sent and one skipped check is recorded. A run cut short by the budget, or one where every probe errored, is reported as skipped, never as a pass.

  • Checks declared (feat(rules): a rule's passing and failing checks are linked, so a consumer can tell when a reported finding has been fixed #1741):

    • auth-endpoint-disclosure (problem);
    • auth-endpoint-clean (clean, clears the problem check);
    • auth-endpoint-not-checked (skipped).

Rebased onto security/unauthenticated-api (repo#1955). That rule already skips session and auth paths, but a discovered /api/me or /api/user can be probed by both rules, and each reports from its own angle.

Acceptance criteria

  • Scans reachable auth/session endpoints (/api/me, /api/session, etc.) for over-disclosure. Evidence: auth-endpoint-disclosure.test.ts:
    • "active: one credential-free GET per conventional path";
    • "a serialized Devise row is a fail naming each field";
    • "a hash is found by its format under any key";
    • "only same-origin, GET-able, non-credential auth endpoints are probed".
  • Password hash / internal row / secrets in the response = high severity. meta.severity: "error", status fail. Tested by "a serialized Devise row is a fail..." (asserts severity, the kinds password-hash, secret and internal-record, and that no value leaks into the checks), and by "normal session answers pass" for the false-positive shapes.
  • No credentials are submitted; GET/no-auth probes only. The "active: one credential-free GET" test asserts, on every request: method: "GET", a null body, an empty query, credentials: "omit", redirect: "manual", and no cookie or authorization header. POST/PUT call sites and credential paths are not probed (selection test).
  • Runs only per fix(rules): content/reading-level skips code blocks (repo#1639) #1931; same-origin only. Tested by:
    • "passive or no probe budget: skipped, nothing sent";
    • "the origin is re-checked: a candidate that claims to be same-origin is not trusted";
    • "robots.txt is respected below aggressive";
    • "an exhausted budget is skipped, never a pass";
    • "every probe failing is skipped as probe-errors".

Mutation check: flipping credentials to include, dropping the credential-path filter, the 2xx check, the method filter or the origin re-check, or lowering the internal-row threshold, each fails at least one test.

Docs

  • New page docs/rules/security/auth-endpoint-disclosure.mdx, added to docs/docs.json.
  • The security hub regenerated (glossary.ts --write, rule-checks.ts --write).
  • docs/configuration/security.mdx "Rules that probe" table.
  • Security count 25 -> 26 in README, docs/index.mdx, docs/rules/index.mdx and docs/rules/security/index.mdx; constants comment at 330 rules.
  • CHANGELOG ### Added.
  • ENDPOINT-DISCOVERY.md lists the new consumer.

Gates

  • bun test packages/rules/tests/auth-endpoint-disclosure.test.ts: 16 pass.
  • With unauthenticated-api, rule-check-declarations, graphql-probe and graphql-introspection: 81 pass.
  • docs-index-rule-counts, docs-rule-pages, docs-category-table, max-rules-limit and meta-string-limits: 386 pass.
  • rule-verdict-scope, template-verdict-inputs, template-verdict-page-independence, meta-string-limits and max-rules-limit: 793 pass (run before the rebase).
  • streaming-rules-canonical-golden.test.ts: 1 pass. Pins moved to 330 rules and 109737 findings, with one passive skipped row; the score is unmoved.
  • golden-finding-messages-229.test.ts: 3 pass (snapshot regenerated: one skipped line).
  • packages/rules typecheck (src and tests) and packages/audit-engine typecheck: clean.
  • apps/cli: lint, typecheck and format:check all clean.
  • oxlint on the new files: clean.
  • docs/: make validate all checks passed, plus 62 script tests.
  • Not done: a live smoke test against real websites (this sandbox has no third-party network access).

Agent skill

No change needed. The squirrelscan skills do not list rules by name or count, and an agent acts on this finding like any other security fail.

Risk

This is a hold-list change (an active security probe), so it stays a draft for Opus review. On every active audit it adds up to six quiet GETs, mostly 404s on sites without these routes.

@nc9
nc9 marked this pull request as ready for review November 14, 2026 23:33
@nc9
nc9 force-pushed the boat/auth-endpoint-overdisclosure-1968 branch 3 times, most recently from d6495b3 to fd62d09 Compare November 15, 2026 04:27
@nc9

nc9 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Review requirement (added 2026-11-15 after a false all-clear found in true-positive testing): when this rule finds zero candidate endpoints, it must report not_checked with a reason, for example "no endpoints found in page code", never passed. Add a test: a site with no candidate call sites gives not_checked, not passed. Also include one end-to-end engine test (crawl a fixture, then endpoint surface, then this rule), not only a hand-built candidate list.

@nc9

nc9 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Review requirement (2026-11-15, from #1920): a probe answered with 429, a 401/403 bot challenge, an HTML challenge page (cf-mitigated, Cloudflare or WAF challenge markers), 5xx or a timeout must make the target UNVERIFIED. The rule then reports not checked or incomplete, never passed. Only a genuine 404, or a non-challenge answer, counts as not exposed. Please add a stub test for a 429 and for a 403 HTML challenge.

nc9 added 2 commits November 17, 2026 07:28
…s or the user record (repo#1968)

New site-scoped probing rule security/auth-endpoint-disclosure. With probing
active or aggressive it sends one GET, with no cookies, no Authorization header,
no body and no redirect following, to each same-origin current-user or session
endpoint: the ones the discovery pass found plus /api/me, /api/session,
/api/auth/session and /api/user, at most six. Credentials are never submitted.

A 2xx JSON answer that carries a password, a password hash (bcrypt, argon2,
scrypt, sha-crypt, md5-crypt, Django, Werkzeug, by format under any key), a
credential secret (reset, confirmation, remember and refresh tokens, OTP and MFA
secrets, recovery codes) or two or more internal user-table columns fails at
error severity, one check per endpoint, naming the JSON path of each field and
never its value.

The origin is re-checked rather than trusting probeEligible. State-changing and
credential-flow paths (login, signup, password, token, callback, authorize) and
call sites declaring a method other than GET or HEAD are never probed. robots.txt
is respected below aggressive. A passive run, and so a cloud audit of an
unverified website or a run with discovery probes off, sends nothing and records
one skipped check. A budget-cut or all-error run is skipped, never a pass.

Docs page, security index, docs.json, probing config table, README and
docs/index.mdx category tables (Security 25 -> 26), the rule count comment,
the canonical golden pins (330 rules, one passive skipped row) and the
finding-message snapshot are updated.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the boat/auth-endpoint-overdisclosure-1968 branch from 132286f to c79b8dc Compare November 16, 2026 20:28
@nc9
nc9 merged commit 7e05fb6 into main Nov 16, 2026
16 checks passed
@nc9
nc9 deleted the boat/auth-endpoint-overdisclosure-1968 branch November 16, 2026 20:46
longshore-nc9 Bot pushed a commit that referenced this pull request Nov 25, 2026
…#1885

Every fix-once unit (component groups, rollups, site-resource units) now
carries pageShare { share, label, crawledPages }, set at grouping time from
the report's totalPages. The JSON report serializes it (schema 1.31) and the
text, markdown, LLM and HTML renderers print the label from the unit rather
than recomputing it. Bumps REPORT_HTML_VERSION for the changed card text.

Signed-off-by: longshore-nc9[bot] <360568931+longshore-nc9[bot]@users.noreply.github.com>
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.

1 participant