Skip to content

fix(crawl): the WASM crawl loop still sends credentials to any host it follows #404

Closed

Description

@Goldziher

PR #403 scopes configured credentials to the crawl's seed host on the main crawl loop, but the sequential/WASM loop cannot receive that override, so it keeps the defect #387 describes.

crates/crawlberg/src/engine/wasm_crawl.rs:259 calls the public scrape() once per frontier entry:

match self.scrape(&entry.url).await {

scrape() derives the origin host from the URL it is given, so a frontier entry on a different host — a subdomain admitted by allow_subdomains, or a redirect target — is its own origin by construction and gets the credentials. That is the same self-referential check #403 removed from crawl_loop.rs, still in place here. batch_scrape (:447) has the same shape, though its inputs are caller-supplied rather than discovered, so it is the less severe half.

The fix needs an internal scrape() variant that accepts an explicit origin_host: Option<&str>, threaded through the browser-mode branches the same way #403 threads it through http_fetch/fetch_with_retry. It is testable without a browser: the module compiles under cfg(test) on native and already has tests in that file.

Also still deriving their own origin (pre-existing, not named in #387, listed here so the remaining surface is in one place): asset downloads in assets.rs, and the sitemap/map fetches in sitemap.rs and map.rs.

Activity

  1. added
    bugSomething isn't working
    hardeningDefence in depth: credential handling, SSRF policy and input validation
    P1Operator-facing: wrong output on a common path, or a secret reaching logs or errors
    on Sep 27, 2026
  2. added theissue type on Sep 27, 2026
  3. added
    operatorAn operator would hit this in normal use; ranks above dev, test and edge cases
    on Sep 27, 2026
  4. tobocop2 commented on Sep 29, 2026

    @tobocop2
    Member

    Fixed on integration/0927 by #495 (c9d8254): the sequential crawl loop, which the WASM build uses, now scrapes every page under the seed's credential scope, so subdomain and cross-host pages no longer receive the seed's auth or custom headers. Independent review ACCEPT at the landed head; union gate green (1926 passed, 0 failed); putting the old per-page call back turns four tests red.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Operator-facing: wrong output on a common path, or a secret reaching logs or errorsbugSomething isn't workinghardeningDefence in depth: credential handling, SSRF policy and input validationoperatorAn operator would hit this in normal use; ranks above dev, test and edge cases

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions