feat(go): advance validation sidecar toward production
This commit is contained in:
parent
6a06eba255
commit
f85c2e831a
92 changed files with 8881 additions and 91 deletions
29
go-agent/internal/detectors/new_suid_test.go
Normal file
29
go-agent/internal/detectors/new_suid_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package detectors
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/config"
|
||||
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/model"
|
||||
)
|
||||
|
||||
func TestNewSUIDSeverityAndBaseline(t *testing.T) {
|
||||
alerts := NewSUID(model.State{
|
||||
SUIDBinaries: []string{"/tmp/evil", "/usr/local/bin/newtool", "/usr/bin/sudo"},
|
||||
SUIDBaseline: []string{"/usr/bin/sudo"},
|
||||
}, config.Default())
|
||||
if len(alerts) != 2 {
|
||||
t.Fatalf("got %#v", alerts)
|
||||
}
|
||||
if alerts[0].Severity != "CRITICAL" || alerts[1].Severity != "HIGH" {
|
||||
t.Fatalf("unexpected severities: %#v", alerts)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewSUIDWithoutScanIsSilent(t *testing.T) {
|
||||
if alerts := NewSUID(model.State{SUIDBaseline: []string{"/usr/bin/sudo"}}, config.Default()); len(alerts) != 0 {
|
||||
t.Fatalf("got %#v", alerts)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue