mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
erase repetitive frameworks
This commit is contained in:
@@ -50,7 +50,11 @@ func (armoAPI *ArmoAPI) GetCustomFrameworksForCustomer(customerGUID string) ([]s
|
||||
err = json.Unmarshal([]byte(respStr), &frs)
|
||||
|
||||
for _, fr := range frs {
|
||||
frameworkList = append(frameworkList, fr.Name)
|
||||
if isNativeFramework(fr.Name) {
|
||||
frameworkList = append(frameworkList, strings.ToLower(fr.Name))
|
||||
} else {
|
||||
frameworkList = append(frameworkList, fr.Name)
|
||||
}
|
||||
}
|
||||
|
||||
return frameworkList, nil
|
||||
|
||||
+16
-4
@@ -196,10 +196,22 @@ func Submit(submitInterfaces cliinterfaces.SubmitInterfaces) error {
|
||||
|
||||
func SetScanForGivenFrameworks(scanInfo *cautils.ScanInfo, frameworks []string) *cautils.ScanInfo {
|
||||
for _, framework := range frameworks {
|
||||
newPolicy := reporthandling.PolicyIdentifier{}
|
||||
newPolicy.Kind = reporthandling.KindFramework
|
||||
newPolicy.Name = framework
|
||||
scanInfo.PolicyIdentifier = append(scanInfo.PolicyIdentifier, newPolicy)
|
||||
|
||||
if !contains(scanInfo, framework) {
|
||||
newPolicy := reporthandling.PolicyIdentifier{}
|
||||
newPolicy.Kind = reporthandling.KindFramework
|
||||
newPolicy.Name = framework
|
||||
scanInfo.PolicyIdentifier = append(scanInfo.PolicyIdentifier, newPolicy)
|
||||
}
|
||||
}
|
||||
return scanInfo
|
||||
}
|
||||
|
||||
func contains(scanInfo *cautils.ScanInfo, framework string) bool {
|
||||
for _, policy := range scanInfo.PolicyIdentifier {
|
||||
if policy.Name == framework {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user