Repository navigation
feat(id): F12.5 http.fetch provider — off by default, admin allowlist (#1062) - #12559
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 561c6cc4e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let handle = std::thread::spawn(move || perform(&url, &allowed_hosts)); | ||
| match handle.join() { |
There was a problem hiding this comment.
Await fetch completion without blocking a Tokio worker
When http.fetch is enabled and an allowlisted endpoint responds slowly, this synchronous join() blocks the Tokio worker for the entire fetch, potentially ten seconds. WorldHandle launches the actor with tokio::spawn (world/handle.rs:334), and its async request loop calls self.execute(&request) synchronously (world/actor/execution.rs:884), so moving the network operation onto another thread does not free the runtime thread waiting here. Concurrent fetches across enough worlds can occupy every runtime worker and stall unrelated worlds and server I/O, exceeding the design's intentionally accepted stall of only the requesting actor. Await a blocking-task completion or completion channel from the async actor path instead.
Useful? React with 👍 / 👎.
| reqwest = { version = "0.13", default-features = false, features = [ | ||
| "blocking", | ||
| "rustls", | ||
| ] } |
There was a problem hiding this comment.
Resolve the Rustls crypto provider when enabling AWS-LC
For HTTPS libsql requests made before a process-wide crypto provider has been installed, this dependency change introduces a runtime panic even when http.fetch remains disabled. The updated lockfile adds aws-lc-rs to Rustls, while pkgs/id/Cargo.toml already enables its ring provider; the existing HttpTransport::wrap_tls in pkgs/id/src/foreign_libsql.rs:774 calls rustls::ClientConfig::builder() without selecting a provider, and repository-wide search found no CryptoProvider::install_default() call. With both providers enabled, Rustls cannot infer the default; its builder documentation documents a panic when provider resolution fails. Preserve the existing single-provider configuration or explicitly select/install a provider before these TLS builders run.
Useful? React with 👍 / 👎.
Third provider slice for #1062, in the order fixed by the 2026-11-21 decision on that issue (kv: PR #12489, blob: PR #12529). Design: doc/2026-11-22_design_id1062-http-fetch-provider.md.
Problem
F12.5 names four first providers.
http.fetchis the first outward-facing one — its effect leaves the node — and the issue fixes its shape: admin allowlist, size and rate bounds, no redirects off the list, off by default, and a test that proves an unlisted host is refused.Change
http.fetchregisters as a version-1 host request, Join scope,DefaultCeiling::Excluded— it joins no default ceiling, so a use before an operator names it in both the server caps and the world ceiling is refusedoutside_ceilingby the ordinary ledger decision.validate_http_fetch_urlowns the URL form (http/https only, host required, no userinfo, ≤ 2,048 bytes) and returns the normalized host.WorldLimits::http_fetch_hosts— runtime configuration in theserver_capsmould, never journaled, empty by default.WorldCore::check_http_fetchrefuses a malformed URL, an unlisted host (exact match on the normalized host; no wildcards, no implied subdomains), and an exhausted rate window before any connection. Attempts are recorded when made, so refused and failed fetches spend the rate budget too.{"url"}, result{"url", "status", "body", "body_bytes"}with the body base64 (the blob wire spelling). The fetch runs on a dedicated OS thread per fetch (the reqwest blocking API panics inside an async runtime; the actor runtime never blocks). Redirects are followed manually, ≤ 3 hops, every hop re-validated and re-checked against the allowlist before connecting. Body read is capped (32 KiB, refused past it, never truncated); one 10 s budget covers all hops.CapsGrantedif grant-on-use mints). At-most-once across a reopen is the existing stale-wants refusal, whose comment already names http.fetch. Full rationale in the design doc.reqwest0.13 for id-worlds (blocking + rustls, default features off so no system proxy is consulted; already in the workspace lock as iroh's dependency) andurl2 for id-caps (likewise already in the lock).Test evidence (venue: sandbox for every run)
validate_http_fetch_url,MAX_HTTP_FETCH_URL_BYTES,normalize_http_fetch_host; id-worlds fails with 16 errors namingcheck_http_fetch(×9), thehttp_fetch_hostsfield,note_http_fetch_attempt, and theMAX_HTTP_FETCH_*/HTTP_FETCH_RATE_WINDOW_MSconstants.cargo test -p id-caps173 passed, 0 failed;cargo test -p id-worlds --lib world::477 passed, 0 failed — theworld::filter keeps the ~40 known live-network failures (id-worlds live-network tests fail with connect timeouts in the Muse sandbox (environmental) #12488) out of scope. All 7 new http.fetch tests pass, including the named ones: off-by-default (outside_ceiling, server sees no request), unlisted host refused (server sees no request), ungranted refusal counted, round trip + on-list redirect + 404-as-result against a hermetic loopback server (no live internet in any test), off-list redirect and hop-cap and over-cap body refusals with exact server hit counts, core bound/rate checks on a manual clock, and the replay test (a fetch interleaved with a kv write adds no state entry; restore rebuilds the same state).Systemevent for every provider (reads included), so the replay test asserts no state entry rather than no entry; the design doc states this precisely.Left on #1062 after this slice:
notify(rate limited), last in the decision order.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.