Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

spindle/engines/microvm: fix ipv4 read cache blocking

Signed-off-by: dawn <dawn@tangled.org>

author
dawn
date (Jul 22, 2026, 12:35 PM +0300) commit 079c99a6 parent ce717bc7 change-id zqmkupos
+15
+9
spindle/engines/microvm/read_cache_proxy.go
··· 252 252 if ip == nil { 253 253 return fmt.Errorf("refusing to dial non-IP address %q", host) 254 254 } 255 + bits := 128 256 + if ip4 := ip.To4(); ip4 != nil { 257 + ip = ip4 258 + bits = 32 259 + } 255 260 for _, ipnet := range blockedNamespaceNets { 261 + _, blockedBits := ipnet.Mask.Size() 262 + if blockedBits != bits { 263 + continue 264 + } 256 265 if ipnet.Contains(ip) { 257 266 return fmt.Errorf("refusing to dial %s: %s is blocked for workflow caches", ip, ipnet) 258 267 }
+6
spindle/engines/microvm/read_cache_proxy_test.go
··· 122 122 } 123 123 } 124 124 125 + func TestCacheProxyGuardAllowsPublicIPv4(t *testing.T) { 126 + if err := refuseSpecialPurposeAddrs("tcp", "104.26.13.82:443", nil); err != nil { 127 + t.Fatalf("public IPv4 address was blocked: %v", err) 128 + } 129 + } 130 + 125 131 func TestCacheProxyGuardedUpstreamCannotReachBlockedRanges(t *testing.T) { 126 132 // httptest listens on 127.0.0.1, which is in the blocked ranges; reaching 127 133 // it would mean a workflow-defined cache can hit the host's loopback