Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions internal/commands/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,11 @@
configArr = append(configArr, SCSConfig)
}

var aiscConfig = addAiscScan(featureFlagsWrapper, resubmitConfig)
if aiscConfig != nil {
configArr = append(configArr, aiscConfig)
}

info["config"] = configArr
var err2 error
*input, err2 = json.Marshal(info)
Expand Down Expand Up @@ -1164,6 +1169,31 @@
}
}

func addAiscScan(featureFlagWrapper wrappers.FeatureFlagsWrapper, resubmitConfig []wrappers.Config) map[string]interface{} {
// TODO: Add the aisc resubmit config, currently no value is passed in config
aiSupplyChainEnabled, _ := wrappers.GetSpecificFeatureFlag(featureFlagWrapper, wrappers.AISupplyChainEnabled)
//aiSupplyChainGAEnabled, _ := wrappers.GetSpecificFeatureFlag(featureFlagWrapper, wrappers.AISupplyChainGAEnabled)

Check failure on line 1175 in internal/commands/scan.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
// TODO GA enabled to be added
if scanTypeEnabled(commonParams.AiscType) && aiSupplyChainEnabled.Status {
aiscMapConfig := make(map[string]interface{})
aiscConfig := wrappers.AISCConfig{}
aiscMapConfig[resultsMapType] = commonParams.AiscType
aiscMapConfig[resultsMapValue] = &aiscConfig

for _, config := range resubmitConfig {
// TODO : to do this in future when config value comes
if config.Type == commonParams.AiscType && config.Value == nil {
continue
}
}

return aiscMapConfig

}

Check failure on line 1192 in internal/commands/scan.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary trailing newline (whitespace)

return nil
}

func addKicsScan(cmd *cobra.Command, resubmitConfig []wrappers.Config) map[string]interface{} {
if scanTypeEnabled(commonParams.KicsType) {
kicsMapConfig := make(map[string]interface{})
Expand Down Expand Up @@ -1504,6 +1534,7 @@
scsLicensingV2Flag, _ := wrappers.GetSpecificFeatureFlag(featureFlagsWrapper, wrappers.ScsLicensingV2Enabled)

allowedEngines, err := jwtWrapper.GetAllowedEngines(featureFlagsWrapper)
logger.PrintIfVerbose(fmt.Sprintf("Allowed scan types: %v", allowedEngines))

isSbomScan, _ := cmd.PersistentFlags().GetBool(commonParams.SbomFlag)

Expand Down Expand Up @@ -2449,6 +2480,7 @@
jwtWrapper,
tenantWrapper,
)

defer cleanUpTempZip(zipFilePath)
if err != nil {
return errors.Errorf("%s", err)
Expand Down Expand Up @@ -2562,6 +2594,7 @@
scanModel := wrappers.Scan{}
// Try to parse to a scan model in order to manipulate the request payload
err = json.Unmarshal(input, &scanModel)

if err != nil {
return nil, "", errors.Wrapf(err, "%s: Input in bad format", failedCreating)
}
Expand Down
1 change: 1 addition & 0 deletions internal/params/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ const (
const (
SastType = "sast"
KicsType = "kics"
AiscType = "aisc"
APISecurityType = "api-security"
AIProtectionType = "AI Protection"
CheckmarxOneAssistType = "Checkmarx One Assist"
Expand Down
2 changes: 2 additions & 0 deletions internal/wrappers/feature-flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
const maxRetries = 3
const IncreaseFileUploadLimit = "INCREASE_FILE_UPLOAD_LIMIT"
const ScaDeltaScanEnabled = "SCA_DELTASCAN_ENABLED"
const AISupplyChainEnabled = "AI_SUPPLY_CHAIN_ENGINE_ENABLED"

Check failure on line 24 in internal/wrappers/feature-flags.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported const AISupplyChainEnabled should have comment or be unexported (revive)
const AISupplyChainGAEnabled = "AI_SUPPLY_CHAIN_ENGINE_GA_ENABLED"

Check failure on line 25 in internal/wrappers/feature-flags.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported const AISupplyChainGAEnabled should have comment or be unexported (revive)

var DefaultFFLoad bool = false

Expand Down
3 changes: 2 additions & 1 deletion internal/wrappers/jwt-helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewJwtWrapper() JWTWrapper {
}

func getEnabledEngines(scsLicensingV2 bool) (enabledEngines []string) {
enabledEngines = []string{"sast", "sca", "api-security", "iac-security", "containers"}
enabledEngines = []string{"sast", "sca", "api-security", "iac-security", "containers", "aisc"}
if scsLicensingV2 {
enabledEngines = append(enabledEngines, commonParams.RepositoryHealthType, commonParams.SecretDetectionType)
} else {
Expand All @@ -57,6 +57,7 @@ func getDefaultEngines(scsLicensingV2 bool) (defaultEngines map[string]bool) {
"api-security": true,
"iac-security": true,
"containers": true,
"aisc": true,
}
if scsLicensingV2 {
defaultEngines[commonParams.RepositoryHealthType] = true
Expand Down
3 changes: 3 additions & 0 deletions internal/wrappers/scans.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,6 @@
RepoToken string `json:"repoToken,omitempty"`
GitCommitHistory string `json:"gitCommitHistory,omitempty"`
}

type AISCConfig struct {

Check failure on line 167 in internal/wrappers/scans.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported type AISCConfig should have comment or be unexported (revive)
}
Loading