Files
BanForge/internal/blocker/validators.go
d3m0k1d 7c0bdc2dfa
All checks were successful
CI.yml / build (push) Successful in 55s
fix(security): fix gosec G204 warnings
- 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.
2026-01-11 22:41:27 +03:00

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
}