Search in sources :

Example 51 with ScanRequest

use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.

the class CxConfigSteps method processScanResultsInCxFlow.

private void processScanResultsInCxFlow() throws InterruptedException {
    try {
        ScanRequest scanRequest = createScanRequest();
        CompletableFuture<ScanResults> task = resultsService.processScanResultsAsync(scanRequest, 0, 0, null, null);
        task.get(1, TimeUnit.MINUTES);
    } catch (MachinaException | ExecutionException | TimeoutException e) {
        String message = "Error processing scan results.";
        log.error(message, e);
        Assert.fail(message);
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) ScanResults(com.checkmarx.sdk.dto.ScanResults) MachinaException(com.checkmarx.flow.exception.MachinaException) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Example 52 with ScanRequest

use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.

the class CxConfigSteps method createScanRequest.

private ScanRequest createScanRequest() {
    ScanRequest scanRequest = new ScanRequest();
    scanRequest.setProduct(ScanRequest.Product.CX);
    scanRequest.setBugTracker(BugTracker.builder().type(BugTracker.Type.GITHUBPULL).build());
    scanRequest.setMergeNoteUri(MERGE_NOTE_URL);
    scanRequest.setRepoType(ScanRequest.Repository.GITHUB);
    HashMap<String, String> additionalMetdata = new HashMap<>();
    additionalMetdata.put("statuses_url", PULL_REQUEST_STATUSES_URL);
    scanRequest.setAdditionalMetadata(additionalMetdata);
    scanRequest.setThresholds(request.getThresholds());
    return scanRequest;
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest)

Example 53 with ScanRequest

use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.

the class RunPublishProcessSteps method publishTwoIssues.

@When("there are two existing issues")
public void publishTwoIssues() throws IOException, ExitThrowable {
    ScanRequest request = getScanRequestWithDefaults();
    File findingsFile = getFileFromResourcePath("cucumber/data/sample-sast-results/2-findings-different-vuln-type-different-files.xml");
    innerPublishRequest(request, findingsFile);
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) File(java.io.File) When(io.cucumber.java.en.When)

Example 54 with ScanRequest

use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.

the class PublishingSteps method publishingTheReport.

@When("^publishing (?:the|a SAST) report$")
public void publishingTheReport() throws Exception, ExitThrowable {
    ScanRequest request = prepareScanRequest();
    String sastReportPath = Paths.get(Constants.SAMPLE_SAST_RESULTS_DIR, sastReportFilename).toString();
    File sastReport = TestUtils.getFileFromResource(sastReportPath);
    try {
        sastScanner.cxParseResults(request, sastReport);
    } catch (Throwable e) {
        if (expectingException) {
            lastCxFlowException = e;
        } else {
            throw e;
        }
    }
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) ExitThrowable(com.checkmarx.flow.exception.ExitThrowable) File(java.io.File) When(io.cucumber.java.en.When)

Example 55 with ScanRequest

use of com.checkmarx.flow.dto.ScanRequest in project cx-flow by checkmarx-ltd.

the class GitLabServiceTest method getSources.

@IfProfileValue(name = "testprofile", value = "integration")
@Test
public void getSources() {
    ScanRequest request = ScanRequest.builder().namespace("custodela-test").repoName("WebGoat").branch("develop").build();
    request.setRepoProjectId(11842418);
    Sources sources = service.getRepoContent(request);
    assertNotNull(sources);
}
Also used : ScanRequest(com.checkmarx.flow.dto.ScanRequest) Sources(com.checkmarx.flow.dto.Sources) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Aggregations

ScanRequest (com.checkmarx.flow.dto.ScanRequest)68 BugTracker (com.checkmarx.flow.dto.BugTracker)24 ScanResults (com.checkmarx.sdk.dto.ScanResults)20 When (io.cucumber.java.en.When)14 FilterConfiguration (com.checkmarx.sdk.dto.filtering.FilterConfiguration)12 MachinaException (com.checkmarx.flow.exception.MachinaException)11 CxConfig (com.checkmarx.sdk.dto.sast.CxConfig)11 Test (org.junit.Test)11 File (java.io.File)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 Issue (com.checkmarx.flow.dto.Issue)5 MachinaRuntimeException (com.checkmarx.flow.exception.MachinaRuntimeException)5 IOException (java.io.IOException)5 ExecutionException (java.util.concurrent.ExecutionException)5 TimeoutException (java.util.concurrent.TimeoutException)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 IfProfileValue (org.springframework.test.annotation.IfProfileValue)4 EventResponse (com.checkmarx.flow.dto.EventResponse)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 FlowProperties (com.checkmarx.flow.config.FlowProperties)2