Skip to content

Suggestion: don't fetch provider or manifest URLs that point at non-public addresses - #56

Open
JAG-UK wants to merge 1 commit into
mainfrom
suggestion/block-non-public-fetch-targets
Open

JAG-UK wants to merge 1 commit into
mainfrom
suggestion/block-non-public-fetch-targets

Conversation

@JAG-UK

@JAG-UK JAG-UK commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This is a suggestion from a security read-through of the repo, not a required fix. It changes how every outbound provider/manifest request is resolved, and the release-build behaviour has not been run against real providers, so please treat it as a proposal to review, not something to merge on trust.

Problem

The service fetches URLs that outsiders choose: provider endpoints come from on-chain multiaddrs, manifest locations from deal proposals. Today:

  • provider endpoints have no address check at all;
  • manifest locations are only checked when the host is a literal IP, so a DNS name that resolves to 10.x or 169.254.169.254 passes, and redirects are followed unchecked.

That lets someone point the service at its own network (SSRF). In production the Decodo proxy happens to carry plain-HTTP requests elsewhere, but HTTPS goes direct and an environment without the proxy has no protection.

Change

All in the shared client from build_client, plus one filter in the multiaddr parser:

  • DNS: a custom resolver drops loopback, private, link-local and unique-local addresses from answers. Because it runs at connect time it also covers redirect hops and rebinding.
  • Redirects: a hop to a literal non-public IP is refused (the resolver isn't consulted for literal IPs). Limit stays at 10.
  • Multiaddrs: /ip4 and /ip6 components with non-public addresses are dropped, so the endpoint is discarded.
  • is_public_ip moves from deal_manifest.rs to http_client.rs and now also catches IPv4-mapped IPv6 (::ffff:10.0.0.5).

As with the existing manifest check, debug builds allow everything, because local development and the tests use localhost mock servers.

Things to check before merging

  • A provider that is only reachable on a private address (same VPC, VPN) would stop being tested. I assume there are none.
  • Clients created with Client::new() elsewhere (BMS, Lotus, cid.contact) are untouched; they call fixed, configured URLs.
  • Not covered: 100.64.0.0/10 (CGNAT) and other special ranges beyond what the existing check listed.

Testing

  • cargo fmt --check, cargo clippy --workspace, and all 88 unit tests pass locally, including new tests for the address check and the resolver.
  • The integration tests were not run locally (CI runs them). They run in debug, so they do not exercise the blocking path.
  • Not tested: a release build against real provider endpoints or the proxy.

🤖 Generated with Claude Code

…sses

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
production-fidl — 9dc224ec Deployed Nov 26, 2026 by JAG-UK via build-and-publish / build_and_push #204
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.

1 participant