Skip to content

Commit 6912b76

Browse files
committed
feat: add finding severity and validate in tests
Made-with: Cursor
1 parent 2ec30cc commit 6912b76

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

internal/scanner/scanner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ type Resource struct {
88
type Finding struct {
99
Resource string `json:"resource"`
1010
Rule string `json:"rule"`
11+
Severity string `json:"severity"`
1112
}
1213

1314
func Scan(resources []Resource) []Finding {
1415
var findings []Finding
1516
for _, r := range resources {
1617
if r.Public {
17-
findings = append(findings, Finding{Resource: r.Name, Rule: "no-public-resource"})
18+
findings = append(findings, Finding{Resource: r.Name, Rule: "no-public-resource", Severity: "high"})
1819
}
1920
}
2021
return findings

internal/scanner/scanner_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ func TestScanFindsPublicResources(t *testing.T) {
88
if len(findings) != 1 {
99
t.Fatalf("expected 1 finding, got %d", len(findings))
1010
}
11+
if findings[0].Severity != "high" {
12+
t.Fatalf("expected high severity, got %s", findings[0].Severity)
13+
}
1114
}

0 commit comments

Comments
 (0)