Skip to content

External link check: refused links vanish from the report, and the cache and bulk checker run before the egress check #770

Closed

Description

@nc9

Follow-up to squirrelscan/repo#2759 (PR #767). #767 routes every request the external link checker sends through the egress guard. That was a gap that existed before #767: before it, no hop had an address check, not even the first request. The review of the guard commit found these left over:

  1. Refused links disappear from the report. A link whose own address is refused (a private or link-local address on a public site's page) is stored unresolved. Unless every link was refused, links/broken-external-links says nothing about it: "All N external link(s) are working" counts only the checked ones, and the over-limit line counts refused links as checked.
  2. The link cache and the bulk checker are consulted before the egress check. The CLI's link cache is global across sites. A private-site audit can cache the status of http://192.168.1.1/..., and a later public-site audit then serves that status from the cache into a report that may be published, without sending a request. A signed-in audit also sends private or IP-literal links to the cloud dead-links check.
  3. The guard is opt-in. ExternalCheckerOptions.egress is optional, and when it is absent requests are unrestricted. Only the audit's entry point sets it today.
  4. Wording. The docs (docs/configuration/external-links.mdx) and the PR say requests carry only User-Agent and Accept. fetchUndecoded also sends Accept-Encoding.

Acceptance Criteria

  • A link refused by the egress policy is reported in links/broken-external-links as not requested, with a reason and a masked sample, and is never counted as working or as checked.
  • Links refusable without DNS (an IP literal the policy refuses, a non-public or metadata hostname) are refused before the link cache is read and before the bulk checker is called. A test shows a cached verdict for a private address is not served into a public site's audit.
  • checkExternalLinks applies a strict default egress policy when none is given, or egress is required. (fix(audit-engine): external link check never requests action or token links, nor redirect hops into them (repo#2759) #767)
  • The docs list exactly the headers the check sends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugsecuritysize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions