Search in sources :

Example 1 with IScanClientHelper

use of com.checkmarx.sdk.utils.scanner.client.IScanClientHelper 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 2 with IScanClientHelper

use of com.checkmarx.sdk.utils.scanner.client.IScanClientHelper in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ScaScanner method getLatestScanResults.

public AstScaResults getLatestScanResults(ScanParams scanParams) {
    RestClientConfig config = getScanConfig(scanParams);
    try {
        IScanClientHelper client = allocateClient(config);
        client.init();
        ResultsBase results = client.getLatestScanResults();
        AstScaResults result;
        if (results != null) {
            result = toResults(results);
            applyFilterToResults(result, scanParams);
        } else {
            result = new AstScaResults();
        }
        return result;
    } catch (Exception e) {
        throw new ScannerRuntimeException("Error getting latest scan results.", e);
    }
}
Also used : IScanClientHelper(com.checkmarx.sdk.utils.scanner.client.IScanClientHelper) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig) ScannerRuntimeException(com.checkmarx.sdk.exception.ScannerRuntimeException) ScannerRuntimeException(com.checkmarx.sdk.exception.ScannerRuntimeException)

Aggregations

RestClientConfig (com.checkmarx.sdk.config.RestClientConfig)2 IScanClientHelper (com.checkmarx.sdk.utils.scanner.client.IScanClientHelper)2 MachinaException (com.checkmarx.flow.exception.MachinaException)1 ScanResults (com.checkmarx.sdk.dto.ScanResults)1 ScanParams (com.checkmarx.sdk.dto.ast.ScanParams)1 CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)1 ScannerRuntimeException (com.checkmarx.sdk.exception.ScannerRuntimeException)1 ScaClientHelper (com.checkmarx.sdk.utils.scanner.client.ScaClientHelper)1