From f628e24f58f19bc3f247664ee46a8971fbdb5e38 Mon Sep 17 00:00:00 2001 From: d3m0k1d Date: Thu, 19 Feb 2026 11:03:52 +0300 Subject: [PATCH] fix: golangci fix --- internal/blocker/firewalld.go | 3 ++- internal/blocker/iptables.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/blocker/firewalld.go b/internal/blocker/firewalld.go index 2a0ba1b..30a21d4 100644 --- a/internal/blocker/firewalld.go +++ b/internal/blocker/firewalld.go @@ -23,6 +23,7 @@ func (f *Firewalld) Ban(ip string) error { if err != nil { return err } + // #nosec G204 - ip is validated cmd := exec.Command("firewall-cmd", "--zone=drop", "--add-source", ip, "--permanent") output, err := cmd.CombinedOutput() if err != nil { @@ -61,7 +62,7 @@ func (f *Firewalld) Unban(ip string) error { } func (f *Firewalld) PortOpen(port int, protocol string) error { - // #nosec G204 - handle is extracted from nftables output and validated + // #nosec G204 - handle is extracted from Firewalld output and validated if port >= 0 && port <= 65535 { if protocol != "tcp" && protocol != "udp" { f.logger.Error("invalid protocol") diff --git a/internal/blocker/iptables.go b/internal/blocker/iptables.go index d37dc2e..83421f5 100644 --- a/internal/blocker/iptables.go +++ b/internal/blocker/iptables.go @@ -28,6 +28,7 @@ func (f *Iptables) Ban(ip string) error { if err != nil { return err } + // #nosec G204 - f.config is validated above via validateConfigPath() cmd := exec.Command("iptables", "-A", "INPUT", "-s", ip, "-j", "DROP") output, err := cmd.CombinedOutput() if err != nil { @@ -70,6 +71,7 @@ func (f *Iptables) Unban(ip string) error { if err != nil { return err } + // #nosec G204 - f.config is validated above via validateConfigPath() cmd := exec.Command("iptables", "-D", "INPUT", "-s", ip, "-j", "DROP") output, err := cmd.CombinedOutput() if err != nil {