fix(security): SSRF guard gaps + DNS port restriction + metrics auth #112
Reference in New Issue
Block a user
Delete Branch "fix/security-hardening"
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?
Summary
Three security hardening fixes from the review-findings backlog.
SSRF guard now blocks 0.0.0.0/8 + CGNAT — on Linux,
http://0.0.0.0:port/routes to localhost and passed the old filter. Added0.0.0.0/8,100.64.0.0/10(CGNAT), plusip.IsUnspecified()/ip.IsMulticast()/ip.IsLoopback()for defense in depth.DNS monitor no longer bypasses SSRF guard —
DNSServerwas user-controlled with no validation. Now resolves the server address and validates againstisPrivateIP. Port restricted to 53 to prevent internal port probing. Both checks respectUPTOP_ALLOW_PRIVATE_TARGETS— when set, private DNS servers and non-53 ports are allowed./metricsdefault-deny without cluster secret —!MetricsPublic && ClusterKey != ""meant no secret = no auth = metrics exposed. Now usesrequireAuth()which returns false when no key is configured, so/metricsrequires eitherMetricsPublic=trueor a valid cluster secret.Test plan
go test -count=1 ./...— all passgolangci-lint— 0 issuesallowPrivateflag (private DNS servers work withUPTOP_ALLOW_PRIVATE_TARGETS=true)