mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Minio vulnerability false positives (#21644)
This commit is contained in:
parent
9a09b52201
commit
209ee10327
3 changed files with 50 additions and 0 deletions
1
changes/21404-minio-false-positive
Normal file
1
changes/21404-minio-false-positive
Normal file
|
|
@ -0,0 +1 @@
|
|||
- resolved issue where minio was reporting false positive vulnerabilities due to a mismatch in version strings
|
||||
|
|
@ -1599,6 +1599,31 @@ func sanitizeSoftware(h *fleet.Host, s *fleet.Software, logger log.Logger) {
|
|||
s.Version = strings.Join(newParts, ".")
|
||||
},
|
||||
},
|
||||
{
|
||||
// Trim the "RELEASE." prefix from Minio versions.
|
||||
checkSoftware: func(h *fleet.Host, s *fleet.Software) bool {
|
||||
return s.Name == "minio" && strings.Contains(s.Version, "RELEASE.")
|
||||
},
|
||||
mutateSoftware: func(s *fleet.Software) {
|
||||
s.Version = strings.TrimPrefix(s.Version, "RELEASE.")
|
||||
},
|
||||
},
|
||||
{
|
||||
// Convert the timestamp to NVD's format for Minio versions.
|
||||
checkSoftware: func(h *fleet.Host, s *fleet.Software) bool {
|
||||
regex := regexp.MustCompile(`^\d{14}$`)
|
||||
|
||||
return s.Name == "minio" && regex.MatchString(s.Version)
|
||||
},
|
||||
mutateSoftware: func(s *fleet.Software) {
|
||||
timestamp, err := time.Parse("20060102150405", s.Version)
|
||||
if err != nil {
|
||||
level.Debug(logger).Log("msg", "failed to parse software version", "name", s.Name, "version", s.Version, "err", err)
|
||||
return
|
||||
}
|
||||
s.Version = timestamp.Format("2006-01-02T15-04-05Z")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, softwareSanitizer := range softwareSanitizers {
|
||||
|
|
|
|||
|
|
@ -1830,6 +1830,30 @@ func TestSanitizeSoftware(t *testing.T) {
|
|||
Version: "1.6.00.34263",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "minio",
|
||||
h: &fleet.Host{},
|
||||
s: &fleet.Software{
|
||||
Name: "minio",
|
||||
Version: "RELEASE.2022-03-10T00-00-00Z",
|
||||
},
|
||||
sanitized: &fleet.Software{
|
||||
Name: "minio",
|
||||
Version: "2022-03-10T00-00-00Z",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "minio",
|
||||
h: &fleet.Host{},
|
||||
s: &fleet.Software{
|
||||
Name: "minio",
|
||||
Version: "20200310000000",
|
||||
},
|
||||
sanitized: &fleet.Software{
|
||||
Name: "minio",
|
||||
Version: "2020-03-10T00-00-00Z",
|
||||
},
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
sanitizeSoftware(tc.h, tc.s, log.NewNopLogger())
|
||||
|
|
|
|||
Loading…
Reference in a new issue