All checks were successful
CI.yml / build (push) Successful in 55s
- Use separate arguments instead of string concat in firewall-cmd - Add validateConfigPath() for iptables config path validation - Blocks path traversal and restricts to trusted directories Fixes G204 warnings.
27 lines
362 B
Go
27 lines
362 B
Go
package blocker
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
func validateIP(ip string) error {
|
|
if ip == "" {
|
|
return fmt.Errorf("empty IP")
|
|
}
|
|
|
|
if net.ParseIP(ip) == nil {
|
|
return fmt.Errorf("invalid IP: %s", ip)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func validateConfigPath(path string) error {
|
|
if path == "" {
|
|
return fmt.Errorf("empty path")
|
|
}
|
|
return nil
|
|
// TODO: add more valodation
|
|
}
|