fix(proxy): a NO_PROXY address with an IPv6 zone names nothing (#59)

parseNoProxy read an entry with netip.ParseAddr, which accepts a zone,
and PrefixFrom then dropped it, so fe80::1%eth0 sent fe80::1 direct.
Go's httpproxy, HostOK, dial and the policy all treat a zoned address
as naming nothing; the NO_PROXY reader now does too.

Tests: FuzzNoProxy's crash input (::%0 against [::]), and fe80::1%eth0
and [fe80::1%eth0]:443 in TestNoProxy's names-nothing cases.
FuzzHostSites' noProxySite lists the zoned address as a divergence
from the legacy reader.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
w3cjandClaude Opus 5.5 committed 2026-11-18 11:51:54 -07:00
1 parent e97db057fd
commit 8afdec7de4
6 files changed
+23 -5

No files matched your search

+1
View File
@@ -136,6 +136,7 @@ These changes are on `main` and go out in the next release.
### Fixed
- **A `NO_PROXY` address with a zone no longer goes direct (#59):** an IPv6 address with a zone in your company proxy's `NO_PROXY`, such as `fe80::1%eth0`, sent that address without its zone past the company proxy. Such an entry now matches nothing, as it does in Go's HTTP clients ([behind a company proxy](https://next.devvm.dev/docs/safety/network/#behind-a-company-proxy)).
- **Claude Code's plugins work in a VM (#56):** a VM's `~/.claude/plugins` was devvm's agent store's folder, mounted read-only, so everything Claude Code writes there failed, such as a plugin's data in `${CLAUDE_PLUGIN_DATA}`, installing a plugin and updating a marketplace. Each VM's `~/.claude/plugins` is now its own folder, and the store's plugins are Claude Code's read-only seed at `~/.claude/plugins-seed`, so the store's plugins load as before, a plugin keeps its data in the VM, and a plugin you install in a VM stays in that VM until `devvm agent save` copies it into the store. The save adds plugins to the store and never takes one out, and an export of a VM's history leaves its plugins folder out ([Claude Code's plugins](https://next.devvm.dev/docs/using/coding-agents/#claude-codes-plugins)).
- **`devvm agent import` no longer copies your plugins' data into every VM:** it copied all of `~/.claude/plugins` into the store, so every VM with Claude Code got the data that your plugins keep on this machine, which can hold their own logins. It now copies only the marketplaces, their records and the plugins' cache, and `devvm agent save` copies only those from a VM ([importing from this machine](https://next.devvm.dev/docs/using/coding-agents/#importing-from-this-machine)).
- **An export can't put what an import leaves out into a VM:** `devvm history import` left out the agents' logins and the files devvm's setup writes by their names as an export wrote them, so an export that spelled one another way, such as `.claude/./settings.json` or `.claude//plugins`, got it into the VM's home. The import now refuses a name with a `.` or empty part, and deletes what it leaves out by its path once it's unpacked ([importing history](https://next.devvm.dev/docs/internals/agents/#importing-history)).
+1 -1
View File
@@ -536,7 +536,7 @@ devvm passes the settings to the VM's proxy when the proxy starts, and when you
The VM's proxy uses the company proxy this way ([through a company proxy](../internals/network.md#through-a-company-proxy)):
- It still decides each request by the host name the VM asked for, against the same allowlists, and only then passes it on. It sends tunnels, which carry HTTPS and the requests it puts your secrets into, through `HTTPS_PROXY`'s proxy, and plain HTTP requests through `HTTP_PROXY`'s.
- It reaches the hosts that `NO_PROXY` names directly, and also `localhost` and loopback addresses. In `NO_PROXY`, `example.com` matches that host and its subdomains, `.example.com` matches only its subdomains, an address or a CIDR matches addresses, any entry can end in a port, and `*` matches every host.
- It reaches the hosts that `NO_PROXY` names directly, and also `localhost` and loopback addresses. In `NO_PROXY`, `example.com` matches that host and its subdomains, `.example.com` matches only its subdomains, an address or a CIDR matches addresses, any entry can end in a port, and `*` matches every host. An IPv6 address with a zone, such as `fe80::1%eth0`, matches nothing, as it does in Go's HTTP clients.
- `devvm network log` adds `through host:port` to each request that went through the company proxy.
The company proxy's address and password follow these rules:
+9 -2
View File
@@ -359,7 +359,8 @@ func sniSites(t *testing.T, sni, other string) {
// matches no host the proxy takes (the Kelvin sign's kubernetes.io no longer matches
// kubernetes.io). An entry of dots alone is no entry, as "" and "." weren't. An entry with a port
// no request has (0, or past 65535), or one not in plain decimal (080, +80), is no entry, where
// port 0 was read as every port and 080 as 80.
// port 0 was read as every port and 080 as 80. An address with an IPv6 zone is no entry, where
// it was read as the address without its zone.
func noProxySite(t *testing.T, entry, other string) {
entry = strings.ReplaceAll(entry, ",", "") // one entry
list := entry + ",*." + entry + ",." + entry
@@ -367,8 +368,14 @@ func noProxySite(t *testing.T, entry, other string) {
for e := range strings.SplitSeq(list, ",") {
e = strings.ToLower(strings.TrimSpace(e))
_, perr := netip.ParsePrefix(e)
_, p, err := net.SplitHostPort(e)
h, p, err := net.SplitHostPort(e)
n, nerr := strconv.Atoi(p)
if err != nil || nerr != nil {
h = e
}
if a, aerr := netip.ParseAddr(strings.Trim(h, "[]")); perr != nil && aerr == nil && a.Zone() != "" {
continue
}
if perr == nil || err != nil || nerr != nil || n >= 1 && n <= 65535 && strconv.Itoa(n) == p {
kept = append(kept, e)
}
@@ -0,0 +1,4 @@
go test fuzz v1
string("::%0")
string("[::]")
int(435)
+5
View File
@@ -326,6 +326,11 @@ func parseNoProxy(s string) []noProxyRule {
}
e = strings.Trim(e, "[]")
if a, err := netip.ParseAddr(e); err == nil {
// An address with an IPv6 zone names nothing, as in Go's clients: no request's host
// has a zone, and the prefix would drop it, naming the address without its zone.
if a.Zone() != "" {
continue
}
r.prefix = netip.PrefixFrom(a.Unmap(), a.Unmap().BitLen())
out = append(out, r)
continue
+3 -2
View File
@@ -289,8 +289,9 @@ func TestNoProxy(t *testing.T) {
t.Error("NO_PROXY=* sent a host upstream")
}
// A port no request has, or one not in plain decimal, names nothing, as in Go's clients: port 0
// was read as every port (found by FuzzNoProxy).
for _, e := range []string{"git.test:0", "git.test:65536", "[::1]:0", "git.test:080", "git.test:+80"} {
// was read as every port (found by FuzzNoProxy). So does an address with an IPv6 zone, as no
// request's host has one, rather than the address without its zone (found by FuzzNoProxy).
for _, e := range []string{"git.test:0", "git.test:65536", "[::1]:0", "git.test:080", "git.test:+80", "fe80::1%eth0", "[fe80::1%eth0]:443"} {
if got := parseNoProxy(e); len(got) != 0 {
t.Errorf("NO_PROXY=%s: %+v", e, got)
}