Search in sources :

Example 1 with ScanParams

use of com.checkmarx.sdk.dto.ast.ScanParams in project cx-flow by checkmarx-ltd.

the class AbstractASTScanner method toSdkScanParams.

private ScanParams toSdkScanParams(ScanRequest scanRequest, String pathToScan) {
    ScanParams scanParams = ScanParams.builder().projectName(scanRequest.getProject()).sourceDir(pathToScan).scaConfig(scanRequest.getScaConfig()).filterConfiguration(scanRequest.getFilter()).disableCertificateValidation(scanRequest.isDisableCertificateValidation()).build();
    setScannerSpecificProperties(scanRequest, scanParams);
    return scanParams;
}
Also used : ScanParams(com.checkmarx.sdk.dto.ast.ScanParams)

Example 2 with ScanParams

use of com.checkmarx.sdk.dto.ast.ScanParams in project cx-flow by checkmarx-ltd.

the class SCAScanner method cxParseResults.

@Override
protected void cxParseResults(ScanRequest scanRequest, File file) throws ExitThrowable {
    RestClientConfig restClientConfig;
    IScanClientHelper iScanClientHelper;
    try {
        ScanParams sdkScanParams = ScanParams.builder().projectName(scanRequest.getProject()).scaConfig(scanRequest.getScaConfig()).filterConfiguration(scanRequest.getFilter()).build();
        restClientConfig = scaScannerClient.getScanConfig(sdkScanParams);
        iScanClientHelper = new ScaClientHelper(restClientConfig, log, scaProperties);
        ScanResults results = iScanClientHelper.getReportContent(file, scanRequest.getFilter());
        resultsService.processResults(scanRequest, results, scanDetails);
        if (flowProperties.isBreakBuild() && results != null && results.getXIssues() != null && !results.getXIssues().isEmpty()) {
            log.error(ERROR_BREAK_MSG);
            exit(ExitCode.BUILD_INTERRUPTED);
        }
    } catch (MachinaException | CheckmarxException e) {
        log.error("Error occurred while processing results file", e);
        exit(3);
    }
}
Also used : ScaClientHelper(com.checkmarx.sdk.utils.scanner.client.ScaClientHelper) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) ScanResults(com.checkmarx.sdk.dto.ScanResults) MachinaException(com.checkmarx.flow.exception.MachinaException) CheckmarxException(com.checkmarx.sdk.exception.CheckmarxException) IScanClientHelper(com.checkmarx.sdk.utils.scanner.client.IScanClientHelper) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig)

Example 3 with ScanParams

use of com.checkmarx.sdk.dto.ast.ScanParams in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaTest method getLatestResults.

private AstScaResults getLatestResults(RestClientConfig config) {
    ScaScanner client = getScanner();
    Assert.assertNotNull(client);
    ScanParams params = getScanParams(config);
    return client.getLatestScanResults(params);
}
Also used : ScaScanner(com.checkmarx.sdk.service.scanner.ScaScanner) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams)

Example 4 with ScanParams

use of com.checkmarx.sdk.dto.ast.ScanParams in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaTest method getScanParams.

private ScanParams getScanParams(RestClientConfig config) {
    com.checkmarx.sdk.config.ScaConfig scaConfig = new com.checkmarx.sdk.config.ScaConfig();
    scaConfig.setAccessControlUrl(scaProperties.getAccessControlUrl());
    scaConfig.setApiUrl(scaProperties.getApiUrl());
    scaConfig.setAppUrl(scaProperties.getAppUrl());
    scaConfig.setTenant(scaProperties.getTenant());
    scaConfig.setThresholdsScore(scaProperties.getThresholdsScore());
    scaConfig.setThresholdsSeverity(new HashMap<>());
    scaConfig.setThresholdsSeverityDirectly(new HashMap<>());
    ScanParams scanParams = ScanParams.builder().projectName(config.getProjectName()).remoteRepoUrl(getRepoUrl()).scaConfig(scaConfig).build();
    return scanParams;
}
Also used : ScaConfig(com.checkmarx.sdk.dto.sca.ScaConfig) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) com.checkmarx.sdk.config(com.checkmarx.sdk.config)

Example 5 with ScanParams

use of com.checkmarx.sdk.dto.ast.ScanParams in project cx-flow by checkmarx-ltd.

the class AbstractASTScanner method toSdkScanParams.

private ScanParams toSdkScanParams(ScanRequest scanRequest) {
    URL parsedUrl = getRepoUrl(scanRequest);
    ScanParams scanParams = ScanParams.builder().branch(scanRequest.getBranch()).projectName(scanRequest.getProject()).remoteRepoUrl(parsedUrl).scaConfig(scanRequest.getScaConfig()).filterConfiguration(scanRequest.getFilter()).build();
    setScannerSpecificProperties(scanRequest, scanParams);
    return scanParams;
}
Also used : ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) URL(java.net.URL)

Aggregations

ScanParams (com.checkmarx.sdk.dto.ast.ScanParams)10 ScanResults (com.checkmarx.sdk.dto.ScanResults)4 AstScaResults (com.checkmarx.sdk.dto.AstScaResults)3 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)2 ASTResults (com.checkmarx.sdk.dto.ast.ASTResults)2 SCAResults (com.checkmarx.sdk.dto.sca.SCAResults)2 MalformedURLException (java.net.MalformedURLException)2 MachinaException (com.checkmarx.flow.exception.MachinaException)1 com.checkmarx.sdk.config (com.checkmarx.sdk.config)1 RestClientConfig (com.checkmarx.sdk.config.RestClientConfig)1 EngineFilterConfiguration (com.checkmarx.sdk.dto.filtering.EngineFilterConfiguration)1 ScaConfig (com.checkmarx.sdk.dto.sca.ScaConfig)1 CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)1 ScaScanner (com.checkmarx.sdk.service.scanner.ScaScanner)1 IScanClientHelper (com.checkmarx.sdk.utils.scanner.client.IScanClientHelper)1 ScaClientHelper (com.checkmarx.sdk.utils.scanner.client.ScaClientHelper)1 URL (java.net.URL)1