Repository navigation
fix(engine): a private site's link checks stay out of the shared cache; the bulk checker gets public links only #775 - #802
Merged
Merged
Conversation
…e; the bulk checker gets public links only #775 - The shared link cache is read and written only under a public-only egress policy, so a public site's audit is never answered with a verdict a private-network check produced. The CLI cache ignores rows from before this rule (new public_only column), which also drops cloud refusals cached as broken links. - The cloud bulk checker is never sent a link whose URL names a non-public host, whatever the policy; those take the local check. - A bulk answer of blocked_non_public_host is a refusal, not a verdict: the link takes the local check and is never recorded as broken. The pub#753 and repo#2759 bulk tests now name their loopback fixture by a public-looking name resolved there. Signed-off-by: Nik Cubrilovic <[email protected]>
…licies skip the cache, tests keep their intent - Docs/CHANGELOG: a public site's audit refuses non-public links rather than checking them, and a cloud refusal is never reported broken (no claim about how it is checked). - isPublicOnlyEgress also excludes allowHost policies; the refusal match needs the 'blocked_non_public_host:' prefix with its colon. - checkExternalLinks via a subpath export, not the engine index. - New unit test: a public site's action/token links (URL or text) never reach the bulk checker; the 753 e2e is renamed to what it shows. Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/link-cache-egress-775
branch
from
October 15, 2026 06:11
aaae3c7 to
ec60bb9
Compare
… isPublicOnlyEgress per policy field Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
marked this pull request as ready for review
October 15, 2026 06:17
|
Reviewed the diff (cache gating, bulk-checker filtering, schema migration, tests). I found no blocking problems.
The tests cover the migration of an old-schema DB, the new-write path, and the bulk filtering. |
nc9
added a commit
that referenced
this pull request
Oct 15, 2026
…ache #800 After the rebase onto pub#802 the link cache is used only under a public-only egress policy, so the cache tests use the bulk checker and cached answers, not the loopback server. One cacheableVerdict() decides both cache writes (throttled, refused and unverifiable verdicts are never cached). Signed-off-by: Nik Cubrilovic <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #775.
What changes
1. The shared link cache holds only public-only checks. The CLI's external link cache is shared by every audit on the machine. An audit of a site on a private network allows private addresses, so it cached verdicts for public names that resolve privately, and for redirect chains it followed into private hosts. A later public site's audit could be answered from that cache:
refusedWithoutLookuponly settles what the URL itself says, so a public name that resolves privately passes it.checkExternalLinksnow reads and writes the cache only when its egress policy is public-only (isPublicOnlyEgress: noallowPrivateNetwork,allowPrivateTarget,trustTargetorallowHost). A private site's audit checks every link afresh and caches nothing.public_onlycolumn. Every row this version writes sets it, and reads require it. Rows written by earlier versions are ignored until the next check of the link replaces them. That drops any verdict a private site's audit cached before this change, and any cloud refusal cached as a broken link (point 3). The cost: each link is checked again once after the update.2. The bulk checker only gets public links. The cloud dead-links check is a public service. It is never sent a link whose URL names a non-public host (
refusedWithoutLookupunder the strict public policy: a private or loopback address,localhost, a.localor other internal zone, a single-label name), whatever the audit's policy. Those links take the local check, which a private site's audit is allowed to make. A batch made only of such links does not call the service at all.3. A cloud refusal is not a verdict. When the service answers a link it will not request (the link, or a redirect it leads to, is on a non-public address) with
status: null, error: "blocked_non_public_host:<reason>", the engine used to record that error as the link's answer: reported broken, and cached. Now such a link takes the local check:refused, never broken, not cached). A redirect into a private host stops at the redirect.Tests
All new tests fail on main, checked by swapping in main's file.
packages/audit-engine/tests/external-link-cache-egress-775.test.ts:localhost, single-label and.locallinks are checked locally and never sent to the bulk checker. With only such links, it is not called.blocked_non_public_hostanswer on a public site's audit is checked locally, refused, not broken and not cached. On a private site's audit it is checked locally and answered. Any other bulk error stays the answer.packages/audit-engine/tests/external-links-not-requested-2759.test.tshas a new test: on a public site's audit, the action and token links, by URL or by link text, are never sent to the bulk checker. It uses a public name, and the service answers everything it is asked, so nothing goes to the network.apps/cli/tests/crawler/link-cache-public-only-775.test.ts:Changed tests
The pub#753 chunking tests and the repo#2759 "action URL handed directly" test sent loopback fixture links to a fake bulk checker. That is exactly what this change stops.
resolve. The CLI pub#753 test does this through the engine'scheckExternalLinks, imported from a new@squirrelscan/audit-engine/external-checkersubpath export.localhostsite with loopback external links, is renamed to what it now shows: the service is never called, and the summary reports the local results. The unanswered-chunk path stays covered by thecheckExternalLinkstests in the same file.Also re-run:
external-link-refused-770,external-link-egress-2759,link-checks-not-run-e2e, and the CLIcloud-spend,quick-skips-cloudandstreamed-payload-paritytests.Docs and skill
configuration/external-links: the cache section says only public site audits use the cache. The redirect and refusal paragraph covers the bulk checker gate and cloud refusals.