@@ -46,6 +46,7 @@ type whitesource interface {
46
46
GetProjectVulnerabilityReport (projectToken string , format string ) ([]byte , error )
47
47
GetProjectAlerts (projectToken string ) ([]ws.Alert , error )
48
48
GetProjectAlertsByType (projectToken , alertType string ) ([]ws.Alert , error )
49
+ GetProjectIgnoredAlertsByType (projectToken string , alertType string ) ([]ws.Alert , error )
49
50
GetProjectLibraryLocations (projectToken string ) ([]ws.Library , error )
50
51
GetProjectHierarchy (projectToken string , includeInHouse bool ) ([]ws.Library , error )
51
52
}
@@ -511,6 +512,14 @@ func checkPolicyViolations(ctx context.Context, config *ScanOptions, scan *ws.Sc
511
512
if err != nil {
512
513
return piperutils.Path {}, fmt .Errorf ("failed to retrieve project policy alerts from WhiteSource: %w" , err )
513
514
}
515
+
516
+ ignoredAlerts , err := sys .GetProjectIgnoredAlertsByType (project .Token , "REJECTED_BY_POLICY_RESOURCE" )
517
+ if err != nil {
518
+ return piperutils.Path {}, fmt .Errorf ("failed to retrieve project policy ignored alerts from WhiteSource: %w" , err )
519
+ }
520
+
521
+ alerts = append (alerts , ignoredAlerts ... )
522
+
514
523
policyViolationCount += len (alerts )
515
524
allAlerts = append (allAlerts , alerts ... )
516
525
}
@@ -802,6 +811,13 @@ func checkProjectSecurityViolations(config *ScanOptions, cvssSeverityLimit float
802
811
return 0 , alerts , assessedAlerts , fmt .Errorf ("failed to retrieve project alerts from WhiteSource: %w" , err )
803
812
}
804
813
814
+ ignoredAlerts , err := sys .GetProjectIgnoredAlertsByType (project .Token , "SECURITY_VULNERABILITY" )
815
+ if err != nil {
816
+ return 0 , alerts , assessedAlerts , fmt .Errorf ("failed to retrieve project ignored alerts from WhiteSource: %w" , err )
817
+ }
818
+
819
+ alerts = append (alerts , ignoredAlerts ... )
820
+
805
821
// filter alerts related to existing assessments
806
822
filteredAlerts := []ws.Alert {}
807
823
if assessments != nil && len (* assessments ) > 0 {
@@ -887,6 +903,14 @@ func aggregateVersionWideVulnerabilities(config *ScanOptions, utils whitesourceU
887
903
if err != nil {
888
904
return errors .Wrapf (err , "failed to get project alerts by type" )
889
905
}
906
+
907
+ ignoredAlerts , err := sys .GetProjectIgnoredAlertsByType (project .Token , "SECURITY_VULNERABILITY" )
908
+ if err != nil {
909
+ return errors .Wrapf (err , "failed to get project ignored alerts by type" )
910
+ }
911
+
912
+ alerts = append (alerts , ignoredAlerts ... )
913
+
890
914
log .Entry ().Infof ("Found project: %s with %v vulnerabilities." , project .Name , len (alerts ))
891
915
versionWideAlerts = append (versionWideAlerts , alerts ... )
892
916
}
0 commit comments