Skip to content

test(audit-engine): an all-cached re-audit feeds the probe rules the same endpoints as a refresh #2081 - #2160

Merged
nc9 merged 1 commit into
mainfrom
boat/cached-endpoint-candidates-2081
Nov 20, 2026
Merged

nc9 merged 1 commit into
mainfrom
boat/cached-endpoint-candidates-2081

Conversation

@nc9

@nc9 nc9 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Closes #2081

Summary

This PR adds a test only. The bug does not reproduce on current main. It was seen on an unmerged branch build (49db10f). On main, a re-audit where every page is a crawl cache hit (hash_match) and is replayed from the rule cache restores the endpoint collector's snapshot. The probe rules get the same candidates as a fresh run.

I checked this two ways:

  • Engine: two incremental crawls against one store, with the rule cache on.
  • CLI from source: squirrel audit <local fixture> --aggressive -m 40, run twice. The second run had 3/3 hash_match page hits and 3 pages replayed, and both probe rules still flagged both endpoints.

The new e2e test pins this behaviour: packages/audit-engine/tests/cached-endpoint-candidates-2081-e2e.test.ts. It runs three audits of one unchanged fixture site against one store:

  • cold: rule cache on, nothing cached yet;
  • warm: every page a cache hit and replayed;
  • refresh: full crawl, no rule cache.

A pass-through spy on RuleRunner.prototype.runSiteRules (restored in afterAll) captures the real endpoint surface each audit hands the site rules.

Acceptance criteria

  • The all-cached surface equals the refresh surface: expect(warm.surface).toEqual(refresh.surface). The refresh surface holds both inline fetch() call sites as same-origin, probe-eligible candidates.
  • The fixture with an inline fetch() is crawled twice, and the second run is all cache hits: pageCacheHits === pages, freshPages 0, replayedPages 3. Both runs give the same candidates and the same verdicts for both rules.
  • On the warm run neither rule reports no-endpoints. unauthenticated-api-sensitive fails on both endpoints, json-sensitive-fields fails, and the site receives both probe GETs.

Regression check: with the collector's replay turned into a no-op, the test fails on the warm run.

Gates

  • bun install --frozen-lockfile, then bun run format:check, bun run lint, and bun run typecheck in packages/audit-engine: pass
  • bun run scripts/test-suites.ts --check: pass. bash scripts/test-ci-classify.sh: 42/42
  • bun run scripts/test-suites.ts --run audit-engine: 2366 pass, 3 skip, 0 fail (2369 tests, 248 files)

Residual risk

The signed-in cloud-rendering path was not exercised here, because the sandbox has no credentials.

Agent skill change: none.

…same endpoints as a refresh #2081

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review November 20, 2026 20:46
@nc9
nc9 merged commit dc68fb7 into main Nov 20, 2026
8 of 15 checks passed
@nc9
nc9 deleted the boat/cached-endpoint-candidates-2081 branch November 20, 2026 20:57
nc9 added a commit that referenced this pull request Nov 20, 2026
…pass (#2082) (#2164)

security/unauthenticated-api reports every leaking current-user endpoint with no hand-off; after the site pass the runner keeps exactly one finding per endpoint (security/auth-endpoint-disclosure's when its results include the endpoint, otherwise unauthenticated-api's). Before, an endpoint handed to the auth rule lost its finding when that rule threw or ran past its time budget. The deferredToAuth detail on the unauthenticated-api clean row is replaced by reportedBy/reportedElsewhere.

landed during Actions billing lock: Daytona CI pubci-11202044-240a587 (PASS at 240a587; quality, tests, build; DCO 2/2). 4 behind main at merge (#2143, #2150, #2161, #2160): no overlap with packages/rules/src/runner.ts, packages/rules/src/security/ or the 1886/2082 tests. Hold-list security-rule change: merged on Nik's approval.

Signed-off-by: Nik Cubrilovic <[email protected]>
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.

Incremental re-audit with all pages cached: probe rules skip with no-endpoints because cached pages feed no endpoint candidates

1 participant