From 4e95c4906216d3b3cdbc34b681e8fe67a8b12c4c Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 18:12:19 +0000 Subject: [PATCH 1/3] fix(runtime): reach only public addresses through a fetch grant for a name A fetch grant for a host name, or for any host, let a component reach this machine and the local network whenever the name resolved there. A granted name could therefore be pointed by DNS at loopback, link-local metadata or private services. The runtime now resolves each destination itself. It passes only the allowed addresses to the HTTP client, so the address checked is the one connected to. Names and the wildcard reach only public unicast addresses. An IPv4 address named in a grant is still reached as declared. Credentials in a URL are refused. tests/runtime/check_grants.py runs the real component and checks these refusals: the local server through the wildcard, the name localhost, and credentials in a URL. The server records that none of the refused requests reached it. --- crates/weft-runtime/src/grants.rs | 114 ++++++++++++++++++++++++++++-- crates/weft-runtime/src/main.rs | 37 +++++++++- docs/architecture.md | 4 +- tests/runtime/check_grants.py | 27 +++++-- 4 files changed, 170 insertions(+), 12 deletions(-) diff --git a/crates/weft-runtime/src/grants.rs b/crates/weft-runtime/src/grants.rs index ab60c2d..b208ded 100644 --- a/crates/weft-runtime/src/grants.rs +++ b/crates/weft-runtime/src/grants.rs @@ -47,18 +47,31 @@ impl Grants { } #[cfg_attr(not(feature = "net-fetch"), allow(dead_code))] - /// Whether a request to `host` is covered by a fetch grant. `host` is the - /// URL's host in the lowercase form URL parsing produces. - pub fn fetch_host(&self, host: &str) -> Result<(), String> { + /// Whether a request to `host` is covered by a fetch grant, and which + /// addresses it may reach. `host` is the URL's host in the lowercase form + /// URL parsing produces. + pub fn fetch_host(&self, host: &str) -> Result { if self.fetch.is_empty() { return Err("capability net:fetch is not granted".to_owned()); } + // An address named in a grant is reached as declared, wherever it + // is; a name, or any host, reaches only public addresses, so a + // granted name cannot be pointed at this machine or the local + // network through DNS. + if host.parse::().is_ok() + && self + .fetch + .iter() + .any(|scope| matches!(scope, FetchScope::Host(granted) if granted == host)) + { + return Ok(Reach::Declared); + } let covered = self.fetch.iter().any(|scope| match scope { FetchScope::AnyHost => true, FetchScope::Host(granted) => granted == host, }); if covered { - Ok(()) + Ok(Reach::Public) } else { Err(format!("capability net:fetch:{host} is not granted")) } @@ -115,6 +128,54 @@ impl Preopen { } } +/// The addresses a granted request may connect to. +#[cfg_attr(not(feature = "net-fetch"), allow(dead_code))] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Reach { + /// Only public addresses. + Public, + /// The address the grant names, public or not. + Declared, +} + +/// Whether `ip` is a public unicast address: not loopback, unspecified, +/// private, shared (CGNAT), link-local, multicast, broadcast, reserved, +/// documentation or benchmarking space, nor an IPv6 form of one. +#[cfg_attr(not(feature = "net-fetch"), allow(dead_code))] +pub fn is_public(ip: std::net::IpAddr) -> bool { + use std::net::IpAddr; + match ip { + IpAddr::V4(v4) => { + let [a, b, c, _] = v4.octets(); + !(v4.is_unspecified() + || v4.is_loopback() + || v4.is_private() + || v4.is_link_local() + || v4.is_multicast() + || v4.is_broadcast() + || v4.is_documentation() + || a == 0 + || a >= 240 + || (a == 100 && (64..128).contains(&b)) + || (a == 192 && b == 0 && c == 0) + || (a == 198 && (18..20).contains(&b))) + } + IpAddr::V6(v6) => { + if let Some(v4) = v6.to_ipv4_mapped() { + return is_public(IpAddr::V4(v4)); + } + let first = v6.segments()[0]; + !(v6.is_unspecified() + || v6.is_loopback() + || v6.is_multicast() + || (first & 0xfe00) == 0xfc00 + || (first & 0xffc0) == 0xfe80 + || (first == 0x2001 && v6.segments()[1] == 0x0db8) + || (first == 0x0064 && v6.segments()[1] == 0xff9b)) + } + } +} + #[cfg(test)] mod tests { use super::*; @@ -138,6 +199,51 @@ mod tests { assert!(grants.notifications().is_err()); } + #[test] + fn named_and_wildcard_grants_reach_only_public_addresses() { + let mut grants = Grants::default(); + grants.add("net:fetch:api.example.org").unwrap(); + grants.add("net:fetch:127.0.0.1").unwrap(); + assert_eq!(grants.fetch_host("api.example.org"), Ok(Reach::Public)); + // An address named in a grant is reached as declared. + assert_eq!(grants.fetch_host("127.0.0.1"), Ok(Reach::Declared)); + let mut any = Grants::default(); + any.add("net:fetch:*").unwrap(); + assert_eq!(any.fetch_host("10.0.0.1"), Ok(Reach::Public)); + } + + #[test] + fn only_public_unicast_addresses_are_public() { + for public in ["93.184.216.34", "1.1.1.1", "2606:4700::1111"] { + assert!(is_public(public.parse().unwrap()), "{public}"); + } + for local in [ + "127.0.0.1", + "0.0.0.0", + "10.1.2.3", + "172.16.0.1", + "192.168.1.1", + "169.254.169.254", + "100.64.0.1", + "224.0.0.1", + "255.255.255.255", + "192.0.2.1", + "198.18.0.1", + "240.0.0.1", + "::1", + "::", + "fd00::1", + "fe80::1", + "ff02::1", + "::ffff:127.0.0.1", + "::ffff:10.0.0.1", + "64:ff9b::a00:1", + "2001:db8::1", + ] { + assert!(!is_public(local.parse().unwrap()), "{local}"); + } + } + #[test] fn host_fetch_grants_match_exact_hosts() { let mut grants = Grants::default(); diff --git a/crates/weft-runtime/src/main.rs b/crates/weft-runtime/src/main.rs index 1fe5d05..b221996 100644 --- a/crates/weft-runtime/src/main.rs +++ b/crates/weft-runtime/src/main.rs @@ -416,7 +416,14 @@ fn host_fetch( return Err(format!("unsupported URL scheme '{}'", parsed.scheme())); } let host = parsed.host_str().ok_or("URL has no host")?; - grants.fetch_host(host)?; + let reach = grants.fetch_host(host)?; + // Credentials are never taken from a URL; a component that needs them + // sends them in a header to the host it is granted. + if !parsed.username().is_empty() || parsed.password().is_some() { + return Err( + "URLs with credentials are not supported; send an Authorization header".to_owned(), + ); + } // The method is written into the request line as given, so only known // methods are accepted. if !matches!( @@ -437,6 +444,7 @@ fn host_fetch( } } let agent = ureq::AgentBuilder::new() + .resolver(GrantedResolver(reach)) .redirects(0) .timeout_connect(Duration::from_secs(10)) .timeout(Duration::from_secs(30)) @@ -471,6 +479,33 @@ fn host_fetch( }) } +/// Resolves a fetch destination and keeps only the addresses its grant +/// may reach; the connection is made to those addresses alone, so the +/// check cannot be bypassed by a second, different DNS answer. +#[cfg(all(feature = "wasmtime-runtime", feature = "net-fetch"))] +struct GrantedResolver(grants::Reach); + +#[cfg(all(feature = "wasmtime-runtime", feature = "net-fetch"))] +impl ureq::Resolver for GrantedResolver { + fn resolve(&self, netloc: &str) -> std::io::Result> { + use std::net::ToSocketAddrs; + let addresses: Vec<_> = netloc + .to_socket_addrs()? + .filter(|a| self.0 == grants::Reach::Declared || grants::is_public(a.ip())) + .collect(); + if addresses.is_empty() { + return Err(std::io::Error::new( + std::io::ErrorKind::PermissionDenied, + format!( + "{netloc} resolves only to addresses on this machine or a local network, \ + which a fetch grant for a name does not cover" + ), + )); + } + Ok(addresses) + } +} + #[cfg(all(feature = "wasmtime-runtime", not(feature = "net-fetch")))] fn host_fetch( grants: &Grants, diff --git a/docs/architecture.md b/docs/architecture.md index ee92a31..04dfab7 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -83,14 +83,14 @@ Each capability-controlled host import (fetch, notifications, clipboard) checks | `fs:read:app-data` / `fs:rw:app-data` | Preopen the app's data directory (see *App data*) as `/data`, read-only or read-write | | `fs:read:xdg-documents` / `fs:rw:xdg-documents` | Preopen the documents directory from the XDG user-dirs configuration (`XDG_DOCUMENTS_DIR`) as `/xdg/documents`; the launch fails when none is configured | | `net:fetch:` | `weft:app/fetch` to that exact host (a lowercase DNS name or dotted IPv4 address) over HTTP or HTTPS, on any port | -| `net:fetch:*` | `weft:app/fetch` to any host | +| `net:fetch:*` | `weft:app/fetch` to any host at a public address | | `sys:notifications` | `weft:app/notifications` | | `sys:clipboard:read` / `sys:clipboard:write` | `weft:app/clipboard#read` / `#write` | | `hw:gpu:compute` / `hw:gpu:render` | Not supported; the launch fails | Fetch does not follow redirects: a redirect is returned to the component as a response, so every destination it requests is checked against its grants. HTTP error statuses are responses too; only policy and transport failures are errors. Only the methods GET, HEAD, POST, PUT, PATCH, DELETE and OPTIONS are accepted, and a component cannot set `Host`, `Content-Length`, `Transfer-Encoding` or other hop-by-hop headers. Connecting times out after 10 seconds and the whole request after 30 seconds, not counting DNS resolution; response bodies are limited to 16 MiB. Fetch requires a runtime built with the `net-fetch` feature. -Fetch grants name hosts, not addresses: ports are not restricted, and a host that resolves to a loopback or private address (or `net:fetch:*`) can reach local services. IPv6 literals cannot be granted. +The runtime resolves a fetch destination itself and connects only to the addresses it allows. A grant for a name, and `net:fetch:*`, reach only public unicast addresses: loopback, unspecified, private, shared (100.64/10), link-local, multicast, broadcast, reserved, documentation and benchmarking addresses, and the IPv6 forms of these, are refused, so DNS cannot point a granted name at this machine or the local network. An IPv4 address named in a grant, such as `net:fetch:127.0.0.1`, is reached as declared. Ports are not restricted. Credentials in a URL are refused; a component sends credentials in a header, and only to a host it is granted, since redirects are not followed. IPv6 literals cannot be granted. `tests/runtime/check_grants.py` runs the real runtime on a probe component (`tests/components/grants-probe`) under each kind of grant. diff --git a/tests/runtime/check_grants.py b/tests/runtime/check_grants.py index bb1abc5..07c232f 100644 --- a/tests/runtime/check_grants.py +++ b/tests/runtime/check_grants.py @@ -16,9 +16,12 @@ scenario passes a different set of `--grant` and `--preopen` arguments: denied; - a host-specific fetch grant: requests to that host return their real status (200, 404, and 302 without following the redirect to another - host); requests to another host, a forged `Host` header, a method that - injects a request line and a `file:` URL are refused; -- a wildcard fetch grant: the other host is reachable. + host); requests to another host, credentials in the URL, a forged + `Host` header, a method that injects a request line and a `file:` URL + are refused; +- a wildcard fetch grant, and a grant for the name `localhost`: the local + server is refused, since only an address named in a grant reaches this + machine or a local network; the connection is never made. It also checks that the runtime refuses, with a specific error, filesystem capabilities passed as `--grant`, unknown capabilities and preopens @@ -42,8 +45,13 @@ APP_ID = "org.weft.test.grants" NOT_GRANTED = "is not granted" +# Paths the test server was asked for. +REQUESTS = [] + + class Handler(http.server.BaseHTTPRequestHandler): def do_GET(self): + REQUESTS.append(self.path) if self.path == "/ok": self.send_response(200) elif self.path == "/redirect": @@ -75,7 +83,8 @@ class Runner: f"fetch-ok http://127.0.0.1:{port}/ok\n" f"fetch-missing http://127.0.0.1:{port}/missing\n" f"fetch-redirect http://127.0.0.1:{port}/redirect\n" - f"fetch-other-host http://localhost:{port}/ok\n") + f"fetch-other-host http://localhost:{port}/ok\n" + f"fetch-credentials http://user:secret@127.0.0.1:{port}/ok\n") def run(self, *arguments, expect_success=True): command = [str(self.runtime), APP_ID, "1", "--module", str(self.module), @@ -140,12 +149,20 @@ def check(runner, data): expect(probes, "fetch-missing", True, contains="404") expect(probes, "fetch-redirect", True, contains="302") expect(probes, "fetch-other-host", False, contains=NOT_GRANTED) + expect(probes, "fetch-credentials", False, contains="credentials") expect(probes, "fetch-host-header", False, contains="set by the runtime") expect(probes, "fetch-bad-method", False, contains="unsupported HTTP method") expect(probes, "fetch-file-scheme", False, contains="unsupported URL scheme") + local = "local network" + REQUESTS.clear() _, probes = runner.run("--grant", "net:fetch:*") - expect(probes, "fetch-other-host", True, contains="200") + expect(probes, "fetch-other-host", False, contains=local) + expect(probes, "fetch-ok", False, contains=local) + _, probes = runner.run("--grant", "net:fetch:localhost") + expect(probes, "fetch-other-host", False, contains=local) + if REQUESTS: + raise AssertionError(f"refused fetches reached the server: {REQUESTS}") for arguments, message in ( (["--grant", "fs:rw:app-data"], "is not granted through --grant"), From b163655b879a97b573cd3de8736a9414868b1023 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 18:16:42 +0000 Subject: [PATCH 2/3] fix(runtime): judge IPv6 forms of IPv4 addresses and never fetch through a proxy The public-address check missed several kinds of IPv6 address: - IPv4-compatible and 6to4 addresses carrying a private IPv4 address; - site-local, Teredo, local-use NAT64, discard-only, benchmarking, ORCHID and documentation ranges. It also refused all well-known NAT64 addresses, which would break every named grant on a DNS64 network. Addresses carrying an IPv4 address are now judged by that address, and the special-purpose ranges are refused. The HTTP client is told never to take a proxy from the environment, since it would connect to the proxy rather than to the checked address. --- crates/weft-runtime/src/grants.rs | 58 +++++++++++++++++++++++++++---- crates/weft-runtime/src/main.rs | 4 ++- docs/architecture.md | 2 +- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/crates/weft-runtime/src/grants.rs b/crates/weft-runtime/src/grants.rs index b208ded..6c8bd10 100644 --- a/crates/weft-runtime/src/grants.rs +++ b/crates/weft-runtime/src/grants.rs @@ -161,17 +161,45 @@ pub fn is_public(ip: std::net::IpAddr) -> bool { || (a == 198 && (18..20).contains(&b))) } IpAddr::V6(v6) => { + let seg = v6.segments(); + let embedded = |high: u16, low: u16| { + IpAddr::V4(std::net::Ipv4Addr::new( + (high >> 8) as u8, + high as u8, + (low >> 8) as u8, + low as u8, + )) + }; + // Forms that carry an IPv4 address are judged by that address: + // mapped and compatible addresses, 6to4 and NAT64. if let Some(v4) = v6.to_ipv4_mapped() { return is_public(IpAddr::V4(v4)); } - let first = v6.segments()[0]; + if seg[..6] == [0; 6] && !(seg[6] == 0 && seg[7] <= 1) { + return is_public(embedded(seg[6], seg[7])); + } + if seg[0] == 0x2002 { + return is_public(embedded(seg[1], seg[2])); + } + if seg[..6] == [0x0064, 0xff9b, 0, 0, 0, 0] { + return is_public(embedded(seg[6], seg[7])); + } !(v6.is_unspecified() || v6.is_loopback() || v6.is_multicast() - || (first & 0xfe00) == 0xfc00 - || (first & 0xffc0) == 0xfe80 - || (first == 0x2001 && v6.segments()[1] == 0x0db8) - || (first == 0x0064 && v6.segments()[1] == 0xff9b)) + // Unique local, link-local and the deprecated site-local. + || (seg[0] & 0xfe00) == 0xfc00 + || (seg[0] & 0xffc0) == 0xfe80 + || (seg[0] & 0xffc0) == 0xfec0 + // NAT64 for local use, discard-only. + || (seg[0] == 0x0064 && seg[1] == 0xff9b) + || (seg[0] == 0x0100 && seg[1..4] == [0, 0, 0]) + // Teredo, benchmarking, ORCHID and documentation. + || (seg[0] == 0x2001 && seg[1] == 0) + || (seg[0] == 0x2001 && seg[1] == 0x0002 && seg[2] == 0) + || (seg[0] == 0x2001 && (seg[1] & 0xfff0) == 0x0010) + || (seg[0] == 0x2001 && seg[1] == 0x0db8) + || (seg[0] & 0xfff0) == 0x3ff0) } } } @@ -214,7 +242,15 @@ mod tests { #[test] fn only_public_unicast_addresses_are_public() { - for public in ["93.184.216.34", "1.1.1.1", "2606:4700::1111"] { + // NAT64 and 6to4 forms of a public address are public, so DNS64 + // networks keep working. + for public in [ + "93.184.216.34", + "1.1.1.1", + "2606:4700::1111", + "64:ff9b::5db8:d822", + "2002:5db8:d822::1", + ] { assert!(is_public(public.parse().unwrap()), "{public}"); } for local in [ @@ -238,7 +274,17 @@ mod tests { "::ffff:127.0.0.1", "::ffff:10.0.0.1", "64:ff9b::a00:1", + "64:ff9b:1::1", "2001:db8::1", + "fec0::1", + "::7f00:1", + "2002:7f00:1::", + "2002:a00:1::", + "2001::1", + "2001:2::1", + "2001:10::1", + "3fff::1", + "100::1", ] { assert!(!is_public(local.parse().unwrap()), "{local}"); } diff --git a/crates/weft-runtime/src/main.rs b/crates/weft-runtime/src/main.rs index b221996..fbdaf1f 100644 --- a/crates/weft-runtime/src/main.rs +++ b/crates/weft-runtime/src/main.rs @@ -445,6 +445,8 @@ fn host_fetch( } let agent = ureq::AgentBuilder::new() .resolver(GrantedResolver(reach)) + // A proxy would be connected to instead of the checked address. + .try_proxy_from_env(false) .redirects(0) .timeout_connect(Duration::from_secs(10)) .timeout(Duration::from_secs(30)) @@ -498,7 +500,7 @@ impl ureq::Resolver for GrantedResolver { std::io::ErrorKind::PermissionDenied, format!( "{netloc} resolves only to addresses on this machine or a local network, \ - which a fetch grant for a name does not cover" + which only a grant naming that address covers" ), )); } diff --git a/docs/architecture.md b/docs/architecture.md index 04dfab7..25639bc 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -90,7 +90,7 @@ Each capability-controlled host import (fetch, notifications, clipboard) checks Fetch does not follow redirects: a redirect is returned to the component as a response, so every destination it requests is checked against its grants. HTTP error statuses are responses too; only policy and transport failures are errors. Only the methods GET, HEAD, POST, PUT, PATCH, DELETE and OPTIONS are accepted, and a component cannot set `Host`, `Content-Length`, `Transfer-Encoding` or other hop-by-hop headers. Connecting times out after 10 seconds and the whole request after 30 seconds, not counting DNS resolution; response bodies are limited to 16 MiB. Fetch requires a runtime built with the `net-fetch` feature. -The runtime resolves a fetch destination itself and connects only to the addresses it allows. A grant for a name, and `net:fetch:*`, reach only public unicast addresses: loopback, unspecified, private, shared (100.64/10), link-local, multicast, broadcast, reserved, documentation and benchmarking addresses, and the IPv6 forms of these, are refused, so DNS cannot point a granted name at this machine or the local network. An IPv4 address named in a grant, such as `net:fetch:127.0.0.1`, is reached as declared. Ports are not restricted. Credentials in a URL are refused; a component sends credentials in a header, and only to a host it is granted, since redirects are not followed. IPv6 literals cannot be granted. +The runtime resolves a fetch destination itself and connects only to the addresses it allows. A grant for a name, and `net:fetch:*`, reach only public unicast addresses: loopback, unspecified, private, shared (100.64/10), link-local, multicast, broadcast, reserved, documentation and benchmarking addresses, and their IPv6 counterparts (unique local, site-local, Teredo and others), are refused, and an IPv6 address that carries an IPv4 address (mapped, compatible, 6to4, NAT64) is judged by that address, so DNS cannot point a granted name at this machine or the local network. An IPv4 address named in a grant, such as `net:fetch:127.0.0.1`, is reached as declared. Fetch never goes through a proxy. Ports are not restricted. Credentials in a URL are refused; a component sends credentials in a header, and only to a host it is granted, since redirects are not followed. IPv6 literals cannot be granted. `tests/runtime/check_grants.py` runs the real runtime on a probe component (`tests/components/grants-probe`) under each kind of grant. From 5f5474774a2b6b5e10ed5554d69b1852ae79406b Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 9 Oct 2026 18:17:57 +0000 Subject: [PATCH 3/3] fix(runtime): match the IPv6 special-purpose ranges exactly The documentation range was matched as 3ff0::/12 instead of 3fff::/20, which also refused unallocated global space. ORCHIDv2 (2001:20::/28) was missing. IPv4-translated addresses are now judged by the IPv4 address they carry. Tests cover the NAT64 /32 outside the well-known /96. --- crates/weft-runtime/src/grants.rs | 12 ++++++++++-- docs/architecture.md | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/weft-runtime/src/grants.rs b/crates/weft-runtime/src/grants.rs index 6c8bd10..e98ebcf 100644 --- a/crates/weft-runtime/src/grants.rs +++ b/crates/weft-runtime/src/grants.rs @@ -175,6 +175,10 @@ pub fn is_public(ip: std::net::IpAddr) -> bool { if let Some(v4) = v6.to_ipv4_mapped() { return is_public(IpAddr::V4(v4)); } + // IPv4-translated (::ffff:0:a.b.c.d). + if seg[..6] == [0, 0, 0, 0, 0xffff, 0] { + return is_public(embedded(seg[6], seg[7])); + } if seg[..6] == [0; 6] && !(seg[6] == 0 && seg[7] <= 1) { return is_public(embedded(seg[6], seg[7])); } @@ -197,9 +201,9 @@ pub fn is_public(ip: std::net::IpAddr) -> bool { // Teredo, benchmarking, ORCHID and documentation. || (seg[0] == 0x2001 && seg[1] == 0) || (seg[0] == 0x2001 && seg[1] == 0x0002 && seg[2] == 0) - || (seg[0] == 0x2001 && (seg[1] & 0xfff0) == 0x0010) + || (seg[0] == 0x2001 && matches!(seg[1] & 0xfff0, 0x0010 | 0x0020)) || (seg[0] == 0x2001 && seg[1] == 0x0db8) - || (seg[0] & 0xfff0) == 0x3ff0) + || (seg[0] == 0x3fff && (seg[1] & 0xf000) == 0)) } } } @@ -250,6 +254,7 @@ mod tests { "2606:4700::1111", "64:ff9b::5db8:d822", "2002:5db8:d822::1", + "3ffe::1", ] { assert!(is_public(public.parse().unwrap()), "{public}"); } @@ -275,6 +280,9 @@ mod tests { "::ffff:10.0.0.1", "64:ff9b::a00:1", "64:ff9b:1::1", + "64:ff9b:0:0:1::1", + "::ffff:0:a00:1", + "2001:20::1", "2001:db8::1", "fec0::1", "::7f00:1", diff --git a/docs/architecture.md b/docs/architecture.md index 25639bc..22762ef 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -90,7 +90,7 @@ Each capability-controlled host import (fetch, notifications, clipboard) checks Fetch does not follow redirects: a redirect is returned to the component as a response, so every destination it requests is checked against its grants. HTTP error statuses are responses too; only policy and transport failures are errors. Only the methods GET, HEAD, POST, PUT, PATCH, DELETE and OPTIONS are accepted, and a component cannot set `Host`, `Content-Length`, `Transfer-Encoding` or other hop-by-hop headers. Connecting times out after 10 seconds and the whole request after 30 seconds, not counting DNS resolution; response bodies are limited to 16 MiB. Fetch requires a runtime built with the `net-fetch` feature. -The runtime resolves a fetch destination itself and connects only to the addresses it allows. A grant for a name, and `net:fetch:*`, reach only public unicast addresses: loopback, unspecified, private, shared (100.64/10), link-local, multicast, broadcast, reserved, documentation and benchmarking addresses, and their IPv6 counterparts (unique local, site-local, Teredo and others), are refused, and an IPv6 address that carries an IPv4 address (mapped, compatible, 6to4, NAT64) is judged by that address, so DNS cannot point a granted name at this machine or the local network. An IPv4 address named in a grant, such as `net:fetch:127.0.0.1`, is reached as declared. Fetch never goes through a proxy. Ports are not restricted. Credentials in a URL are refused; a component sends credentials in a header, and only to a host it is granted, since redirects are not followed. IPv6 literals cannot be granted. +The runtime resolves a fetch destination itself and connects only to the addresses it allows. A grant for a name, and `net:fetch:*`, reach only public unicast addresses: loopback, unspecified, private, shared (100.64/10), link-local, multicast, broadcast, reserved, documentation and benchmarking addresses, and their IPv6 counterparts (unique local, site-local, Teredo and others), are refused, and an IPv6 address that carries an IPv4 address (mapped, compatible, translated, 6to4, NAT64) is judged by that address, so DNS cannot point a granted name at this machine or the local network. An IPv4 address named in a grant, such as `net:fetch:127.0.0.1`, is reached as declared. Fetch never goes through a proxy. Ports are not restricted. Credentials in a URL are refused; a component sends credentials in a header, and only to a host it is granted, since redirects are not followed. IPv6 literals cannot be granted. `tests/runtime/check_grants.py` runs the real runtime on a probe component (`tests/components/grants-probe`) under each kind of grant.