Skip to content

Commit

Permalink
Weak credentials detector (part II)
Browse files Browse the repository at this point in the history
Add the detector to the standard list of detectors.

PiperOrigin-RevId: 632560108
  • Loading branch information
SCALIBR Team authored and copybara-github committed May 13, 2024
1 parent 1fe4d11 commit b8b295f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion detector/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/google/osv-scalibr/detector/cve/cve202338408"
"github.com/google/osv-scalibr/detector"
"github.com/google/osv-scalibr/detector/govulncheck/binary"
"github.com/google/osv-scalibr/detector/weakcredentials/etcshadow"
"github.com/google/osv-scalibr/log"
)

Expand All @@ -36,16 +37,20 @@ var CVE []detector.Detector = []detector.Detector{&cve202338408.Detector{}}
// Govulncheck detectors.
var Govulncheck []detector.Detector = []detector.Detector{&binary.Detector{}}

// Weak credentials related detectors.
var Weakcreds []detector.Detector = []detector.Detector{&etcshadow.Detector{}}

// Default detectors that are recommended to be enabled.
var Default []detector.Detector = []detector.Detector{}

// All detectors internal to SCALIBR.
var All []detector.Detector = concat(CIS, CVE, Govulncheck)
var All []detector.Detector = concat(CIS, CVE, Govulncheck, Weakcreds)

var detectorNames = map[string][]detector.Detector{
"cis": CIS,
"cve": CVE,
"govulncheck": Govulncheck,
"weakcreds": Weakcreds,
"default": Default,
"all": All,
}
Expand Down
5 changes: 5 additions & 0 deletions detector/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func TestDetectorsFromNames(t *testing.T) {
names: []string{"cis"},
wantDets: []string{"cis/generic_linux/etcpasswdpermissions"},
},
{
desc: "Find weak credentials detectors",
names: []string{"weakcreds"},
wantDets: []string{"weakcredentials/etcshadow"},
},
{
desc: "Case-insensitive",
names: []string{"CIS"},
Expand Down

0 comments on commit b8b295f

Please sign in to comment.