Keep the SSRF-safe Transport in clientForConfig when a per-target timeout is set #69
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the road to 1.0 (see #33).
The delivery engine's shared HTTP client uses an SSRF-safe dialer (
NewSSRFSafeTransport,internal/delivery/ssrf.go, wired ontoe.client). HoweverclientForConfig()(internal/delivery/engine.go) constructs a freshhttp.Clientthat does not carry that Transport when a per-target timeout is configured, which bypasses the request-time private-IP guard for that path.This is currently latent — the UI does not expose a per-target timeout — but it is a real bypass if a target config ever carries one, so it should be closed before 1.0.
Definition of done:
clientForConfig()builds its client on top of the SSRF-safe Transport, overriding only the timeoutImplementation instructions
Confine this change to
internal/delivery/ONLY (engine.goplus a delivery-package test). Do not touch handlers or server code.The problem: the engine's shared client uses an SSRF-safe transport (
NewSSRFSafeTransportininternal/delivery/ssrf.go).clientForConfig()ininternal/delivery/engine.gobuilds a freshhttp.ClientWITHOUT that transport when a per-target timeout is configured, bypassing the request-time private-IP guard for that path.Fix:
clientForConfig()build its client on top of the SSRF-safe transport (reuse the same transport the sharede.clientuses), overriding only theTimeoutDefinition of done:
clientForConfig()for a config that sets a per-target timeout still refuses connections to private/reserved/link-local addresses (covered by a test)Gates and process:
make fmtbefore committingdocker build .(must exit 0; host Go 1.25 vs go.mod 1.26, so Docker is the gate)mainnamedissue-69-ssrf-client-timeout; commit subject ends with(closes #69)main) and comment on it with the diff summary and thedocker build .result