Search in sources :

Example 1 with ScaConfig

use of com.checkmarx.sdk.config.ScaConfig in project cx-flow by checkmarx-ltd.

the class ScaConfigurationOverrider method initScaConfig.

public void initScaConfig(ScanRequest request) {
    // Initializing something in 'overrider' is not very consistent. However, this is the only point
    // where we can initialize SCA config without having to change each controller.
    log.debug("Initializing SCA configuration in scan request using default configuration properties.");
    ScaConfig scaConfig = modelMapper.map(scaProperties, ScaConfig.class);
    request.setScaConfig(scaConfig);
    scaFilterFactory.initScaFilter(request);
}
Also used : ScaConfig(com.checkmarx.sdk.config.ScaConfig)

Example 2 with ScaConfig

use of com.checkmarx.sdk.config.ScaConfig in project cx-flow by checkmarx-ltd.

the class ScaConfigurationOverrider method overrideScanRequestProperties.

public void overrideScanRequestProperties(ScaConfig scaConfig, ScanRequest request, Map<String, String> overrideReport) {
    log.debug("Overriding SCA config in scan request.");
    ScaConfig existingScaConfig = request.getScaConfig();
    if (existingScaConfig == null) {
        log.debug("SCA config doesn't exist yet. Using the override as is.");
        request.setScaConfig(scaConfig);
    } else {
        log.debug("SCA config exists, merging.");
        modelMapper.map(scaConfig, existingScaConfig);
    }
    addToReport(scaConfig, overrideReport);
}
Also used : ScaConfig(com.checkmarx.sdk.config.ScaConfig)

Example 3 with ScaConfig

use of com.checkmarx.sdk.config.ScaConfig in project cx-flow by checkmarx-ltd.

the class ScaConfigurationOverrider method overrideScanRequestProperties.

public void overrideScanRequestProperties(Sca override, ScanRequest request, Map<String, String> overrideReport) {
    Optional<Sca> sca = Optional.ofNullable(override);
    if (!sca.isPresent()) {
        return;
    }
    ScaConfig scaConfig = request.getScaConfig();
    sca.map(Sca::getAccessControlUrl).ifPresent(accessControlUrl -> {
        scaConfig.setAccessControlUrl(accessControlUrl);
        overrideReport.put(ACCESS_CONTROL_URL, accessControlUrl);
    });
    sca.map(Sca::getApiUrl).ifPresent(apiUrl -> {
        scaConfig.setApiUrl(apiUrl);
        overrideReport.put(API_URL, apiUrl);
    });
    sca.map(Sca::getAppUrl).ifPresent(appUrl -> {
        scaConfig.setAppUrl(appUrl);
        overrideReport.put(APP_URL, appUrl);
    });
    sca.map(Sca::getTenant).ifPresent(tenant -> {
        scaConfig.setTenant(tenant);
        overrideReport.put(TENANT, tenant);
    });
    sca.map(Sca::getThresholdsSeverity).ifPresent(thresholdsSeverity -> {
        scaConfig.setThresholdsSeverityDirectly(thresholdsSeverity);
        overrideReport.put(THRESHOLDS_SEVERITY, ScanUtils.convertMapToString(thresholdsSeverity));
    });
    sca.map(Sca::getThresholdsScore).ifPresent(thresholdsScore -> {
        scaConfig.setThresholdsScore(thresholdsScore);
        overrideReport.put(THRESHOLDS_SCORE, String.valueOf(thresholdsScore));
    });
    sca.map(Sca::isIncludeSources).ifPresent(includeSources -> {
        scaConfig.setIncludeSources(includeSources);
        overrideReport.put(INCLUDE_SOURCES, String.valueOf(includeSources));
    });
    sca.map(Sca::getTeam).ifPresent(team -> {
        scaConfig.setTeam(team);
        overrideReport.put(TEAM, team);
    });
    overrideSeverityFilters(request, sca, overrideReport);
    overrideScoreFilter(request, sca, overrideReport);
}
Also used : Sca(com.checkmarx.sdk.dto.sca.Sca) ScaConfig(com.checkmarx.sdk.config.ScaConfig)

Aggregations

ScaConfig (com.checkmarx.sdk.config.ScaConfig)3 Sca (com.checkmarx.sdk.dto.sca.Sca)1