-
-
Notifications
You must be signed in to change notification settings - Fork 312
Description
Description:
In internal/operators/rbl.go:56-104:
-
Goroutine leak on timeout (confirmed): When the 500ms
time.Aftertimeout fires,Evaluate()returns anddefer cancel()cancels the context. The goroutine's DNS call (LookupHost) returns an error due to context cancellation and then tries to sendfalseon the unbufferedresCchannel (line 74). Since the main function already exited theselect, nobody is receiving — the goroutine blocks forever on the channel send and never reachesdefer close(resC). This leaks one goroutine per timed-out RBL lookup. -
No IP validation (low risk):
ipAddris directly interpolated into a DNS query viafmt.Sprintf("%s.%s", ipAddr, o.service)with aTODO validate addressat line 57. In practice the operator is typically used withREMOTE_ADDRwhich is always a valid IP from the network stack, so the risk is limited to wasted DNS lookups on malformed input.
Steps:
- Make
resCbuffered:make(chan bool, 1)so the goroutine can complete its send and exit cleanly even when the main function has already returned from theselect - Optionally validate
ipAddrwithnet.ParseIP()and returnfalseearly if invalid
Files: internal/operators/rbl.go