Skip to content

Commit 5af8621

Browse files
fix for api-security-critical threshold
1 parent 6c7c56b commit 5af8621

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/commands/scan.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ func runCreateScanCommand(
24632463
return reportErr
24642464
}
24652465

2466-
err = applyThreshold(cmd, scanResponseModel, thresholdMap, risksOverviewWrapper, results)
2466+
err = applyThreshold(cmd, scanResponseModel, thresholdMap, risksOverviewWrapper, results, featureFlagsWrapper)
24672467

24682468
if err != nil {
24692469
return err
@@ -2731,6 +2731,7 @@ func applyThreshold(
27312731
thresholdMap map[string]int,
27322732
risksOverviewWrapper wrappers.RisksOverviewWrapper,
27332733
results *wrappers.ScanResultsCollection,
2734+
featureFlagsWrapper wrappers.FeatureFlagsWrapper,
27342735
) error {
27352736
if len(thresholdMap) == 0 {
27362737
return nil
@@ -2742,7 +2743,7 @@ func applyThreshold(
27422743
params[commonParams.SastRedundancyFlag] = ""
27432744
}
27442745

2745-
summaryMap, err := getSummaryThresholdMap(scanResponseModel, risksOverviewWrapper, results)
2746+
summaryMap, err := getSummaryThresholdMap(scanResponseModel, risksOverviewWrapper, results, featureFlagsWrapper)
27462747

27472748
if err != nil {
27482749
return err
@@ -2830,6 +2831,7 @@ func getSummaryThresholdMap(
28302831
scan *wrappers.ScanResponseModel,
28312832
risksOverviewWrapper wrappers.RisksOverviewWrapper,
28322833
results *wrappers.ScanResultsCollection,
2834+
featureFlagsWrapper wrappers.FeatureFlagsWrapper,
28332835
) (map[string]int, error) {
28342836
summaryMap := make(map[string]int)
28352837

@@ -2848,6 +2850,12 @@ func getSummaryThresholdMap(
28482850
summaryMap["api-security-high"] = apiSecRisks.Risks[1]
28492851
summaryMap["api-security-medium"] = apiSecRisks.Risks[2]
28502852
summaryMap["api-security-low"] = apiSecRisks.Risks[3]
2853+
2854+
flagResponse, _ := wrappers.GetSpecificFeatureFlag(featureFlagsWrapper, wrappers.CVSSV3Enabled)
2855+
criticalEnabled := flagResponse.Status
2856+
if criticalEnabled {
2857+
summaryMap["api-security-critical"] = apiSecRisks.Risks[0]
2858+
}
28512859
}
28522860
return summaryMap, nil
28532861
}

0 commit comments

Comments
 (0)