Skip to content

fix: keep internal URLs and proxy credentials out of error strings - #512

Merged
us merged 2 commits into
mainfrom
fix/error-strings-strip-internal-urls
Sep 8, 2026
Merged

fix: keep internal URLs and proxy credentials out of error strings#512
us merged 2 commits into
mainfrom
fix/error-strings-strip-internal-urls

Conversation

@us

@us us commented Sep 8, 2026

Copy link
Copy Markdown
Owner

What changed

  • crw_core::error::reqwest_message(e) returns the error without reqwest's " for url (...)" tail, and is used at every site that formats a reqwest error into a returned string: CDP discovery, the camoufox and cloak sidecar clients, the HTTP tier, robots, the crawl proxy client, every LLM provider call in crw-extract, the search client's body read, and both MCP transports.
  • crw_core::redact_proxy_url(raw) masks user:pass@ in every message that quotes a proxy value, including ProxyEntry::parse's own errors, which crw-renderer turned into a customer-visible ConfigError.
  • The search route no longer names the search backend's host in the unreachable error and no longer passes the backend's error page through; the sanitized origin and the page go to the log. /v1/search/research/github maps its failures through the same mapper as /v1/search, so a backend timeout is 504 and an unreachable backend is 422 there too, where both were 502.
  • is_cert_error starts its walk at the error's source. The reqwest error's own text carried the request URL, so a target path containing "certificate" could classify a connect failure as a TLS failure and retry it with certificate verification disabled.
  • The operator keeps the endpoint in tracing at the sites where it matters.

Verification

Live before the change, with a deliberately named sidecar host: "Renderer error: CDP discovery failed: error sending request for url (http://internal-secret-chrome-host.crw-internal:9222/json/version)". After: "Renderer error: CDP discovery failed: error sending request".

Unit: crw-core 43, crw-renderer http_only 115 plus camoufox and cloak, crw-search 255, crw-server search 107; workspace clippy clean.

Caveat

Two tests that asserted the search backend host is present in the transport error (from issue #90) now assert the opposite. The host is in the warn log instead.

us added 2 commits September 8, 2026 13:55
reqwest's Display appends " for url (...)" to every error, and those strings
reach API callers verbatim: the scrape error field, a crawl or batch document's
block reason, the /v2 error envelopes, and the MCP tool responses. The URL was
frequently internal infrastructure (the CDP endpoint, a sidecar host, the
managed LLM endpoint) or carried credentials. The search route additionally
named the search backend's host in its unreachable error and passed up to 200
characters of the backend's own error page through to the caller.

crw_core::error::reqwest_message strips the URL at every site that formats a
reqwest error, and crw_core::redact_proxy_url masks userinfo in every message
that quotes a proxy value, including ProxyEntry::parse's own errors. The
search backend's sanitized origin now goes to the log instead of the response,
an upstream error page is reduced to its status, and /v1/search/research/github
maps its failures through the same mapper as /v1/search, so its status codes
now match that route.

is_cert_error starts its walk at the error's source rather than at the reqwest
error itself, whose Display carried the request URL: a target path mentioning
certificates could previously classify a plain connect failure as a TLS
failure and retry it with certificate verification disabled.
The docs guard rejects the bare backend name in source strings, and the
assertion carried it as a literal. Checking that no origin survives says the
same thing without the word.
@us
us merged commit bc2e100 into main Sep 8, 2026
11 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant