Search in sources :

Example 1 with OneInstallSetupConfigBuilderStrategy

use of com.mercedesbenz.sechub.domain.scan.OneInstallSetupConfigBuilderStrategy in project sechub by mercedes-benz.

the class NetsparkerProductExecutor method executeWithAdapter.

@Override
protected List<ProductResult> executeWithAdapter(SecHubExecutionContext context, ProductExecutorContext executorContext, NetsparkerInstallSetup setup, TargetRegistryInfo info) throws Exception {
    URI targetURI = info.getURI();
    if (targetURI == null) {
        /* no targets defined */
        return Collections.emptyList();
    }
    TargetType targetType = info.getTargetType();
    LOG.debug("Trigger netsparker adapter execution for target {} and setup {} ", targetType, setup);
    List<ProductResult> results = new ArrayList<>();
    /* NETSPARKER is not able to scan multiple targets */
    /*
         * special behavior, because having multiple results here, we must find former
         * result corresponding to target URI.
         */
    /* @formatter:off */
    executorContext.useFirstFormerResultHavingMetaData(NetsparkerMetaDataID.KEY_TARGET_URI, targetURI);
    NetsparkerAdapterConfig netsparkerConfig = NetsparkerConfig.builder().configure(createAdapterOptionsStrategy(context)).configure(new WebConfigBuilderStrategy(context)).configure(new OneInstallSetupConfigBuilderStrategy(setup)).setTimeToWaitForNextCheckOperationInMinutes(setup.getScanResultCheckPeriodInMinutes()).setTimeOutInMinutes(setup.getScanResultCheckTimeOutInMinutes()).setTraceID(context.getTraceLogIdAsString()).setAgentName(setup.getAgentName()).setAgentGroupName(setup.getIdentifier(targetType)).setPolicyID(setup.getDefaultPolicyId()).setLicenseID(setup.getNetsparkerLicenseId()).setTargetURI(targetURI).build();
    /* @formatter:on */
    /* execute NETSPARKER by adapter and return product result */
    String xml = netsparkerAdapter.start(netsparkerConfig, executorContext.getCallback());
    ProductResult currentProductResult = executorContext.getCurrentProductResult();
    currentProductResult.setResult(xml);
    results.add(currentProductResult);
    return results;
}
Also used : ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) OneInstallSetupConfigBuilderStrategy(com.mercedesbenz.sechub.domain.scan.OneInstallSetupConfigBuilderStrategy) TargetType(com.mercedesbenz.sechub.domain.scan.TargetType) ArrayList(java.util.ArrayList) WebConfigBuilderStrategy(com.mercedesbenz.sechub.domain.scan.WebConfigBuilderStrategy) URI(java.net.URI) NetsparkerAdapterConfig(com.mercedesbenz.sechub.adapter.netsparker.NetsparkerAdapterConfig)

Aggregations

NetsparkerAdapterConfig (com.mercedesbenz.sechub.adapter.netsparker.NetsparkerAdapterConfig)1 OneInstallSetupConfigBuilderStrategy (com.mercedesbenz.sechub.domain.scan.OneInstallSetupConfigBuilderStrategy)1 TargetType (com.mercedesbenz.sechub.domain.scan.TargetType)1 WebConfigBuilderStrategy (com.mercedesbenz.sechub.domain.scan.WebConfigBuilderStrategy)1 ProductResult (com.mercedesbenz.sechub.domain.scan.product.ProductResult)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1