Skip to content

Modern Docker Management, Designed for Everyone

fix: trust only configured TRUSTED_PROXIES for client IP extraction (#4351)

Kyle Mendellceab1a7c305b
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index 20b67c5d6..c8d08e39a 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -194,7 +194,8 @@ func newRouter(p RouterParams) (*echo.Echo, *edge.TunnelServer) {
if len(trustedProxyNets) == 0 {
e.IPExtractor = echo.ExtractIPDirect()
} else {
- opts := make([]echo.TrustOption, 0, len(trustedProxyNets))
+ // Trust only the configured ranges, not Echo's built-in loopback/link-local/private defaults.
+ opts := []echo.TrustOption{echo.TrustLoopback(false), echo.TrustLinkLocal(false), echo.TrustPrivateNet(false)}
for _, ipnet := range trustedProxyNets {
opts = append(opts, echo.TrustIPRange(ipnet))
}