Search in sources :

Example 6 with ScanParams

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

the class AbstractASTScanner method scan.

@Override
public ScanResults scan(ScanRequest scanRequest) {
    ScanResults result = null;
    log.info("--------------------- Initiating new {} scan ---------------------", scanType);
    ScanParams sdkScanParams = toSdkScanParams(scanRequest);
    AstScaResults internalResults = new AstScaResults(new SCAResults(), new ASTResults());
    try {
        bugTrackerEventTrigger.triggerScanStartedEvent(scanRequest);
        internalResults = client.scan(sdkScanParams);
        logRequest(scanRequest, internalResults, OperationResult.successful());
        result = toScanResults(internalResults);
    } catch (Exception e) {
        treatError(scanRequest, internalResults, e);
    }
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults) ASTResults(com.checkmarx.sdk.dto.ast.ASTResults) SCAResults(com.checkmarx.sdk.dto.sca.SCAResults) MalformedURLException(java.net.MalformedURLException) MachinaRuntimeException(com.checkmarx.flow.exception.MachinaRuntimeException)

Example 7 with ScanParams

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

the class AbstractASTScanner method scan.

public ScanResults scan(ScanRequest scanRequest, String path) throws ExitThrowable {
    BugTracker.Type bugTrackerType = bugTrackerEventTrigger.triggerScanStartedEvent(scanRequest);
    ScanResults result = null;
    if (bugTrackerType.equals(BugTracker.Type.NONE)) {
        log.info("Not waiting for scan completion as Bug Tracker type is NONE");
        ScanParams sdkScanParams = toSdkScanParams(scanRequest, path);
        client.scanWithNoWaitingToResults(sdkScanParams);
    } else {
        result = actualScan(scanRequest, path);
    }
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams)

Example 8 with ScanParams

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

the class AbstractASTScanner method getLatestScanResults.

@Override
public ScanResults getLatestScanResults(ScanRequest request) {
    ScanParams sdkScanParams = ScanParams.builder().projectName(request.getProject()).scaConfig(request.getScaConfig()).filterConfiguration(request.getFilter()).build();
    setScannerSpecificProperties(request, sdkScanParams);
    AstScaResults internalResults = client.getLatestScanResults(sdkScanParams);
    return toScanResults(internalResults);
}
Also used : ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults)

Example 9 with ScanParams

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

the class AbstractASTScanner method actualScan.

private ScanResults actualScan(ScanRequest scanRequest, String path) {
    ScanResults result = null;
    log.info("--------------------- Initiating new {} scan ---------------------", scanType);
    AstScaResults internalResults = new AstScaResults(new SCAResults(), new ASTResults());
    try {
        ScanParams sdkScanParams = toSdkScanParams(scanRequest, path);
        internalResults = client.scan(sdkScanParams);
        logRequest(scanRequest, internalResults, OperationResult.successful());
        result = toScanResults(internalResults);
    } catch (Exception e) {
        treatError(scanRequest, internalResults, e);
    }
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) AstScaResults(com.checkmarx.sdk.dto.AstScaResults) ASTResults(com.checkmarx.sdk.dto.ast.ASTResults) SCAResults(com.checkmarx.sdk.dto.sca.SCAResults) MalformedURLException(java.net.MalformedURLException) MachinaRuntimeException(com.checkmarx.flow.exception.MachinaRuntimeException)

Example 10 with ScanParams

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

the class ScaScanner method extractFilterConfigFrom.

private static EngineFilterConfiguration extractFilterConfigFrom(ScanParams scanParams) {
    EngineFilterConfiguration result = Optional.ofNullable(scanParams).map(ScanParams::getFilterConfiguration).map(FilterConfiguration::getScaFilters).orElse(null);
    String message = (result == null ? "No SCA filter configuration was found in {}" : "Found SCA filter configuration in {}");
    log.debug(message, ScanParams.class.getSimpleName());
    return result;
}
Also used : ScanParams(com.checkmarx.sdk.dto.ast.ScanParams) EngineFilterConfiguration(com.checkmarx.sdk.dto.filtering.EngineFilterConfiguration)

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