From f50215da8318339855dd01ce51386ca2c9683bd9 Mon Sep 17 00:00:00 2001 From: Hamid <94196804+hamidonos@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:16:16 +0200 Subject: [PATCH] Feature migrate usage in system test to new open api module #3239 (#3366) * move default sechub client to new open api module * migrate systemtest to new open api module #3239 * merge develop branch #3239 * revert changes in AnonymousUserRequestNewApiTokenRestController #3239 * change from #!/usr/bin/bash to #!/bin/bash in shell files #3239 * change from #!/usr/bin/bash to #!/bin/bash in shell files #3239 * moved deletion of projects and profile from SystemTestRuntime into finally block * moved deletion of projects and profile from SystemTestRuntime into finally block * temp * Refactored import path #3395 * temp * Removed SystemSupport for ArchUnit #3395 * Removed predefined import options #3395 * temp * add enabled field to ProductExecutionProfile * temp * temp * store sechub result file in test folder * Replaced package import through path import and ignore JAR import #3395 * Ignore generated API in coding rules #3395 * fix openapi.yaml * reconfigure pr action events * revert pr hooks in gh actions * remove unnecessary runtime exception * pr fixes * pr fixes * pr fixes * pr fixes * pr fixes --------- Co-authored-by: Laura Co-authored-by: Jan Winz --- build.gradle | 2 +- .../scan/__test__/integrationtest/01-start.sh | 2 +- .../integrationtest/03-init_sechub_data.sh | 2 +- .../scan/__test__/integrationtest/05-stop.sh | 2 +- .../__test__/integrationtest/start_pds.sh | 2 +- .../integrationtest/start_sechub_server.sh | 2 +- .../scan/__test__/integrationtest/stop_pds.sh | 2 +- .../integrationtest/stop_sechub_server.sh | 2 +- .../test-scripts/pds-codescan-demo-green.sh | 2 +- .../test-scripts/pds-codescan-demo-red.sh | 2 +- .../test-scripts/pds-codescan-demo-yellow.sh | 2 +- .../pds-licensescan-demo-green.sh | 2 +- .../pds-secretscan-demo-yellow.sh | 2 +- .../test-scripts/pds-webscan-demo-red.sh | 2 +- .../integrationtest/wait_server_alive.sh | 2 +- gradle/libraries.gradle | 19 +- ...sUserRequestNewApiTokenRestController.java | 10 +- .../code/Shell/single_line_comment.sh | 2 +- sechub-api-java/README.adoc | 2 +- ...lient.java => OldDefaultSecHubClient.java} | 8 +- .../src/main/resources/reduced-openapi3.json | 153 +++++++- .../api/DefaultSechubClientWireMockTest.java | 2 +- .../InternalAccessModelFileGenerator.java | 4 +- .../generator/PublicModelFileGenerator.java | 10 +- sechub-cli/build_go.sh | 2 +- sechub-commons-model/build.gradle | 2 +- .../scripts/container/postgres/stop.sh | 2 +- sechub-developertools/scripts/sdc.sh | 2 + .../postgres/LocalTestPostgreSQLStarter.java | 2 +- .../SchedulerRestControllerRestDocTest.java | 8 +- .../demo/SecHubJavaApiDemoApplication.java | 4 +- sechub-openapi-java-client/build.gradle | 30 +- .../sechub/api/AbstractSecHubClient.java | 124 ++++++ .../sechub/api/ApiClientBuilder.java | 93 +++++ .../sechub/api/DefaultSecHubClient.java | 262 +++++++++++++ .../api/MultiPartBodyPublisherBuilder.java | 154 ++++++++ .../sechub/api/MultiPartData.java | 100 +++++ .../sechub/api/MultiPartType.java | 14 + .../sechub/api/ScanSecHubReportLoader.java | 30 ++ .../mercedesbenz/sechub/api/SecHubClient.java | 100 +++++ .../sechub/api/SecHubClientException.java | 16 + .../sechub/api/SecHubClientListener.java | 24 ++ .../api/SecHubExecutionWorkaroundApi.java | 369 ++++++++++++++++++ .../sechub/api/SecHubReportException.java | 11 + .../src/main/resources/openapi.yaml | 296 +++++++++----- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- .../50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../checkmarx/docker/scripts/checkmarx.sh | 2 +- .../docker/scripts/checkmarx_mock.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../docker/findsecbugs_sechub.sh | 2 +- .../docker/scripts/findsecuritybugs.sh | 2 +- .../tests/download_test_files.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../gitleaks/tests/clone_repo.sh | 2 +- .../gitleaks/tests/copy_sanitycheck_files.sh | 2 +- .../gosec/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../gosec/50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../gosec/tests/clone_repo.sh | 2 +- .../gosec/tests/copy_sanitycheck_files.sh | 2 +- .../iac/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- sechub-pds-solutions/iac/20-push-image.sh | 2 +- .../iac/50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- sechub-pds-solutions/iac/tests/clone_repo.sh | 2 +- .../iac/tests/copy_sanitycheck_files.sh | 2 +- .../loc/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- .../loc/50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../loc/docker/scripts/cloc.sh | 2 +- .../multi/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../multi/50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../multi/tests/clone_repo.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../owaspzap/70-test-webscan.sh | 2 +- .../owaspzap/docker/scripts/owasp-zap.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../pds-base/10-create-image.sh | 2 +- .../pds-base/20-push-image.sh | 2 +- .../pds-base/docker/scripts/pds.sh | 2 +- .../pds-base/tests/start_pds_helper.sh | 2 +- .../phan/01-start-single-docker-compose.sh | 2 +- .../pmd/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- .../prepare/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../prepare/docker/scripts/prepare.sh | 2 +- .../prepare/docker/scripts/prepare_mock.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- .../50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- .../scancode/docker/scripts/scancode.sh | 2 +- .../scancode/docker/scripts/scancode_mock.sh | 2 +- .../scancode/test/generate/generate.sh | 2 +- sechub-pds-solutions/scancode/test/prepare.sh | 2 +- .../tern/01-start-single-docker-compose.sh | 2 +- .../tern/01-stop-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- .../01-stop-single-docker-compose.sh | 2 +- .../tern/docker/scripts/tern.sh | 2 +- .../tern/tests/alpine-build-run.sh | 2 +- sechub-pds-solutions/tern/tests/build-run.sh | 2 +- .../tern/tests/debian-build-run.sh | 2 +- .../tern/tests/minimal-build-run.sh | 2 +- .../tern/tests/minimal-go-build-run.sh | 2 +- sechub-pds-solutions/tern/tests/run-suite.sh | 2 +- sechub-pds-solutions/tern/tests/test-tern.sh | 2 +- .../xray/01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../xray/docker/scripts/xray.sh | 2 +- sechub-pds/src/main/resources/application.yml | 10 +- .../CreateProductExecutorConfigService.java | 2 +- ...roductExecutionrProfileValidationImpl.java | 2 +- .../product/config/ProductExecutorConfig.java | 16 +- .../ProductExecutorConfigRestController.java | 2 +- .../schedule/SchedulerRestController.java | 10 +- .../src/main/resources/application.yml | 10 +- .../01-start-single-docker-compose-alpine.sh | 2 +- .../01-start-single-docker-compose-fedora.sh | 2 +- .../01-start-single-docker-compose-prepare.sh | 2 +- .../01-start-single-docker-compose-rocky.sh | 2 +- .../01-start-single-docker-compose-ubuntu.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- .../01-stop-single-docker-compose.sh | 2 +- sechub-solution/10-create-image-alpine.sh | 2 +- sechub-solution/10-create-image-debian.sh | 2 +- sechub-solution/20-push-image.sh | 2 +- .../50-start-multiple-docker-compose.sh | 2 +- ...-multiple-object-storage-docker-compose.sh | 2 +- sechub-solution/docker/clone.sh | 2 +- .../setup-pds/8800-setup-project-and-user.sh | 2 +- .../8801-create-executor-and-profile.sh | 2 +- .../8802-assign-profile-to-project.sh | 2 +- sechub-solution/setup-pds/8900-helper.sh | 2 +- sechub-solution/setup-pds/8901-check-setup.sh | 2 +- sechub-solution/setup-pds/setup-bandit.sh | 2 +- .../setup-pds/setup-checkmarx-mock.sh | 2 +- sechub-solution/setup-pds/setup-checkmarx.sh | 2 +- sechub-solution/setup-pds/setup-cloc.sh | 2 +- .../setup-pds/setup-findsecuritybugs.sh | 2 +- sechub-solution/setup-pds/setup-flawfinder.sh | 2 +- sechub-solution/setup-pds/setup-gitleaks.sh | 2 +- sechub-solution/setup-pds/setup-gosec.sh | 2 +- sechub-solution/setup-pds/setup-kics.sh | 2 +- sechub-solution/setup-pds/setup-mobsfscan.sh | 2 +- sechub-solution/setup-pds/setup-njsscan.sh | 2 +- sechub-solution/setup-pds/setup-owasp-zap.sh | 2 +- sechub-solution/setup-pds/setup-pmd.sh | 2 +- .../setup-pds/setup-prepare-mock.sh | 2 +- sechub-solution/setup-pds/setup-prepare.sh | 2 +- sechub-solution/setup-pds/setup-scancode.sh | 2 +- sechub-solution/setup-pds/setup-tern-mock.sh | 2 +- sechub-solution/setup-pds/setup-tern.sh | 2 +- sechub-solution/setup-pds/setup-xray-mock.sh | 2 +- sechub-solution/setup-pds/setup-xray.sh | 2 +- .../resource-analyzer/record-resources.sh | 2 +- sechub-systemtest/build.gradle | 2 +- .../config/AssertSechubResultDefinition.java | 2 +- .../config/RunSecHubJobDefinition.java | 12 +- .../RunSecHubJobDefinitionTransformer.java | 16 +- .../SystemTestConfigurationBuilder.java | 124 +++--- .../ArtifactStorageSecHubClientListener.java | 6 +- .../systemtest/runtime/SystemTestRuntime.java | 1 + .../runtime/SystemTestRuntimeMetaData.java | 2 +- ...RuntimeLocalSecHubProductConfigurator.java | 153 +++++--- .../SystemTestRuntimeContextHealthCheck.java | 75 ++-- .../init/SystemTestRuntimePreparator.java | 24 +- .../SystemTestRuntimeProductLauncher.java | 31 +- .../SystemTestRuntimeTestAssertion.java | 7 +- .../SystemTestRuntimeTestEngine.java | 80 ++-- .../SystemTestFrameworkIntTest.java | 2 +- ...RunSecHubJobDefinitionTransformerTest.java | 69 ++-- .../config/SystemTestConfigurationTest.java | 16 +- .../SystemTestRuntimePreparatorTest.java | 59 +-- .../SystemTestRuntimeTestEngineTest.java | 52 +-- .../expected-output/sechub-result1.json | 27 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- ...op-single-sechub-network-docker-compose.sh | 2 +- .../01-start-single-docker-compose-alpine.sh | 2 +- .../01-start-single-docker-compose-fedora.sh | 2 +- .../01-start-single-docker-compose-rocky.sh | 2 +- .../01-start-single-docker-compose-ubuntu.sh | 2 +- .../01-start-single-docker-compose.sh | 2 +- .../01-stop-single-docker-compose.sh | 2 +- ...if2Sereco2ScanSecHubReportLoaderTest.java} | 2 +- .../01-start-single-docker-compose.sh | 2 +- ...rt-single-sechub-network-docker-compose.sh | 2 +- sechub-webui-solution/10-create-image.sh | 2 +- sechub-webui-solution/20-push-image.sh | 2 +- .../sechubaccess/SecHubAccessService.java | 4 +- 222 files changed, 2298 insertions(+), 701 deletions(-) rename sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/{DefaultSecHubClient.java => OldDefaultSecHubClient.java} (98%) create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/AbstractSecHubClient.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ApiClientBuilder.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartBodyPublisherBuilder.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartData.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartType.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ScanSecHubReportLoader.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClient.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientException.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientListener.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubExecutionWorkaroundApi.java create mode 100644 sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubReportException.java rename sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/{Sarif2Sereco2SecHubReportTest.java => Sarif2Sereco2ScanSecHubReportLoaderTest.java} (98%) diff --git a/build.gradle b/build.gradle index e346a2e368..6c2efa58ce 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ plugins { id 'org.asciidoctor.jvm.pdf' version '3.3.2' // open api - id 'org.openapi.generator' version '7.7.0' + id 'org.openapi.generator' version '7.8.0' // spring id 'org.springframework.boot' version '3.2.2' apply false diff --git a/github-actions/scan/__test__/integrationtest/01-start.sh b/github-actions/scan/__test__/integrationtest/01-start.sh index 73d376f14c..eabeee56eb 100755 --- a/github-actions/scan/__test__/integrationtest/01-start.sh +++ b/github-actions/scan/__test__/integrationtest/01-start.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT set -e diff --git a/github-actions/scan/__test__/integrationtest/03-init_sechub_data.sh b/github-actions/scan/__test__/integrationtest/03-init_sechub_data.sh index d5ed43d9c7..6e809dd58b 100755 --- a/github-actions/scan/__test__/integrationtest/03-init_sechub_data.sh +++ b/github-actions/scan/__test__/integrationtest/03-init_sechub_data.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT set -e diff --git a/github-actions/scan/__test__/integrationtest/05-stop.sh b/github-actions/scan/__test__/integrationtest/05-stop.sh index 6611839d87..1856f27f1f 100755 --- a/github-actions/scan/__test__/integrationtest/05-stop.sh +++ b/github-actions/scan/__test__/integrationtest/05-stop.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT set -e diff --git a/github-actions/scan/__test__/integrationtest/start_pds.sh b/github-actions/scan/__test__/integrationtest/start_pds.sh index cf75555b61..bb81852f16 100755 --- a/github-actions/scan/__test__/integrationtest/start_pds.sh +++ b/github-actions/scan/__test__/integrationtest/start_pds.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT SERVER_PORT=$1 diff --git a/github-actions/scan/__test__/integrationtest/start_sechub_server.sh b/github-actions/scan/__test__/integrationtest/start_sechub_server.sh index 0afd84040a..578e8e8d56 100755 --- a/github-actions/scan/__test__/integrationtest/start_sechub_server.sh +++ b/github-actions/scan/__test__/integrationtest/start_sechub_server.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT SERVER_PORT=$1 diff --git a/github-actions/scan/__test__/integrationtest/stop_pds.sh b/github-actions/scan/__test__/integrationtest/stop_pds.sh index 2aeffd78ed..99fac5c60d 100755 --- a/github-actions/scan/__test__/integrationtest/stop_pds.sh +++ b/github-actions/scan/__test__/integrationtest/stop_pds.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # $1 = server port diff --git a/github-actions/scan/__test__/integrationtest/stop_sechub_server.sh b/github-actions/scan/__test__/integrationtest/stop_sechub_server.sh index 3657ac0208..cc4beb35e7 100755 --- a/github-actions/scan/__test__/integrationtest/stop_sechub_server.sh +++ b/github-actions/scan/__test__/integrationtest/stop_sechub_server.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # $1 = server port diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-green.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-green.sh index d840e1e11f..693bc68174 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-green.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-green.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT echo "#PDS_INTTEST_PRODUCT_CODESCAN diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-red.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-red.sh index 96681b4a15..74298bba18 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-red.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-red.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT echo "#PDS_INTTEST_PRODUCT_CODESCAN diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-yellow.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-yellow.sh index 8f017034df..6c314209fe 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-yellow.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-codescan-demo-yellow.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT echo "#PDS_INTTEST_PRODUCT_CODESCAN diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-licensescan-demo-green.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-licensescan-demo-green.sh index ce74d7de5a..7f0fc30bc3 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-licensescan-demo-green.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-licensescan-demo-green.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cat "__test__/integrationtest/test-product-output/example-scancode-spdx-output.json" > "${PDS_JOB_RESULT_FILE}" \ No newline at end of file diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-secretscan-demo-yellow.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-secretscan-demo-yellow.sh index 9d70ae987d..1ba3798f68 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-secretscan-demo-yellow.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-secretscan-demo-yellow.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cat "__test__/integrationtest/test-product-output/example-gitleaks-sarif-output-yellow.json" > "${PDS_JOB_RESULT_FILE}" \ No newline at end of file diff --git a/github-actions/scan/__test__/integrationtest/test-scripts/pds-webscan-demo-red.sh b/github-actions/scan/__test__/integrationtest/test-scripts/pds-webscan-demo-red.sh index 6219152842..a7f1b850d0 100755 --- a/github-actions/scan/__test__/integrationtest/test-scripts/pds-webscan-demo-red.sh +++ b/github-actions/scan/__test__/integrationtest/test-scripts/pds-webscan-demo-red.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cat "__test__/integrationtest/test-product-output/example-owasp-zap-sarif-output-red.json" > "${PDS_JOB_RESULT_FILE}" diff --git a/github-actions/scan/__test__/integrationtest/wait_server_alive.sh b/github-actions/scan/__test__/integrationtest/wait_server_alive.sh index 1c25a842af..40e18fe196 100755 --- a/github-actions/scan/__test__/integrationtest/wait_server_alive.sh +++ b/github-actions/scan/__test__/integrationtest/wait_server_alive.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT SERVER_TYPE=$1 diff --git a/gradle/libraries.gradle b/gradle/libraries.gradle index 5d5bfd35b8..37d5570466 100644 --- a/gradle/libraries.gradle +++ b/gradle/libraries.gradle @@ -74,7 +74,14 @@ ext { // TODO de-jcup, 2024-04-18: Currently we cannot use versions > 0.17.1 because it introduces nullable and required in the spec file which causes issues // There exists an issue for it at https://github.com/mercedes-benz/sechub/issues/3080 restDocsApiSpec: "0.17.1", - + jacksonAnnotations: "2.17.2", + jacksonDatabind: "2.13.4.1", + jacksonDatatypeJsr310: "2.17.2", + jacksonDatabindNullable: "0.2.6", + javaxAnnotationApi: "1.3.2", + findbugs: "3.0.2", + httpmime: "4.3.1", + /* Owasp Zap wrapper */ owaspzap_client_api: "1.13.0", jcommander: "1.82", @@ -198,8 +205,16 @@ ext { arch_unit: "com.tngtech.archunit:archunit-junit5:${libraryVersion.arch_unit}", - bouncy_castle_bcprov_jdk8: "org.bouncycastle:bcprov-jdk18on:${libraryVersion.bouncy_castle_bcprov_jdk8}" + bouncy_castle_bcprov_jdk8: "org.bouncycastle:bcprov-jdk18on:${libraryVersion.bouncy_castle_bcprov_jdk8}", + /* OpenAPI generator */ + jacksonAnnotations: "com.fasterxml.jackson.core:jackson-annotations:${libraryVersion.jacksonAnnotations}", + jacksonDatabind: "com.fasterxml.jackson.core:jackson-databind:${libraryVersion.jacksonDatabind}", + jacksonDatatypeJsr310: "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${libraryVersion.jacksonDatatypeJsr310}", + jacksonDatabindNullable: "org.openapitools:jackson-databind-nullable:${libraryVersion.jacksonDatabindNullable}", + javaxAnnotationApi: "javax.annotation:javax.annotation-api:${libraryVersion.javaxAnnotationApi}", + findbugs: "com.google.code.findbugs:jsr305:${libraryVersion.findbugs}", + httpmime: "org.apache.httpcomponents:httpmime:${libraryVersion.httpmime}", ] diff --git a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/user/AnonymousUserRequestNewApiTokenRestController.java b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/user/AnonymousUserRequestNewApiTokenRestController.java index 0522f1f264..ad7697515f 100644 --- a/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/user/AnonymousUserRequestNewApiTokenRestController.java +++ b/sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/user/AnonymousUserRequestNewApiTokenRestController.java @@ -27,11 +27,11 @@ public class AnonymousUserRequestNewApiTokenRestController { private AnonymousUserRequestsNewApiTokenService newApiTokenService; /* @formatter:off */ - @CrossOrigin /* to allow call from getsechub.detss and maybe other sites using javascript */ - @UseCaseUserRequestsNewApiToken(@Step(number=1, name="Rest API call",description="Rest api called to request new user api token. Normally done by user itself",needsRestDoc=true)) - @RequestMapping(path = AdministrationAPIConstants.API_REQUEST_NEW_APITOKEN, method = RequestMethod.POST) - public void anonymousRequestToGetNewApiTokenForUserEmailAddress(@PathVariable(name="emailAddress") String emailAddress) { - /* @formatter:on */ + @CrossOrigin /* to allow call from getsechub.detss and maybe other sites using javascript */ + @UseCaseUserRequestsNewApiToken(@Step(number=1, name="Rest API call",description="Rest api called to request new user api token. Normally done by user itself",needsRestDoc=true)) + @RequestMapping(path = AdministrationAPIConstants.API_REQUEST_NEW_APITOKEN, method = RequestMethod.POST) + public void anonymousRequestToGetNewApiTokenForUserEmailAddress(@PathVariable(name="emailAddress") String emailAddress) { + /* @formatter:on */ newApiTokenService.anonymousRequestToGetNewApiTokenForUserEmailAddress(emailAddress); } diff --git a/sechub-analyzer-cli/src/test/resources/code/Shell/single_line_comment.sh b/sechub-analyzer-cli/src/test/resources/code/Shell/single_line_comment.sh index 76d3991c9d..c53db96375 100755 --- a/sechub-analyzer-cli/src/test/resources/code/Shell/single_line_comment.sh +++ b/sechub-analyzer-cli/src/test/resources/code/Shell/single_line_comment.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT diff --git a/sechub-api-java/README.adoc b/sechub-api-java/README.adoc index d3ea6bea0b..2119e7b6d7 100644 --- a/sechub-api-java/README.adoc +++ b/sechub-api-java/README.adoc @@ -14,7 +14,7 @@ The goal of the API is to: === Usage -Create an instance of `com.mercedesbenz.sechub.api.DefaultSecHubClient` and use the client methods. +Create an instance of `com.mercedesbenz.sechub.api.OldDefaultSecHubClient` and use the client methods. For a working example please look into `sechub-examples/example-sechub-api-java`. diff --git a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/OldDefaultSecHubClient.java similarity index 98% rename from sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java rename to sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/OldDefaultSecHubClient.java index afef0c43ae..c4136ec710 100644 --- a/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java +++ b/sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/OldDefaultSecHubClient.java @@ -50,9 +50,9 @@ import com.mercedesbenz.sechub.commons.model.JsonMapperFactory; import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -public class DefaultSecHubClient extends AbstractSecHubClient { +public class OldDefaultSecHubClient extends AbstractSecHubClient { - private static final Logger LOG = LoggerFactory.getLogger(DefaultSecHubClient.class); + private static final Logger LOG = LoggerFactory.getLogger(OldDefaultSecHubClient.class); private static JsonMapper mapper = JsonMapperFactory.createMapper(); @@ -76,7 +76,7 @@ public static DefaultSecHubClientBuilder builder() { return new DefaultSecHubClientBuilder(); } - private DefaultSecHubClient(URI serverUri, String userId, String apiToken, boolean trustAll) { + private OldDefaultSecHubClient(URI serverUri, String userId, String apiToken, boolean trustAll) { super(serverUri, userId, apiToken, trustAll); apiClient = new ApiClientBuilder().createApiClient(this, mapper); @@ -518,7 +518,7 @@ public SecHubClient build() { if (sealedApiToken == null) { throw new IllegalStateException("token is not defined!"); } - return new DefaultSecHubClient(serverUri, userName, apiTokenAccess.unseal(sealedApiToken), trustAll); + return new OldDefaultSecHubClient(serverUri, userName, apiTokenAccess.unseal(sealedApiToken), trustAll); } } diff --git a/sechub-api-java/src/main/resources/reduced-openapi3.json b/sechub-api-java/src/main/resources/reduced-openapi3.json index 4847a765da..192b2d741e 100644 --- a/sechub-api-java/src/main/resources/reduced-openapi3.json +++ b/sechub-api-java/src/main/resources/reduced-openapi3.json @@ -1,6 +1,75 @@ { "components": { "schemas": { + "EncryptionStatus": { + "title": "EncryptionStatus", + "type": "object", + "properties": { + "domains": { + "type": "array", + "items": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "createdFrom": { + "type": "string", + "description": "User id of admin who created the encryption entry" + }, + "created": { + "type": "string", + "description": "Creation timestamp" + }, + "usage": { + "type": "object", + "properties": { + "*": { + "type": "number", + "description": "Key value data" + } + }, + "description": "Map containing information about usage of this encryption" + }, + "passwordSource": { + "type": "object", + "properties": { + "data": { + "type": "string", + "description": "Data for password source. If type is ENVIRONMENT_VARIABLE then it is the the name of the environment variable." + }, + "type": { + "type": "string", + "description": "Type of password source. Can be [NONE, ENVIRONMENT_VARIABLE]" + } + } + }, + "id": { + "type": "string", + "description": "Unique identifier" + }, + "algorithm": { + "type": "string", + "description": "Algorithm used for encryption" + } + } + } + }, + "name": { + "type": "string", + "description": "Name of the domain which will provide this encryption data elements" + } + } + } + }, + "type": { + "type": "string", + "description": "The type description of the json content" + } + } + }, "ExecutionProfileCreate": { "title": "ExecutionProfileCreate", "type": "object", @@ -56,7 +125,7 @@ }, "enabled": { "type": "boolean", - "description": "enabled state of this config" + "description": "enabled state of this configuration" } } } @@ -114,7 +183,7 @@ }, "name": { "type": "string", - "description": "The name of this configuration" + "description": "A name for this configuration" }, "setup": { "type": "object", @@ -513,10 +582,6 @@ "type": "string", "description": "The uuid of the running job" }, - "configuration": { - "type": "string", - "description": "Configuration used for this job" - }, "projectId": { "type": "string", "description": "The name of the project the job is running for" @@ -645,7 +710,7 @@ "properties": { "key1": { "type": "string", - "description": "An arbitrary metadata key" + "description": "An arbitrary metadata key." } }, "description": "An JSON object containing metadata key-value pairs defined for this project." @@ -667,11 +732,11 @@ }, "projectId": { "type": "string", - "description": "The name of the project" + "description": "The name of the project." }, "users": { "type": "array", - "description": "A list of all users having access to the project", + "description": "A list of all users having access to the project.", "items": { "type": "string" } @@ -1201,7 +1266,7 @@ }, "email": { "type": "string", - "description": "The mail address of the user" + "description": "The email address of the user" }, "ownedProjects": { "type": "array", @@ -1230,7 +1295,7 @@ } } }, - "api-admin-project-projectId-104816866": { + "api-admin-encryption-rotate-638361826": { "type": "object" } }, @@ -1291,7 +1356,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/api-admin-project-projectId-104816866" + "$ref": "#/components/schemas/api-admin-encryption-rotate-638361826" } } } @@ -1316,7 +1381,7 @@ "content": { "application/json;charset=UTF-8": { "schema": { - "$ref": "#/components/schemas/api-admin-project-projectId-104816866" + "$ref": "#/components/schemas/api-admin-encryption-rotate-638361826" } } } @@ -1855,6 +1920,66 @@ ] } }, + "/api/admin/encryption/rotate": { + "post": { + "tags": [ + "admin" + ], + "summary": "Admin starts encryption rotation", + "description": "An administrator starts encryption rotation.", + "operationId": "adminStartsEncryptionRotation", + "requestBody": { + "content": { + "application/json;charset=UTF-8": { + "schema": { + "$ref": "#/components/schemas/api-admin-encryption-rotate-638361826" + } + } + } + }, + "responses": { + "200": { + "description": "200" + } + }, + "security": [ + { + "basic": [ + + ] + } + ] + } + }, + "/api/admin/encryption/status": { + "get": { + "tags": [ + "admin" + ], + "summary": "Admin fetches encryption status", + "description": "An administrator fetches encryption status from all domains where encryption is used.", + "operationId": "adminFetchesEncryptionStatus", + "responses": { + "200": { + "description": "200", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EncryptionStatus" + } + } + } + } + }, + "security": [ + { + "basic": [ + + ] + } + ] + } + }, "/api/admin/info/server": { "get": { "tags": [ @@ -2104,7 +2229,7 @@ "content": { "application/json;charset=UTF-8": { "schema": { - "$ref": "#/components/schemas/api-admin-project-projectId-104816866" + "$ref": "#/components/schemas/api-admin-encryption-rotate-638361826" } } } diff --git a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/DefaultSechubClientWireMockTest.java b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/DefaultSechubClientWireMockTest.java index 47e127c14e..7818db5f5e 100644 --- a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/DefaultSechubClientWireMockTest.java +++ b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/DefaultSechubClientWireMockTest.java @@ -151,7 +151,7 @@ public void credential_changes_on_client_after_creation_are_possible() throws Ex private SecHubClient createTestClientWithExampleCredentials() { /* @formatter:off */ - return DefaultSecHubClient.builder(). + return OldDefaultSecHubClient.builder(). server(URI.create(wireMockRule.baseUrl())). user(EXAMPLE_USER). apiToken(EXAMPLE_TOKEN). diff --git a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/InternalAccessModelFileGenerator.java b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/InternalAccessModelFileGenerator.java index 63b5b08ef9..f45a5c1bdb 100644 --- a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/InternalAccessModelFileGenerator.java +++ b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/InternalAccessModelFileGenerator.java @@ -9,7 +9,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mercedesbenz.sechub.api.DefaultSecHubClient; +import com.mercedesbenz.sechub.api.OldDefaultSecHubClient; public class InternalAccessModelFileGenerator { @@ -49,7 +49,7 @@ private void generateAbstractModel(MapGenInfo info) throws Exception { template.addLine("import java.util.List;"); template.addLine(""); template.addLine("/**"); - template.addLine(" * " + info.targetInternalAccessClassName + " is a model class for " + DefaultSecHubClient.class.getSimpleName() + template.addLine(" * " + info.targetInternalAccessClassName + " is a model class for " + OldDefaultSecHubClient.class.getSimpleName() + ". It uses internally the generated class"); template.addLine(" * " + fromGenclazz.getName() + ".
"); template.addLine(" *
"); diff --git a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/PublicModelFileGenerator.java b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/PublicModelFileGenerator.java index b7dc6e885f..d22bdd8f89 100644 --- a/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/PublicModelFileGenerator.java +++ b/sechub-api-java/src/test/java/com/mercedesbenz/sechub/api/generator/PublicModelFileGenerator.java @@ -9,7 +9,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mercedesbenz.sechub.api.DefaultSecHubClient; +import com.mercedesbenz.sechub.api.OldDefaultSecHubClient; public class PublicModelFileGenerator { @@ -55,7 +55,7 @@ private void generatetPublicModel(MapGenInfo info, boolean overwritePublicModelF template.addLine(""); template.addLine("/**"); - template.addLine(" * " + info.targetClassName + " is a model class for " + DefaultSecHubClient.class.getSimpleName() + template.addLine(" * " + info.targetClassName + " is a model class for " + OldDefaultSecHubClient.class.getSimpleName() + ". It uses internally the generated class"); template.addLine(" * " + fromGenclazz.getName() + ".
"); template.addLine(" *
"); @@ -63,7 +63,7 @@ private void generatetPublicModel(MapGenInfo info, boolean overwritePublicModelF template.addLine(" * " + getClass().getName() + "."); template.addLine(" */"); template.addLine("public class " + info.targetClassName + " {"); - template.addLine(" // only for usage by " + DefaultSecHubClient.class.getSimpleName()); + template.addLine(" // only for usage by " + OldDefaultSecHubClient.class.getSimpleName()); template.addLine(" static List<" + info.targetClassName + "> fromDelegates(List<" + info.fromGenclazz.getName() + "> delegates) {"); template.addLine(" List<" + info.targetClassName + "> resultList = new ArrayList<>();"); template.addLine(" if (delegates != null) {"); @@ -75,7 +75,7 @@ private void generatetPublicModel(MapGenInfo info, boolean overwritePublicModelF template.addLine(" }"); template.addLine(""); template.addLine(""); - template.addLine(" // only for usage by " + DefaultSecHubClient.class.getSimpleName()); + template.addLine(" // only for usage by " + OldDefaultSecHubClient.class.getSimpleName()); template.addLine(" static List<" + info.fromGenclazz.getName() + "> toDelegates(List<" + info.targetClassName + "> wrappers) {"); template.addLine(" List<" + info.fromGenclazz.getName() + "> resultList = new ArrayList<>();"); template.addLine(" if (wrappers != null) {"); @@ -98,7 +98,7 @@ private void generatetPublicModel(MapGenInfo info, boolean overwritePublicModelF template.addLine(" this.internalAccess= new " + internalAccessClass + "(delegate);"); template.addLine(" }"); template.addLine(""); - template.addLine(" // only for usage by " + DefaultSecHubClient.class.getSimpleName()); + template.addLine(" // only for usage by " + OldDefaultSecHubClient.class.getSimpleName()); template.addLine(" " + info.fromGenclazz.getName() + " getDelegate() {"); template.addLine(" return internalAccess.getDelegate();"); template.addLine(" }"); diff --git a/sechub-cli/build_go.sh b/sechub-cli/build_go.sh index 070e69cac5..9ab65006e9 100755 --- a/sechub-cli/build_go.sh +++ b/sechub-cli/build_go.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT projectDirOSspecific="$1" diff --git a/sechub-commons-model/build.gradle b/sechub-commons-model/build.gradle index 3f1fc50415..f0e7b9d98b 100644 --- a/sechub-commons-model/build.gradle +++ b/sechub-commons-model/build.gradle @@ -11,7 +11,7 @@ dependencies{ api spring_boot_dependency.jackson_datatype_jsr310 api project(':sechub-commons-core') - + testImplementation project(':sechub-testframework') testImplementation spring_boot_dependency.junit_jupiter diff --git a/sechub-developertools/scripts/container/postgres/stop.sh b/sechub-developertools/scripts/container/postgres/stop.sh index d81003b487..0d7711d857 100755 --- a/sechub-developertools/scripts/container/postgres/stop.sh +++ b/sechub-developertools/scripts/container/postgres/stop.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source ./../common-containerscript.sh diff --git a/sechub-developertools/scripts/sdc.sh b/sechub-developertools/scripts/sdc.sh index ef79eaba6c..6c18695ca5 100755 --- a/sechub-developertools/scripts/sdc.sh +++ b/sechub-developertools/scripts/sdc.sh @@ -263,7 +263,9 @@ if [[ "$HELP" = "YES" ]]; then fi function cleanOldReportData() { + if [ -f ./sechub_report_*.json ]; then rm ./sechub_report_*.json -f + fi } diff --git a/sechub-developertools/src/main/java/com/mercedesbenz/sechub/developertools/container/postgres/LocalTestPostgreSQLStarter.java b/sechub-developertools/src/main/java/com/mercedesbenz/sechub/developertools/container/postgres/LocalTestPostgreSQLStarter.java index 9ba12b679b..2733e1ea75 100644 --- a/sechub-developertools/src/main/java/com/mercedesbenz/sechub/developertools/container/postgres/LocalTestPostgreSQLStarter.java +++ b/sechub-developertools/src/main/java/com/mercedesbenz/sechub/developertools/container/postgres/LocalTestPostgreSQLStarter.java @@ -109,7 +109,7 @@ private void createInfoFile(PostgreSQLTestContainer container) throws IOExceptio Path created = Files.createFile(filePath); StringBuilder sb = new StringBuilder(); - sb.append("#!/usr/bin/bash\n"); + sb.append("#!/bin/bash\n"); sb.append("\nPOSTGRES_DB_URL=" + container.getJdbcUrl()); sb.append("\nPOSTGRES_DB_USERNAME=" + container.getUsername()); sb.append("\nPOSTGRES_DB_PASSWORD=" + container.getPassword()); diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java index 6bb36dce6a..5eb59780ce 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java @@ -20,13 +20,7 @@ import java.lang.annotation.Annotation; import java.net.URL; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.TreeMap; -import java.util.UUID; +import java.util.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/sechub-examples/example-sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/java/demo/SecHubJavaApiDemoApplication.java b/sechub-examples/example-sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/java/demo/SecHubJavaApiDemoApplication.java index 347e15a9a6..ca307347c2 100644 --- a/sechub-examples/example-sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/java/demo/SecHubJavaApiDemoApplication.java +++ b/sechub-examples/example-sechub-api-java/src/main/java/com/mercedesbenz/sechub/api/java/demo/SecHubJavaApiDemoApplication.java @@ -8,7 +8,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mercedesbenz.sechub.api.DefaultSecHubClient; +import com.mercedesbenz.sechub.api.OldDefaultSecHubClient; import com.mercedesbenz.sechub.api.SecHubClient; import com.mercedesbenz.sechub.api.java.demo.config.DemoConfigurationProvider; import com.mercedesbenz.sechub.api.java.demo.playground.DemoAdminApiPlayground; @@ -37,7 +37,7 @@ private void start(String[] args) { LOG.trace("*** trustAll: {}", trustAll); /* create the client */ - SecHubClient client = DefaultSecHubClient.builder().server(serverUri).user(userName).apiToken(apiToken).trustAll(trustAll).build(); + SecHubClient client = OldDefaultSecHubClient.builder().server(serverUri).user(userName).apiToken(apiToken).trustAll(trustAll).build(); // test anonymous parts testAnonymousApi(client); diff --git a/sechub-openapi-java-client/build.gradle b/sechub-openapi-java-client/build.gradle index a10031ad77..8ba3ad4df4 100644 --- a/sechub-openapi-java-client/build.gradle +++ b/sechub-openapi-java-client/build.gradle @@ -13,19 +13,27 @@ plugins { } dependencies { - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.2' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.1' - implementation 'javax.annotation:javax.annotation-api:1.3.2' - implementation 'com.google.code.findbugs:jsr305:3.0.2' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' - implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation library.jacksonAnnotations + implementation library.jacksonDatabind + implementation library.javaxAnnotationApi + implementation library.findbugs + implementation library.jacksonDatatypeJsr310 + implementation library.jacksonDatabindNullable + implementation library.httpmime + + + // SecHub + implementation project(':sechub-commons-archive') } + + + clean.doFirst { delete 'gen' } -def openApiSpecPath = "${project.rootDir}/sechub-api-java/src/main/resources/openapi.yaml" +def openApiSpecPath = "${project.rootDir}/sechub-openapi-java/src/main/resources/openapi.yaml" openApiGenerate { generatorName = 'java' @@ -52,6 +60,11 @@ openApiGenerate { performBeanValidation : 'false', useBeanValidation : 'false', dateLibrary : 'java8', + useTags : 'false', + modelNameSuffix : '', + modelNamePrefix : '', + modelPropertyNaming : 'original', + useInnerModel : 'false' , serializableModel : 'true', serializationLibrary : 'jackson', artifactId : 'sechub-openapi-java-client', @@ -68,7 +81,8 @@ openApiGenerate { scmConnection : '', scmDeveloperConnection : '', scmUrl : 'https://github.com/mercedes-benz/sechub', - useJakartaEe : 'false' + useJakartaEe : 'false', + additionalModelTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY)' ] } diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/AbstractSecHubClient.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/AbstractSecHubClient.java new file mode 100644 index 0000000000..18372b353c --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/AbstractSecHubClient.java @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.commons.core.security.CryptoAccess; + +import javax.crypto.SealedObject; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; + +public abstract class AbstractSecHubClient implements SecHubClient { + + private boolean trustAll; + private String userId; + private SealedObject sealedApiToken; + private URI serverUri; + private CryptoAccess apiTokenAccess = new CryptoAccess<>(); + + private Set secHubClientListeners; + + protected AbstractSecHubClient(URI serverUri, String userId, String apiToken, boolean trustAll) { + this.serverUri = serverUri; + this.trustAll = trustAll; + + this.secHubClientListeners = new LinkedHashSet<>(); + + setUserId(userId); + setApiToken(apiToken); + } + + public void setUserId(String userId) { + if (userId == null) { + throw new IllegalArgumentException("userId may be not null"); + } + this.userId = userId; + } + + public void setApiToken(String apiToken) { + if (apiToken == null) { + throw new IllegalArgumentException("api token may be not null"); + } + this.sealedApiToken = apiTokenAccess.seal(apiToken); + } + + @Override + public boolean isTrustAll() { + return trustAll; + } + + @Override + public String getUserId() { + return userId; + } + + @Override + public String getSealedApiToken() { + return apiTokenAccess.unseal(sealedApiToken); + } + + @Override + public URI getServerUri() { + return serverUri; + } + + protected File calculateFullScanLogFile(UUID sechubJobUUID, Path downloadFilePath) throws IOException, ApiException { + File file = null; + if (downloadFilePath == null) { + downloadFilePath = Files.createTempDirectory("sechub-fullscanlog"); + } + file = downloadFilePath.toFile(); + if (file.isDirectory()) { + file = new File(file, "SecHub-" + sechubJobUUID + "-scanlog.zip"); + } + file.getParentFile().mkdirs(); + return file; + } + + /** + * Adds a listener to the client. For some action on client side the listener + * will be informed. Same listener instance can be added only one time no matter + * how many times this method is called. + * + * @param listener + */ + @Override + public void addListener(SecHubClientListener listener) { + if (listener == null) { + return; + } + this.secHubClientListeners.add(listener); + } + + /** + * Removes a listener from the client (if added). + * + * @param listener + */ + @Override + public void removeListener(SecHubClientListener listener) { + if (listener == null) { + return; + } + this.secHubClientListeners.remove(listener); + } + + void inform(SecHubClientListenerCaller r) { + for (SecHubClientListener listener : secHubClientListeners) { + r.inform(listener); + } + } + + interface SecHubClientListenerCaller { + + void inform(SecHubClientListener listener); + + } + +} \ No newline at end of file diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ApiClientBuilder.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ApiClientBuilder.java new file mode 100644 index 0000000000..74af5d3f75 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ApiClientBuilder.java @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiClient; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509ExtendedTrustManager; +import java.net.Socket; +import java.net.http.HttpClient; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Base64; + +public class ApiClientBuilder { + + public ApiClient createApiClient(SecHubClient client, ObjectMapper mapper) { + HttpClient.Builder builder = HttpClient.newBuilder(); + if (client.isTrustAll()) { + builder.sslContext(createTrustAllSSLContext()); + } + + ApiClient apiClient = new ApiClient(builder, mapper, client.getServerUri().toString()); + apiClient.setRequestInterceptor((request) -> { + request.setHeader("Authorization", createBasicAuthenticationHeader(client)); + }); + return apiClient; + + } + + private static final String createBasicAuthenticationHeader(SecHubClient client) { + String valueToEncode = client.getUserId() + ":" + client.getSealedApiToken(); + return "Basic " + Base64.getEncoder().encodeToString(valueToEncode.getBytes()); + } + + private SSLContext createTrustAllSSLContext() { + SSLContext sslContext = null; + try { + sslContext = SSLContext.getInstance("TLS"); + + TrustManager trustManager = new TrustAllManager(); + + sslContext.init(null, new TrustManager[] { trustManager }, null); + + return sslContext; + } catch (NoSuchAlgorithmException | KeyManagementException e) { + throw new IllegalStateException(e); + } + + } + + private class TrustAllManager extends X509ExtendedTrustManager { + + private X509Certificate[] emptyCertificatesArray = new X509Certificate[] {}; + + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + /* we do not check - we trust all */ + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + /* we do not check - we trust all */ + } + + public X509Certificate[] getAcceptedIssuers() { + return emptyCertificatesArray; + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { + /* we do not check - we trust all */ + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { + /* we do not check - we trust all */ + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { + /* we do not check - we trust all */ + + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { + /* we do not check - we trust all */ + } + }; +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java new file mode 100644 index 0000000000..5c10d13497 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/DefaultSecHubClient.java @@ -0,0 +1,262 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.mercedesbenz.sechub.api.internal.gen.*; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiClient; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubConfiguration; +import com.mercedesbenz.sechub.commons.archive.ArchiveSupport; +import com.mercedesbenz.sechub.commons.core.security.CheckSumSupport; +import com.mercedesbenz.sechub.commons.core.security.CryptoAccess; +import com.mercedesbenz.sechub.commons.model.JsonMapperFactory; +import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.crypto.SealedObject; +import java.io.*; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.UUID; + +import static java.util.Objects.requireNonNull; + +public class DefaultSecHubClient extends AbstractSecHubClient { + + private static final Logger LOG = LoggerFactory.getLogger(DefaultSecHubClient.class); + + private static final JsonMapper mapper = JsonMapperFactory.createMapper(); + + private final ArchiveSupport archiveSupport = new ArchiveSupport(); + private final CheckSumSupport checkSumSupport = new CheckSumSupport(); + + private final ConfigurationApi configurationApi; + private final JobAdministrationApi jobAdministrationApi; + private final OtherApi otherApi; + private final ProjectAdministrationApi projectAdministrationApi; + private final SecHubExecutionApi secHubExecutionApi; + private final SignUpApi signUpApi; + private final SystemApi systemApi; + private final TestingApi testingApi; + private final UserAdministrationApi userAdministrationApi; + private final UserProfileApi userProfileApi; + private final SecHubExecutionWorkaroundApi secHubExecutionWorkaroundApi; + + public static DefaultSecHubClientBuilder builder() { + return new DefaultSecHubClientBuilder(); + } + + private DefaultSecHubClient(URI serverUri, String userId, String apiToken, boolean trustAll) { + super(serverUri, userId, apiToken, trustAll); + + ApiClient apiClient = new ApiClientBuilder().createApiClient(this, mapper); + configurationApi = new ConfigurationApi(apiClient); + jobAdministrationApi = new JobAdministrationApi(apiClient); + otherApi = new OtherApi(apiClient); + projectAdministrationApi = new ProjectAdministrationApi(apiClient); + secHubExecutionApi = new SecHubExecutionApi(apiClient); + signUpApi = new SignUpApi(apiClient); + systemApi = new SystemApi(apiClient); + testingApi = new TestingApi(apiClient); + userAdministrationApi = new UserAdministrationApi(apiClient); + userProfileApi = new UserProfileApi(apiClient); + secHubExecutionWorkaroundApi = new SecHubExecutionWorkaroundApi(apiClient); + } + + /** + * Uploads data as defined in given configuration + * + * @param projectId the project id + * @param jobUUID SecHub Job UUID + * @param configuration SecHub Job configuration (contains information about + * upload behavior (e.g. paths etc.) + * @param workingDirectory directory where the relative paths inside + * configuration model shall start from + * @throws ApiException + */ + @Override + public void userUpload(String projectId, UUID jobUUID, SecHubConfiguration configuration, Path workingDirectory) throws ApiException { + requireNonNull(projectId, "projectId may not be null!"); + requireNonNull(configuration, "configuration may not be null!"); + + Path uploadDirectory; + try { + uploadDirectory = Files.createTempDirectory("sechub_client_upload"); + } catch (IOException e) { + throw new ApiException(e); + } + + ArchiveSupport.ArchivesCreationResult createArchiveResult; + try { + // TODO: This is a workaround until the sechub commons model classes have been completely substituted by the + // generated classes from the new openapi module + // see https://github.com/mercedes-benz/sechub/issues/3284 + SecHubConfigurationModel secHubConfigurationModel = mapper.reader() + .forType(SecHubConfigurationModel.class) + .readValue(mapper.writeValueAsString(configuration)); + + createArchiveResult = archiveSupport.createArchives(secHubConfigurationModel, workingDirectory, uploadDirectory); + } catch (IOException e) { + throw new ApiException(e); + } + + inform((listener) -> listener.beforeUpload(jobUUID, configuration, createArchiveResult)); + + try { + userUploadsSourceCode(projectId, jobUUID, createArchiveResult); + userUploadsBinaries(projectId, jobUUID, createArchiveResult); + + inform((listener) -> listener.afterUpload(jobUUID, configuration, createArchiveResult)); + + } finally { + LOG.debug("Remove temporary data from: {}", uploadDirectory); + try { + archiveSupport.deleteArchives(createArchiveResult); + } catch (IOException e) { + throw new ApiException(e); + } + } + } + + @Override + public boolean isServerAlive() { + try { + systemApi.anonymousCheckAliveHead(); + return true; + } catch (ApiException e) { + return false; + } + } + + @Override + public Path downloadFullScanLog(UUID sechubJobUUID, Path downloadFilePath) throws ApiException { + try { + final File targetFile = calculateFullScanLogFile(sechubJobUUID, downloadFilePath); + secHubExecutionWorkaroundApi.adminDownloadsFullScanDataForJob(sechubJobUUID, targetFile); + return targetFile.toPath(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* + ................APIs............................ + */ + /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + @Override + public ConfigurationApi withConfigurationApi() { + return configurationApi; + } + + @Override + public JobAdministrationApi withJobAdministrationApi() { + return jobAdministrationApi; + } + + @Override + public OtherApi withOtherApi() { + return otherApi; + } + + @Override + public ProjectAdministrationApi withProjectAdministrationApi() { + return projectAdministrationApi; + } + + @Override + public SecHubExecutionApi withSecHubExecutionApi() { + return secHubExecutionApi; + } + + @Override + public SignUpApi withSignUpApi() { + return signUpApi; + } + + @Override + public SystemApi withSystemApi() { + return systemApi; + } + + @Override + public TestingApi withTestingApi() { + return testingApi; + } + + @Override + public UserAdministrationApi withUserAdministrationApi() { + return userAdministrationApi; + } + + @Override + public UserProfileApi withUserProfileApi() { + return userProfileApi; + } + + private void userUploadsBinaries(String projectId, UUID jobUUID, ArchiveSupport.ArchivesCreationResult createArchiveResult) throws ApiException { + if (!createArchiveResult.isBinaryArchiveCreated()) { + return; + } + Path tarFilePath = createArchiveResult.getBinaryArchiveFile(); + + String filesize = String.valueOf(tarFilePath.toFile().length()); + String checksum = checkSumSupport.createSha256Checksum(tarFilePath); + + secHubExecutionWorkaroundApi.userUploadsBinaries(projectId, jobUUID, checksum, filesize, tarFilePath); + } + + private void userUploadsSourceCode(String projectId, UUID jobUUID, ArchiveSupport.ArchivesCreationResult createArchiveResult) throws ApiException { + if (!createArchiveResult.isSourceArchiveCreated()) { + return; + } + Path zipFilePath = createArchiveResult.getSourceArchiveFile(); + String checksum = checkSumSupport.createSha256Checksum(zipFilePath); + + secHubExecutionWorkaroundApi.userUploadsSourceCode(projectId, jobUUID, checksum, zipFilePath); + } + + public static class DefaultSecHubClientBuilder { + private URI serverUri; + private String userName; + private CryptoAccess apiTokenAccess = new CryptoAccess<>(); + private SealedObject sealedApiToken; + private boolean trustAll; + + public DefaultSecHubClientBuilder server(URI serverUri) { + this.serverUri = serverUri; + return this; + } + + public DefaultSecHubClientBuilder user(String userId) { + this.userName = userId; + return this; + } + + public DefaultSecHubClientBuilder apiToken(String token) { + sealedApiToken = apiTokenAccess.seal(token); + return this; + } + + public DefaultSecHubClientBuilder trustAll(boolean trustAll) { + this.trustAll = trustAll; + return this; + } + + public SecHubClient build() { + if (serverUri == null) { + throw new IllegalStateException("server uri is not defined!"); + } + if (userName == null) { + throw new IllegalStateException("user name is not defined!"); + } + if (sealedApiToken == null) { + throw new IllegalStateException("token is not defined!"); + } + return new DefaultSecHubClient(serverUri, userName, apiTokenAccess.unseal(sealedApiToken), trustAll); + } + } + +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartBodyPublisherBuilder.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartBodyPublisherBuilder.java new file mode 100644 index 0000000000..7eab8a1f43 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartBodyPublisherBuilder.java @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.http.HttpRequest; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.function.Supplier; + +public class MultiPartBodyPublisherBuilder { + private List multiPartData = new ArrayList<>(); + + private String boundary; + + public MultiPartBodyPublisherBuilder() { + boundary = UUID.randomUUID().toString(); + } + + public HttpRequest.BodyPublisher build() { + if (multiPartData.size() == 0) { + throw new IllegalStateException("Must have at least one part to build a multipart message."); + } + /* at the end add the final boundary */ + multiPartData.add(MultiPartData.boundary(boundary)); + + return HttpRequest.BodyPublishers.ofByteArrays(MultiPartIterator::new); + } + + public String getBoundary() { + return boundary; + } + + public MultiPartBodyPublisherBuilder addString(String name, String value) { + multiPartData.add(MultiPartData.forStringContent(name, value)); + return this; + } + + public MultiPartBodyPublisherBuilder addFile(String name, Path path) { + multiPartData.add(MultiPartData.forFile(name, path)); + return this; + } + + public MultiPartBodyPublisherBuilder addStream(String name, Supplier value, String filename, String contentType) { + multiPartData.add(MultiPartData.forStream(name, value, filename, contentType)); + return this; + } + + class MultiPartIterator implements Iterator { + + private static final int BUFER_SIZE = 8192; + private Iterator iter; + private InputStream inputStream; + + private boolean done; + private byte[] next; + + MultiPartIterator() { + iter = multiPartData.iterator(); + } + + @Override + public boolean hasNext() { + if (done) { + return false; + } + if (next != null) { + return true; + } + try { + next = computeNext(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + if (next == null) { + done = true; + return false; + } + return true; + } + + @Override + public byte[] next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + byte[] res = next; + next = null; + return res; + } + + private byte[] computeNext() throws IOException { + if (inputStream == null) { + if (!iter.hasNext()) { + return null; + } + MultiPartData nextPart = iter.next(); + + if (MultiPartType.STRING.equals(nextPart.getType())) { + String part = "--" + boundary + "\r\n" + "Content-Disposition: form-data; name=" + nextPart.getName() + "\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n\r\n" + nextPart.getValue() + "\r\n"; + return part.getBytes(StandardCharsets.UTF_8); + } + if (MultiPartType.BOUNDARY.equals(nextPart.getType())) { + return nextPart.getValue().getBytes(StandardCharsets.UTF_8); + } + + String filename; + String contentType; + + if (MultiPartType.FILE.equals(nextPart.getType())) { + Path path = nextPart.getPath(); + filename = path.getFileName().toString(); + contentType = Files.probeContentType(path); + if (contentType == null) { + contentType = "application/octet-stream"; + } + inputStream = Files.newInputStream(path); + } else { + filename = nextPart.getFilename(); + contentType = nextPart.getContentType(); + if (contentType == null) { + contentType = "application/octet-stream"; + } + inputStream = nextPart.getStream().get(); + } + String partHeader = "--" + boundary + "\r\n" + "Content-Disposition: form-data; name=" + nextPart.getName() + "; filename=" + filename + "\r\n" + + "Content-Type: " + contentType + "\r\n\r\n"; + return partHeader.getBytes(StandardCharsets.UTF_8); + } else { + byte[] buffer = new byte[BUFER_SIZE]; + + int amountOfBytesRead = inputStream.read(buffer); + + if (amountOfBytesRead > 0) { + byte[] actualBytes = new byte[amountOfBytesRead]; + System.arraycopy(buffer, 0, actualBytes, 0, amountOfBytesRead); + + return actualBytes; + + } else { + /* nothing read - no more data available */ + inputStream.close(); + inputStream = null; + + return "\r\n".getBytes(StandardCharsets.UTF_8); + } + } + } + } +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartData.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartData.java new file mode 100644 index 0000000000..291e35522c --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartData.java @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import java.io.InputStream; +import java.nio.file.Path; +import java.util.function.Supplier; + +/** + * This class represents data entries inside a multipart body + * + * @author Albert Tregnaghi + * + */ +class MultiPartData { + + private String name; + + private MultiPartType type; + + private String value; + + private Path path; + + private Supplier stream; + + private String filename; + + private String contentType; + + public static MultiPartData forStringContent(String name, String value) { + MultiPartData data = new MultiPartData(); + data.name = name; + data.value = value; + data.type = MultiPartType.STRING; + + return data; + + } + + public static MultiPartData forFile(String name, Path path) { + MultiPartData data = new MultiPartData(); + data.name = name; + data.path = path; + data.type = MultiPartType.FILE; + + return data; + } + + public static MultiPartData forStream(String name, Supplier value, String filename, String contentType) { + MultiPartData data = new MultiPartData(); + data.name = name; + data.stream = value; + data.filename = filename; + data.contentType = contentType; + data.type = MultiPartType.STREAM; + + return data; + } + + private MultiPartData() { + } + + public String getName() { + return name; + } + + public MultiPartType getType() { + return type; + } + + public String getValue() { + return value; + } + + public Path getPath() { + return path; + } + + public Supplier getStream() { + return stream; + } + + public String getFilename() { + return filename; + } + + public String getContentType() { + return contentType; + } + + public static MultiPartData boundary(String boundary) { + + MultiPartData data = new MultiPartData(); + data.type = MultiPartType.BOUNDARY; + data.value = "--" + boundary + "--"; + + return data; + } + +} \ No newline at end of file diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartType.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartType.java new file mode 100644 index 0000000000..906a1834a8 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/MultiPartType.java @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +public enum MultiPartType { + STRING, + + FILE, + + STREAM, + + BOUNDARY, + + ; +} \ No newline at end of file diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ScanSecHubReportLoader.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ScanSecHubReportLoader.java new file mode 100644 index 0000000000..4d013f739c --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/ScanSecHubReportLoader.java @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubReport; +import com.mercedesbenz.sechub.commons.model.JsonMapperFactory; + +import java.io.File; +import java.io.IOException; + +public class ScanSecHubReportLoader { + + private static JsonMapper mapper = JsonMapperFactory.createMapper(); + + public static SecHubReport fromFile(File file) throws SecHubReportException { + SecHubReport report = null; + + try { + report = mapper.readValue(file, SecHubReport.class); + } catch (JsonParseException | JsonMappingException e) { + throw new SecHubReportException("Content is not valid JSON", e); + } catch (IOException e) { + throw new SecHubReportException("Wasn't able to read report file", e); + } + + return report; + } +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClient.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClient.java new file mode 100644 index 0000000000..88af5807f3 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClient.java @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.mercedesbenz.sechub.api.internal.gen.*; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubConfiguration; + +import java.net.URI; +import java.nio.file.Path; +import java.util.UUID; + +/** + * The central java API entry to access SecHub + * + * @author Albert Tregnaghi + * + */ +public interface SecHubClient { + + /** + * Adds a listener to the client. For some action on client side the listener + * will be informed. A listener can be added only one time no matter how many + * times this method is called. + * + * @param listener + */ + void addListener(SecHubClientListener listener); + + /** + * Removes a listener from the client (if added). + * + * @param listener + */ + void removeListener(SecHubClientListener listener); + + void setUserId(String userId); + + String getUserId(); + + void setApiToken(String apiToken); + + String getSealedApiToken(); + + URI getServerUri(); + + boolean isTrustAll(); + + boolean isServerAlive() throws ApiException; + + /** + * Uploads data as defined in given configuration + * + * @param projectId the project id + * @param jobUUID SecHub Job UUID + * @param configuration SecHub Job configuration (contains information about + * upload behavior (e.g. paths etc.) + * @param workingDirectory directory where the relative paths inside + * configuration model shall start from + * @throws SecHubClientException + */ + void userUpload(String projectId, UUID jobUUID, SecHubConfiguration configuration, Path workingDirectory) throws ApiException; + + /** + * Downloads the full scan log for a given sechub job uuid into wanted target + * location. This call can only be done an administrator. + * + * @param sechubJobUUID + * @param downloadFilePath path to download file. If path is a folder the + * filename will be + * "SecHub-${sechubJobUUID}-scanlog.zip". When null, a + * temp folder will be used + * @return path to download + */ + Path downloadFullScanLog(UUID sechubJobUUID, Path downloadFilePath) throws ApiException; + + /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* + ................APIs............................ + */ + /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + ConfigurationApi withConfigurationApi(); + + JobAdministrationApi withJobAdministrationApi(); + + OtherApi withOtherApi(); + + ProjectAdministrationApi withProjectAdministrationApi(); + + SecHubExecutionApi withSecHubExecutionApi(); + + SignUpApi withSignUpApi(); + + SystemApi withSystemApi(); + + TestingApi withTestingApi(); + + UserAdministrationApi withUserAdministrationApi(); + + UserProfileApi withUserProfileApi(); + +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientException.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientException.java new file mode 100644 index 0000000000..1e8130166f --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientException.java @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +public class SecHubClientException extends Exception { + + private static final long serialVersionUID = 1L; + + public SecHubClientException(String message) { + super(message); + } + + public SecHubClientException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientListener.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientListener.java new file mode 100644 index 0000000000..6cd8ff1135 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubClientListener.java @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubReport; +import com.mercedesbenz.sechub.commons.archive.ArchiveSupport; + +import java.util.UUID; + +public interface SecHubClientListener { + + default void beforeUpload(UUID secHubJobUUID, SecHubConfiguration model, ArchiveSupport.ArchivesCreationResult archiveCreationResult) { + /* do nothing per default */ + } + + default void afterUpload(UUID secHubJobUUID, SecHubConfiguration model, ArchiveSupport.ArchivesCreationResult archiveCreationResult) { + /* do nothing per default */ + } + + default void afterReportDownload(UUID jobUUID, SecHubReport report) { + /* do nothing per default */ + } + +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubExecutionWorkaroundApi.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubExecutionWorkaroundApi.java new file mode 100644 index 0000000000..02babc3be3 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubExecutionWorkaroundApi.java @@ -0,0 +1,369 @@ +package com.mercedesbenz.sechub.api; + +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiClient; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiResponse; +import com.mercedesbenz.sechub.api.internal.gen.invoker.Pair; +import com.mercedesbenz.sechub.commons.core.CommonConstants; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.file.Path; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import java.util.function.Consumer; + +/** + * This is an extension for the {@link com.mercedesbenz.sechub.api.internal.gen.SecHubExecutionApi} class. + * The default openapi generator is unable to generate a functional api for the userUploadsSourceCode and adminDownloadsFullScanDataForJob methods. + * This is due to an error with multipart request building and file response mappings. + * This should be resolved in the future by switching the generator library (e.g. ok http client). + */ +class SecHubExecutionWorkaroundApi { + + private final HttpClient memberVarHttpClient; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + + public SecHubExecutionWorkaroundApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * User uploads binaries User uploads binaries + * + * @param projectId The id of the project for which the binaries are uploaded + * for (required) + * @param jobUUID The SecHub jobUUID. During the job creation this unique job + * identifier is automatically generated by SecHub. (required) + * @param checkSum A sha256 checksum for file upload validation (required) + * @param xFileSize The file size of the tar-archive to upload in bytes. Needs + * to be a positive integer value. (required) + * @param file File to upload... + * @throws ApiException if fails to make API call + */ + public void userUploadsBinaries(String projectId, UUID jobUUID, String checkSum, String xFileSize, Path file) throws ApiException { + userUploadsBinariesWithHttpInfo(projectId, jobUUID, checkSum, xFileSize, file); + } + + /** + * User uploads binaries User uploads binaries + * + * @param projectId The id of the project for which the binaries are uploaded + * for (required) + * @param jobUUID The SecHub jobUUID. During the job creation this unique job + * identifier is automatically generated by SecHub. (required) + * @param checkSum A sha256 checksum for file upload validation (required) + * @param xFileSize The file size of the tar-archive to upload in bytes. Needs + * to be a positive integer value. (required) + * @param file File to upload... + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse userUploadsBinariesWithHttpInfo(String projectId, UUID jobUUID, String checkSum, String xFileSize, Path file) + throws ApiException { + HttpRequest.Builder localVarRequestBuilder = userUploadsBinariesRequestBuilder(projectId, jobUUID, checkSum, xFileSize, file); + try { + + HttpResponse localVarResponse = memberVarHttpClient.send(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode() / 100 != 2) { + throw getApiException("userUploadsBinaries", localVarResponse); + } + return new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder userUploadsBinariesRequestBuilder(String projectId, UUID jobUUID, String checkSum, String xFileSize, Path file) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException(400, "Missing the required parameter 'projectId' when calling userUploadsBinaries"); + } + // verify the required parameter 'jobUUID' is set + if (jobUUID == null) { + throw new ApiException(400, "Missing the required parameter 'jobUUID' when calling userUploadsBinaries"); + } + // verify the required parameter 'checkSum' is set + if (checkSum == null) { + throw new ApiException(400, "Missing the required parameter 'checkSum' when calling userUploadsBinaries"); + } + // verify the required parameter 'xFileSize' is set + if (xFileSize == null) { + throw new ApiException(400, "Missing the required parameter 'xFileSize' when calling userUploadsBinaries"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/project/{projectId}/job/{jobUUID}/binaries".replace("{projectId}", ApiClient.urlEncode(projectId.toString())) + .replace("{jobUUID}", ApiClient.urlEncode(jobUUID.toString())); + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + /* workaround2 - we need no query params */ + // generated but wrong: + // localVarQueryParams.addAll(ApiClient.parameterToPairs("checkSum", checkSum)); + /* workaround 2 end */ + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + if (xFileSize != null) { + localVarRequestBuilder.header("x-file-size", xFileSize.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + /* workaround start: upload the given file ... */ + /* @formatter:off */ + MultiPartBodyPublisherBuilder builder = new MultiPartBodyPublisherBuilder(). + addFile(CommonConstants.MULTIPART_FILE, file). + addString(CommonConstants.MULTIPART_CHECKSUM, checkSum); + + HttpRequest.BodyPublisher publisher = builder.build(); + + localVarRequestBuilder.setHeader("Content-Type","multipart/form-data;boundary="+builder.getBoundary()); + + /* @formatter:on */ + localVarRequestBuilder.POST(publisher); + + /* workaround end */ + + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * User uploads source code User uploads source code + * + * @param projectId The id of the project where sourcecode shall be uploaded for + * (required) + * @param jobUUID The SecHub jobUUID. During the job creation this unique job + * identifier is automatically generated by SecHub. (required) + * @param checkSum A sha256 checksum for file upload validation (required) + * @param file File to upload... + * @throws ApiException if fails to make API call + */ + public void userUploadsSourceCode(String projectId, UUID jobUUID, String checkSum, Path file) throws ApiException { + userUploadsSourceCodeWithHttpInfo(projectId, jobUUID, checkSum, file); + } + + /** + * User uploads source code User uploads source code + * + * @param projectId The id of the project where sourcecode shall be uploaded for + * (required) + * @param jobUUID The SecHub jobUUID. During the job creation this unique job + * identifier is automatically generated by SecHub. (required) + * @param checkSum A sha256 checksum for file upload validation (required) + * @param file File to upload... + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse userUploadsSourceCodeWithHttpInfo(String projectId, UUID jobUUID, String checkSum, Path file) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = userUploadsSourceCodeRequestBuilder(projectId, jobUUID, checkSum, file); + try { + HttpResponse localVarResponse = memberVarHttpClient.send(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode() / 100 != 2) { + throw getApiException("userUploadsSourceCode", localVarResponse); + } + return new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder userUploadsSourceCodeRequestBuilder(String projectId, UUID jobUUID, String checkSum, Path file) throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException(400, "Missing the required parameter 'projectId' when calling userUploadsSourceCode"); + } + // verify the required parameter 'jobUUID' is set + if (jobUUID == null) { + throw new ApiException(400, "Missing the required parameter 'jobUUID' when calling userUploadsSourceCode"); + } + // verify the required parameter 'checkSum' is set + if (checkSum == null) { + throw new ApiException(400, "Missing the required parameter 'checkSum' when calling userUploadsSourceCode"); + } + // verify the required parameter 'file' is set + if (file == null) { + throw new ApiException(400, "Missing the required parameter 'file' when calling userUploadsSourceCode"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/project/{projectId}/job/{jobUUID}/sourcecode".replace("{projectId}", ApiClient.urlEncode(projectId.toString())) + .replace("{jobUUID}", ApiClient.urlEncode(jobUUID.toString())); + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + /* workaround4 - we need no query params */ + // generated but wrong: + // localVarQueryParams.addAll(ApiClient.parameterToPairs("checkSum", checkSum)); + /* workaround 4 end */ + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + /* workaround3 start: upload the given file ... */ + /* @formatter:off */ + MultiPartBodyPublisherBuilder builder = new MultiPartBodyPublisherBuilder(). + addFile(CommonConstants.MULTIPART_FILE, file). + addString(CommonConstants.MULTIPART_CHECKSUM, checkSum); + + HttpRequest.BodyPublisher publisher = builder.build(); + + localVarRequestBuilder.setHeader("Content-Type","multipart/form-data;boundary="+builder.getBoundary()); + + /* @formatter:on */ + localVarRequestBuilder.POST(publisher); + /* workaround3 end */ + + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Admin downloads all details about a scan job An administrator downloads a ZIP + * file containing full details of a scan. Main reason for this use case is for + * debugging when there are problems with security products. Another reason is + * for developers to adopt new security products easier. + * + * @param jobUUID The job UUID (required) + * @param targetFile The target file to write the downloaded data to (required) + * @return Object + * @throws ApiException if fails to make API call + */ + public void adminDownloadsFullScanDataForJob(UUID jobUUID, File targetFile) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = adminDownloadsFullScanDataForJobRequestBuilder(jobUUID); + try { + HttpResponse localVarResponse = memberVarHttpClient.send(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode() / 100 != 2) { + throw getApiException("adminDownloadsFullScanDataForJob", localVarResponse); + } + try (FileOutputStream out = new FileOutputStream(targetFile)) { + localVarResponse.body().transferTo(out); + } + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder adminDownloadsFullScanDataForJobRequestBuilder(UUID jobUUID) throws ApiException { + // verify the required parameter 'jobUUID' is set + if (jobUUID == null) { + throw new ApiException(400, "Missing the required parameter 'jobUUID' when calling adminDownloadsFullScanDataForJob"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/admin/scan/download/{jobUUID}".replace("{jobUUID}", ApiClient.urlEncode(jobUUID.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/zip"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + private ApiException getApiException(String operationId, HttpResponse response) throws IOException { + String body = response.body() == null ? null : new String(response.body().readAllBytes()); + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + +} diff --git a/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubReportException.java b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubReportException.java new file mode 100644 index 0000000000..3f56db7e29 --- /dev/null +++ b/sechub-openapi-java-client/src/main/java/com/mercedesbenz/sechub/api/SecHubReportException.java @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.api; + +public class SecHubReportException extends Exception { + private static final long serialVersionUID = 3145080055023035667L; + + public SecHubReportException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sechub-openapi-java/src/main/resources/openapi.yaml b/sechub-openapi-java/src/main/resources/openapi.yaml index e88679284c..02abce255b 100644 --- a/sechub-openapi-java/src/main/resources/openapi.yaml +++ b/sechub-openapi-java/src/main/resources/openapi.yaml @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -openapi: 3.0.3 +openapi: 3.1.0 info: title: SecHub API @@ -49,6 +49,7 @@ components: URI: title: URI type: string + format: uri example: "https://example.com" ######################### @@ -286,7 +287,8 @@ components: properties: labels: type: object - additionalProperties: true + additionalProperties: + type: string SecHubFileSystemConfiguration: title: SecHubFileSystemConfiguration @@ -431,6 +433,11 @@ components: type: array items: type: string + use: + description: A set containing names of data configurations which shall be used + type: array + items: + type: string SecHubCodeScanConfiguration: title: SecHubCodeScanConfiguration @@ -496,7 +503,8 @@ components: properties: duration: description: Duration of the scan as integer - type: number + type: integer + format: int32 unit: $ref: '#/components/schemas/SecHubTimeUnit' required: @@ -648,6 +656,11 @@ components: $ref: '#/components/schemas/SecHubWebScanApiConfiguration' url: $ref: '#/components/schemas/URI' + use: + description: A set containing names of data configurations which shall be used + type: array + items: + type: string includes: description: "Include URL sub-paths to scan. Example: /hidden" type: array @@ -703,6 +716,14 @@ components: type: string format: uuid + ScheduleJobStatusResult: + title: ScheduleJobStatusResult + type: string + enum: + - NONE + - OK + - FAILED + ScheduleJobStatus: title: JobStatus type: object @@ -717,21 +738,18 @@ components: created: description: Creation timestamp of job type: string - format: date-time started: description: Start timestamp of job execution type: string - format: date-time ended: description: End timestamp of job execution type: string - format: date-time state: description: State of job type: string result: - description: Result of job - type: string + $ref: '#/components/schemas/ScheduleJobStatusResult' + trafficLight: description: Traffic light of job after completion. Possible states are GREEN, YELLOW, RED, OFF. type: string @@ -739,7 +757,7 @@ components: description: List of messages type: array items: - type: string + $ref: '#/components/schemas/SecHubMessage' SecHubMessageType: title: SecHubMessageType @@ -791,9 +809,11 @@ components: location: type: string line: - type: number + type: integer + format: int32 column: - type: number + type: integer + format: int32 source: type: string relevantPart: @@ -805,15 +825,15 @@ components: title: ScanType type: string enum: - - CODE_SCAN - - WEB_SCAN - - INFRA_SCAN - - LICENSE_SCAN - - SECRET_SCAN - - REPORT - - ANALYTICS - - PREPARE - - UNKNOWN + - codeScan + - webScan + - infraScan + - licenseScan + - secretScan + - report + - analytics + - prepare + - unknown SecHubReportWebBody: title: SecHubReportWebBody @@ -847,7 +867,8 @@ components: type: object properties: statusCode: - type: number + type: integer + format: int32 reasonPhrase: type: string protocol: @@ -860,7 +881,8 @@ components: type: object properties: startLine: - type: number + type: integer + format: int32 SecHubReportWebEvidence: title: SecHubReportWebEvidence @@ -903,7 +925,8 @@ components: type: object properties: id: - type: number + type: integer + format: int32 description: type: string hostNames: @@ -948,7 +971,8 @@ components: type: $ref: '#/components/schemas/ScanType' cweId: - type: number + type: integer + format: int32 cveId: description: common vulnerability enumeration id - see https://cwe.mitre.org/ or null when not defined type: string @@ -964,7 +988,8 @@ components: type: object properties: count: - type: number + type: integer + format: int32 findings: type: array items: @@ -990,47 +1015,68 @@ components: type: object properties: cweId: - type: number + type: integer + format: int32 name: type: string count: - type: number + type: integer + format: int32 ScanTypeSummaryDetailData: title: ScanTypeSummaryDetailData type: object properties: critical: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' high: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' medium: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' low: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' unclassified: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' info: - $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' + type: array + items: + $ref: '#/components/schemas/ScanTypeSummaryFindingOverviewData' SecHubReportScanTypeSummary: title: SecHubReportScanTypeSummary type: object properties: total: - type: number + type: integer + format: int32 critical: - type: number + type: integer + format: int32 high: - type: number + type: integer + format: int32 medium: - type: number + type: integer + format: int32 low: - type: number + type: integer + format: int32 unclassified: - type: number + type: integer + format: int32 info: - type: number + type: integer + format: int32 details: $ref: '#/components/schemas/ScanTypeSummaryDetailData' @@ -1061,7 +1107,7 @@ components: summary: $ref: '#/components/schemas/SecHubReportSummary' - ScanSecHubReport: + SecHubReport: title: ScanSecHubReport description: Result of the SecHub scan type: object @@ -1162,7 +1208,8 @@ components: evidence: type: string statusCode: - type: number + type: integer + format: int32 FalsePositiveWebMetaData: title: FalsePositiveWebMetaData @@ -1195,7 +1242,8 @@ components: cweId: description: CWE (common weakness enumeration). For code scans this is always set. - type: number + type: integer + format: int32 cveId: description: CVE (common vulnerability and exposures). For infra scans this is always set. @@ -1236,7 +1284,8 @@ components: \ job which shall be markeda as a false positive. *ATTENTION*: at the\ \ moment only code scan false positive handling is supported. Infra and\ \ web scan findings will lead to a non accepted error!" - type: number + type: integer + format: int32 comment: description: A comment from author describing why this was marked as a false positive type: string @@ -1244,40 +1293,39 @@ components: jobUUID: jobUUID findingId: 1 comment: comment - + WebscanFalsePositiveProjectData: title: WebscanFalsePositiveProjectData description: Project data parts, that identify false positives of webscans type: object properties: cweId: - required: true description: CWE ID for a category of findings to identify the type of false positive finding type: integer format: int32 urlPattern: - required: true description: list of host name or ip address patterns this false positive entry shall match (can contain wildcards) type: string methods: - required: false description: list of (HTTP) methods this false positive entry shall match (does not use wildcards) type: array items: type: string + required: + - cweId + - urlPattern example: cweId: 79 urlPattern: https://*.example.com/api/*/search methods: [GET, DELETE] - - + + FalsePositiveProjectData: title: FalsePositiveProjectData description: Project data parts, can be used to specify patterns that indentify false positives type: object properties: id: - required: true description: ID to identify this entry, can be used to overwrite or delete the entry for this project type: string comment: @@ -1285,6 +1333,8 @@ components: type: string webScan: $ref: '#/components/schemas/WebscanFalsePositiveProjectData' + required: + - id example: id: unique-id comment: comment @@ -1292,7 +1342,7 @@ components: cweId: 79 urlPattern: https://*.example.com/api/*/search methods: [GET, DELETE] - + FalsePositiveEntry: title: FalsePositiveEntry type: object @@ -1341,7 +1391,7 @@ components: created: created FalsePositiveProjectConfiguration: - title: FalsePositives + title: FalsePositiveProjectConfiguration type: object properties: falsePositives: @@ -1457,7 +1507,8 @@ components: description: Email address type: string version: - type: number + type: integer + format: int32 SignUpList: title: SignUpList @@ -1506,7 +1557,8 @@ components: type: object version: description: The version - type: number + type: integer + format: int32 ############# ## Testing ## @@ -1595,7 +1647,7 @@ components: title: ProductExecutorConfigSetup type: object properties: - baseUrl: + baseURL: type: string credentials: $ref: '#/components/schemas/ProductExecutorConfigSetupCredentials' @@ -1612,8 +1664,11 @@ components: type: string description: type: string + enabled: + type: boolean version: - type: number + type: integer + format: int32 configurations: type: array items: @@ -1627,7 +1682,7 @@ components: title: ProductExecutorConfig type: object properties: - uUID: + uuid: type: string format: uuid name: @@ -1637,9 +1692,11 @@ components: setup: $ref: '#/components/schemas/ProductExecutorConfigSetup' version: - type: number + type: integer + format: int32 executorVersion: - type: number + type: integer + format: int32 enabled: type: boolean profiles: @@ -1706,7 +1763,8 @@ components: unit: $ref: '#/components/schemas/CountableInDaysTimeUnit' amount: - type: number + type: integer + format: int32 AdministrationAutoCleanupConfig: title: AdministrationAutoCleanupConfig @@ -1714,7 +1772,7 @@ components: properties: cleanupTime: $ref: '#/components/schemas/CleanupTime' - + ################ ## Encryption ## ################ @@ -1724,17 +1782,17 @@ components: enum: - NONE - ENVIRONMENT_VARIABLE - + SecHubPasswordSource: title: SecHubPasswordSource type: object - properties: - type: - type: object - $ref: '#/components/schemas/SecHubCipherPasswordSourceType' - data: - type: string - + properties: + type: + type: object + $ref: '#/components/schemas/SecHubCipherPasswordSourceType' + data: + type: string + SecHubCipherAlgorithm: title: SecHubCipherAlgorithm type: string @@ -1742,17 +1800,17 @@ components: - NONE - AES_GCM_SIV_128 - AES_GCM_SIV_256 - + SecHubDomainEncryptionData: title: SecHubDomainEncryptionData type: object properties: - id: + id: description: Identifer for encryption configuration inside the domain type: string algorithm: - type: object - $ref: '#/components/schemas/SecHubCipherAlgorithm' + type: object + $ref: '#/components/schemas/SecHubCipherAlgorithm' passwordSource: type: object $ref: '#/components/schemas/SecHubPasswordSource' @@ -1767,7 +1825,7 @@ components: description: Generic information about encryption usages inside domain type: object additionalProperties: true - + SecHubDomainEncryptionStatus: title: SecHubDomainEncryptionStatus type: object @@ -1776,32 +1834,32 @@ components: type: string data: type: array - items: + items: $ref: '#/components/schemas/SecHubDomainEncryptionData' - + SecHubEncryptionStatus: title: SecHubEncryptionStatus type: object properties: - type: + type: type: string domains: type: array items: $ref: '#/components/schemas/SecHubDomainEncryptionStatus' - + SecHubEncryptionData: title: SecHubEncryptionData type: object properties: algorithm: description: Algorithm to use for encryption rotation - type: object - $ref: '#/components/schemas/SecHubCipherAlgorithm' + type: object + $ref: '#/components/schemas/SecHubCipherAlgorithm' passwordSourceType: description: Password source type to use for algorithm type: object - $ref: '#/components/schemas/SecHubCipherPasswordSourceType' + $ref: '#/components/schemas/SecHubCipherPasswordSourceType' passwordSourceData: description: Password source data for used type. E.g. for ENVIRONMENT_VARIABLE the name of the variable type: string @@ -1818,7 +1876,8 @@ components: value: type: string version: - type: number + type: integer + format: int32 ServerRuntimeData: title: ServerRuntimeData @@ -2482,24 +2541,35 @@ paths: required: true schema: type: string - - name: file - description: The file to upload - in: query - required: true - schema: - type: string - format: binary + format: uuid - name: checkSum description: A sha256 checksum for file upload validation in: query required: true schema: type: string + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The zip file to upload + required: + - file + encoding: + file: + contentType: application/zip responses: "200": description: "Ok" "406": description: "Not acceptable" + x-content-type: multipart/form-data tags: - SecHub Execution @@ -2591,10 +2661,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ScanSecHubReport' + $ref: '#/components/schemas/SecHubReport' text/html;charset=UTF-8: schema: - $ref: '#/components/schemas/ScanSecHubReport' + $ref: '#/components/schemas/SecHubReport' description: "200" tags: - SecHub Execution @@ -2615,12 +2685,14 @@ paths: required: true schema: type: string + format: uuid responses: "200": content: application/zip: schema: - type: object + type: string + format: binary description: "200" tags: - SecHub Execution @@ -2653,7 +2725,7 @@ paths: - SecHub Execution x-content-type: application/json put: - description: User marks false positives + description: User marks false positives operationId: userMarkFalsePositives parameters: - description: The projectId of the project where users adds false positives @@ -2688,7 +2760,7 @@ paths: delete: summary: User unmarks existing false positive definitons description: User unmarks existing false positive definitons - operationId: userUnmarkFalsePositives + operationId: userUnmarksJobFalsePositives parameters: - name: projectId description: The project id @@ -2723,7 +2795,7 @@ paths: delete: summary: User unmarks existing false positive definitons description: User unmarks existing false positive definitons - operationId: userUnmarkFalsePositives + operationId: userUnmarksFalsePositives parameters: - name: projectId description: The project id @@ -2769,6 +2841,13 @@ paths: schema: type: string format: uuid + - name: file + description: The file to upload + in: query + required: true + schema: + type: string + format: binary - name: x-file-size description: The file size of the tar-archive to upload in bytes. Needs to be a positive integer value. @@ -2776,6 +2855,12 @@ paths: required: true schema: type: string + - name: checkSum + description: A sha256 checksum for file upload validation + in: query + required: true + schema: + type: string responses: "200": description: "Ok" @@ -2810,7 +2895,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ScanSecHubReport' + $ref: '#/components/schemas/SecHubReport' description: "Ok" "404": description: "Not found" @@ -3131,7 +3216,7 @@ paths: post: summary: Admin creates an executor configuration description: An administrator creates an executor a new configuration entry. - operationId: adminCreatExecutorConfiguration + operationId: adminCreateExecutorConfiguration requestBody: content: application/json;charset=UTF-8: @@ -3140,17 +3225,14 @@ paths: responses: "201": content: - application/json: + text/plain: schema: type: string - format: uuid description: "Created" "406": description: "Not acceptable" tags: - Configuration - x-content-type: application/json;charset=UTF-8 - x-accepts: application/json /api/admin/config/executors: get: @@ -3444,20 +3526,22 @@ paths: ################ ## Encryption ## ################ + /api/admin/encryption/status: get: - summary: Admin fetches encryption status + summary: Admin fetches encryption status description: "An administrator fetches encryption status from all domains where encryption is used." operationId: adminFetchesEncryptionStatus responses: "200": + description: "Ok" content: application/json: schema: $ref: '#/components/schemas/SecHubEncryptionStatus' tags: - Encryption - + /api/admin/encryption/rotate: post: summary: Admin starts encryption rotation @@ -3470,11 +3554,11 @@ paths: $ref: '#/components/schemas/SecHubEncryptionData' responses: "200": - description: "Ok" + description: "Ok" x-accepts: application/json tags: - Encryption - + ########### ## Other ## ########### diff --git a/sechub-pds-solutions/checkmarx/01-start-single-docker-compose.sh b/sechub-pds-solutions/checkmarx/01-start-single-docker-compose.sh index 04d06043c8..614ae051ed 100755 --- a/sechub-pds-solutions/checkmarx/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/checkmarx/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/checkmarx/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/checkmarx/05-start-single-sechub-network-docker-compose.sh index 978cf353ef..fc558fba6a 100755 --- a/sechub-pds-solutions/checkmarx/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/checkmarx/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/checkmarx/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/checkmarx/50-start-multiple-docker-compose.sh index 13c9bcb599..5c4425bb28 100755 --- a/sechub-pds-solutions/checkmarx/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/checkmarx/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/checkmarx/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/checkmarx/51-start-multiple-object-storage-docker-compose.sh index 7170df27ee..9f2295c284 100755 --- a/sechub-pds-solutions/checkmarx/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/checkmarx/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx.sh b/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx.sh index 18fdc66a6d..2140b96f68 100755 --- a/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx.sh +++ b/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r checkmarx_wrapper="$TOOL_FOLDER/sechub-wrapper-checkmarx.jar" diff --git a/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx_mock.sh b/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx_mock.sh index 5e4f8218b0..8945f86a5c 100755 --- a/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx_mock.sh +++ b/sechub-pds-solutions/checkmarx/docker/scripts/checkmarx_mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT echo "################################" diff --git a/sechub-pds-solutions/findsecuritybugs/01-start-single-docker-compose.sh b/sechub-pds-solutions/findsecuritybugs/01-start-single-docker-compose.sh index bb4e7dec13..ddf07124a6 100755 --- a/sechub-pds-solutions/findsecuritybugs/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/findsecuritybugs/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/findsecuritybugs/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/findsecuritybugs/05-start-single-sechub-network-docker-compose.sh index 8861ec49fc..b68593069c 100755 --- a/sechub-pds-solutions/findsecuritybugs/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/findsecuritybugs/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/findsecuritybugs/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/findsecuritybugs/05-stop-single-sechub-network-docker-compose.sh index 2a402e96c1..76ee94a533 100755 --- a/sechub-pds-solutions/findsecuritybugs/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/findsecuritybugs/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/findsecuritybugs/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/findsecuritybugs/50-start-multiple-docker-compose.sh index fe160fc197..fac788712b 100755 --- a/sechub-pds-solutions/findsecuritybugs/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/findsecuritybugs/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/findsecuritybugs/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/findsecuritybugs/51-start-multiple-object-storage-docker-compose.sh index 20254aa8fc..bcd3d6297f 100755 --- a/sechub-pds-solutions/findsecuritybugs/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/findsecuritybugs/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/findsecuritybugs/docker/findsecbugs_sechub.sh b/sechub-pds-solutions/findsecuritybugs/docker/findsecbugs_sechub.sh index 71d3dd19d9..3759c3383c 100644 --- a/sechub-pds-solutions/findsecuritybugs/docker/findsecbugs_sechub.sh +++ b/sechub-pds-solutions/findsecuritybugs/docker/findsecbugs_sechub.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # This is copied from the findsecbugs.sh folder diff --git a/sechub-pds-solutions/findsecuritybugs/docker/scripts/findsecuritybugs.sh b/sechub-pds-solutions/findsecuritybugs/docker/scripts/findsecuritybugs.sh index fbe5663960..76c712eae2 100755 --- a/sechub-pds-solutions/findsecuritybugs/docker/scripts/findsecuritybugs.sh +++ b/sechub-pds-solutions/findsecuritybugs/docker/scripts/findsecuritybugs.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source "${HELPER_FOLDER}/message.sh" diff --git a/sechub-pds-solutions/findsecuritybugs/tests/download_test_files.sh b/sechub-pds-solutions/findsecuritybugs/tests/download_test_files.sh index d6a8ead7ae..02fbc6c2e0 100755 --- a/sechub-pds-solutions/findsecuritybugs/tests/download_test_files.sh +++ b/sechub-pds-solutions/findsecuritybugs/tests/download_test_files.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/gitleaks/01-start-single-docker-compose.sh b/sechub-pds-solutions/gitleaks/01-start-single-docker-compose.sh index 8421d75d90..1b8dae47c4 100755 --- a/sechub-pds-solutions/gitleaks/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/gitleaks/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/gitleaks/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/gitleaks/05-start-single-sechub-network-docker-compose.sh index 06de28a6b8..52a8cebade 100755 --- a/sechub-pds-solutions/gitleaks/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/gitleaks/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-pds-solutions/gitleaks/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/gitleaks/05-stop-single-sechub-network-docker-compose.sh index df4bb9212e..57cc3a1400 100755 --- a/sechub-pds-solutions/gitleaks/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/gitleaks/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/gitleaks/tests/clone_repo.sh b/sechub-pds-solutions/gitleaks/tests/clone_repo.sh index 9041ddd9ae..03531fce87 100755 --- a/sechub-pds-solutions/gitleaks/tests/clone_repo.sh +++ b/sechub-pds-solutions/gitleaks/tests/clone_repo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/gitleaks/tests/copy_sanitycheck_files.sh b/sechub-pds-solutions/gitleaks/tests/copy_sanitycheck_files.sh index 348608406d..8f8f216125 100755 --- a/sechub-pds-solutions/gitleaks/tests/copy_sanitycheck_files.sh +++ b/sechub-pds-solutions/gitleaks/tests/copy_sanitycheck_files.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/gosec/01-start-single-docker-compose.sh b/sechub-pds-solutions/gosec/01-start-single-docker-compose.sh index 79ffb53743..c40b7b4762 100755 --- a/sechub-pds-solutions/gosec/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/gosec/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/gosec/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/gosec/05-start-single-sechub-network-docker-compose.sh index ea77efc662..d1d3a88103 100755 --- a/sechub-pds-solutions/gosec/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/gosec/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/gosec/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/gosec/05-stop-single-sechub-network-docker-compose.sh index 3e833d8ab3..63cdb5c9a4 100755 --- a/sechub-pds-solutions/gosec/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/gosec/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/gosec/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/gosec/50-start-multiple-docker-compose.sh index 11239be445..c52a47f764 100755 --- a/sechub-pds-solutions/gosec/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/gosec/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/gosec/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/gosec/51-start-multiple-object-storage-docker-compose.sh index 6d8599a463..6527b27577 100755 --- a/sechub-pds-solutions/gosec/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/gosec/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/gosec/tests/clone_repo.sh b/sechub-pds-solutions/gosec/tests/clone_repo.sh index f242a23376..2e09c2d034 100755 --- a/sechub-pds-solutions/gosec/tests/clone_repo.sh +++ b/sechub-pds-solutions/gosec/tests/clone_repo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/gosec/tests/copy_sanitycheck_files.sh b/sechub-pds-solutions/gosec/tests/copy_sanitycheck_files.sh index e75c703e84..3466c7b7dd 100755 --- a/sechub-pds-solutions/gosec/tests/copy_sanitycheck_files.sh +++ b/sechub-pds-solutions/gosec/tests/copy_sanitycheck_files.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/iac/01-start-single-docker-compose.sh b/sechub-pds-solutions/iac/01-start-single-docker-compose.sh index 271c75ab06..c725e8d1ce 100755 --- a/sechub-pds-solutions/iac/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/iac/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/iac/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/iac/05-start-single-sechub-network-docker-compose.sh index 29fef271a0..717ae7a2f5 100755 --- a/sechub-pds-solutions/iac/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/iac/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/iac/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/iac/05-stop-single-sechub-network-docker-compose.sh index 9bf24ce2d1..2aeaa8fc7b 100755 --- a/sechub-pds-solutions/iac/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/iac/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/iac/20-push-image.sh b/sechub-pds-solutions/iac/20-push-image.sh index 7e70d6e330..746a7368e8 100755 --- a/sechub-pds-solutions/iac/20-push-image.sh +++ b/sechub-pds-solutions/iac/20-push-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-pds-solutions/iac/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/iac/50-start-multiple-docker-compose.sh index 541a12f27c..cb169e23aa 100755 --- a/sechub-pds-solutions/iac/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/iac/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/iac/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/iac/51-start-multiple-object-storage-docker-compose.sh index 20617ddbc6..d19293e765 100755 --- a/sechub-pds-solutions/iac/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/iac/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/iac/tests/clone_repo.sh b/sechub-pds-solutions/iac/tests/clone_repo.sh index 9041ddd9ae..03531fce87 100755 --- a/sechub-pds-solutions/iac/tests/clone_repo.sh +++ b/sechub-pds-solutions/iac/tests/clone_repo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/iac/tests/copy_sanitycheck_files.sh b/sechub-pds-solutions/iac/tests/copy_sanitycheck_files.sh index 348608406d..8f8f216125 100755 --- a/sechub-pds-solutions/iac/tests/copy_sanitycheck_files.sh +++ b/sechub-pds-solutions/iac/tests/copy_sanitycheck_files.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/loc/01-start-single-docker-compose.sh b/sechub-pds-solutions/loc/01-start-single-docker-compose.sh index dec0f3c2b4..2d9d78d1b5 100755 --- a/sechub-pds-solutions/loc/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/loc/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/loc/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/loc/05-start-single-sechub-network-docker-compose.sh index 11d49989f4..5f09a145b7 100755 --- a/sechub-pds-solutions/loc/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/loc/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/loc/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/loc/50-start-multiple-docker-compose.sh index 0e2d9d4339..2d044b7d86 100755 --- a/sechub-pds-solutions/loc/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/loc/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/loc/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/loc/51-start-multiple-object-storage-docker-compose.sh index 79b717b408..cdf9c78721 100755 --- a/sechub-pds-solutions/loc/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/loc/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/loc/docker/scripts/cloc.sh b/sechub-pds-solutions/loc/docker/scripts/cloc.sh index cd9e2ff07f..dd187a9f5e 100755 --- a/sechub-pds-solutions/loc/docker/scripts/cloc.sh +++ b/sechub-pds-solutions/loc/docker/scripts/cloc.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT extracted_folder="" diff --git a/sechub-pds-solutions/multi/01-start-single-docker-compose.sh b/sechub-pds-solutions/multi/01-start-single-docker-compose.sh index c721bbd97c..e262c5567c 100755 --- a/sechub-pds-solutions/multi/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/multi/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/multi/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/multi/05-start-single-sechub-network-docker-compose.sh index bfe041c829..094333dcd1 100644 --- a/sechub-pds-solutions/multi/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/multi/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/multi/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/multi/05-stop-single-sechub-network-docker-compose.sh index 50386a485d..e652960648 100644 --- a/sechub-pds-solutions/multi/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/multi/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/multi/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/multi/50-start-multiple-docker-compose.sh index 1f12ac6634..c6d6a92be8 100755 --- a/sechub-pds-solutions/multi/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/multi/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/multi/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/multi/51-start-multiple-object-storage-docker-compose.sh index 33ccfb6da1..3ff59458e0 100755 --- a/sechub-pds-solutions/multi/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/multi/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/multi/tests/clone_repo.sh b/sechub-pds-solutions/multi/tests/clone_repo.sh index f242a23376..2e09c2d034 100644 --- a/sechub-pds-solutions/multi/tests/clone_repo.sh +++ b/sechub-pds-solutions/multi/tests/clone_repo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT current_test_folder="$1" diff --git a/sechub-pds-solutions/owaspzap/01-start-single-docker-compose.sh b/sechub-pds-solutions/owaspzap/01-start-single-docker-compose.sh index f6b6a11074..a940576189 100755 --- a/sechub-pds-solutions/owaspzap/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/owaspzap/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/owaspzap/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/owaspzap/05-start-single-sechub-network-docker-compose.sh index 5be22b3a1d..577c6593c6 100755 --- a/sechub-pds-solutions/owaspzap/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/owaspzap/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/owaspzap/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/owaspzap/05-stop-single-sechub-network-docker-compose.sh index 668b3e6ee9..9bef5aa550 100755 --- a/sechub-pds-solutions/owaspzap/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/owaspzap/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/owaspzap/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/owaspzap/50-start-multiple-docker-compose.sh index b4bdeebb44..835b71e423 100755 --- a/sechub-pds-solutions/owaspzap/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/owaspzap/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/owaspzap/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/owaspzap/51-start-multiple-object-storage-docker-compose.sh index d1b353c9dd..8adad42761 100755 --- a/sechub-pds-solutions/owaspzap/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/owaspzap/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/owaspzap/70-test-webscan.sh b/sechub-pds-solutions/owaspzap/70-test-webscan.sh index e6550bb58d..61493b15a6 100755 --- a/sechub-pds-solutions/owaspzap/70-test-webscan.sh +++ b/sechub-pds-solutions/owaspzap/70-test-webscan.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT target_url_or_config="$1" diff --git a/sechub-pds-solutions/owaspzap/docker/scripts/owasp-zap.sh b/sechub-pds-solutions/owaspzap/docker/scripts/owasp-zap.sh index 5d05761c01..2168042335 100755 --- a/sechub-pds-solutions/owaspzap/docker/scripts/owasp-zap.sh +++ b/sechub-pds-solutions/owaspzap/docker/scripts/owasp-zap.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT shutdownZAP() { diff --git a/sechub-pds-solutions/pds-base/01-start-single-docker-compose.sh b/sechub-pds-solutions/pds-base/01-start-single-docker-compose.sh index 9aabd6626c..affbefeb08 100755 --- a/sechub-pds-solutions/pds-base/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/pds-base/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/pds-base/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/pds-base/05-start-single-sechub-network-docker-compose.sh index 4934e54796..abf7a41c33 100755 --- a/sechub-pds-solutions/pds-base/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/pds-base/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/pds-base/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/pds-base/05-stop-single-sechub-network-docker-compose.sh index 5b231647dc..1ff736d6c6 100755 --- a/sechub-pds-solutions/pds-base/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/pds-base/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/pds-base/10-create-image.sh b/sechub-pds-solutions/pds-base/10-create-image.sh index a5cc81a1c9..88154adfd3 100755 --- a/sechub-pds-solutions/pds-base/10-create-image.sh +++ b/sechub-pds-solutions/pds-base/10-create-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REGISTRY="$1" diff --git a/sechub-pds-solutions/pds-base/20-push-image.sh b/sechub-pds-solutions/pds-base/20-push-image.sh index 7e70d6e330..746a7368e8 100755 --- a/sechub-pds-solutions/pds-base/20-push-image.sh +++ b/sechub-pds-solutions/pds-base/20-push-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-pds-solutions/pds-base/docker/scripts/pds.sh b/sechub-pds-solutions/pds-base/docker/scripts/pds.sh index c2b7f0d354..d2bc8deddd 100755 --- a/sechub-pds-solutions/pds-base/docker/scripts/pds.sh +++ b/sechub-pds-solutions/pds-base/docker/scripts/pds.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source "$HELPER_FOLDER/message.sh" diff --git a/sechub-pds-solutions/pds-base/tests/start_pds_helper.sh b/sechub-pds-solutions/pds-base/tests/start_pds_helper.sh index 6c9f34f35f..0c66fd0776 100755 --- a/sechub-pds-solutions/pds-base/tests/start_pds_helper.sh +++ b/sechub-pds-solutions/pds-base/tests/start_pds_helper.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT function start_pds() { diff --git a/sechub-pds-solutions/phan/01-start-single-docker-compose.sh b/sechub-pds-solutions/phan/01-start-single-docker-compose.sh index 0aa48c8608..83bf3a8356 100755 --- a/sechub-pds-solutions/phan/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/phan/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/pmd/01-start-single-docker-compose.sh b/sechub-pds-solutions/pmd/01-start-single-docker-compose.sh index 59b6031c8d..94f90bcc90 100755 --- a/sechub-pds-solutions/pmd/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/pmd/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/pmd/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/pmd/05-start-single-sechub-network-docker-compose.sh index 018d664ea6..c29cbe3345 100755 --- a/sechub-pds-solutions/pmd/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/pmd/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/prepare/01-start-single-docker-compose.sh b/sechub-pds-solutions/prepare/01-start-single-docker-compose.sh index 79fa227eea..db67d600cd 100755 --- a/sechub-pds-solutions/prepare/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/prepare/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/prepare/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/prepare/05-start-single-sechub-network-docker-compose.sh index aa709de205..da58e7017c 100755 --- a/sechub-pds-solutions/prepare/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/prepare/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/prepare/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/prepare/05-stop-single-sechub-network-docker-compose.sh index 1028dda8b7..b44867b9ed 100755 --- a/sechub-pds-solutions/prepare/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/prepare/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/prepare/docker/scripts/prepare.sh b/sechub-pds-solutions/prepare/docker/scripts/prepare.sh index 59079d2dbd..eb779ee2ca 100755 --- a/sechub-pds-solutions/prepare/docker/scripts/prepare.sh +++ b/sechub-pds-solutions/prepare/docker/scripts/prepare.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT prepare_wrapper="$TOOL_FOLDER/sechub-wrapper-prepare.jar" diff --git a/sechub-pds-solutions/prepare/docker/scripts/prepare_mock.sh b/sechub-pds-solutions/prepare/docker/scripts/prepare_mock.sh index 5d302a0333..2032dd4954 100755 --- a/sechub-pds-solutions/prepare/docker/scripts/prepare_mock.sh +++ b/sechub-pds-solutions/prepare/docker/scripts/prepare_mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT echo "" diff --git a/sechub-pds-solutions/scancode/01-start-single-docker-compose.sh b/sechub-pds-solutions/scancode/01-start-single-docker-compose.sh index c2513d8e97..ac9884a867 100755 --- a/sechub-pds-solutions/scancode/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/scancode/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/scancode/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/scancode/05-start-single-sechub-network-docker-compose.sh index 0c27d9af15..6794b1c149 100755 --- a/sechub-pds-solutions/scancode/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/scancode/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/scancode/50-start-multiple-docker-compose.sh b/sechub-pds-solutions/scancode/50-start-multiple-docker-compose.sh index f9dbc04c8f..063d14fcb4 100755 --- a/sechub-pds-solutions/scancode/50-start-multiple-docker-compose.sh +++ b/sechub-pds-solutions/scancode/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/scancode/51-start-multiple-object-storage-docker-compose.sh b/sechub-pds-solutions/scancode/51-start-multiple-object-storage-docker-compose.sh index 2907b8c9d5..72177d9049 100755 --- a/sechub-pds-solutions/scancode/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-pds-solutions/scancode/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REPLICAS="$1" diff --git a/sechub-pds-solutions/scancode/docker/scripts/scancode.sh b/sechub-pds-solutions/scancode/docker/scripts/scancode.sh index 17743c01aa..141eebdfe0 100755 --- a/sechub-pds-solutions/scancode/docker/scripts/scancode.sh +++ b/sechub-pds-solutions/scancode/docker/scripts/scancode.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT function check_env_var_is_set { diff --git a/sechub-pds-solutions/scancode/docker/scripts/scancode_mock.sh b/sechub-pds-solutions/scancode/docker/scripts/scancode_mock.sh index 5ba34bee6a..452d194bbd 100755 --- a/sechub-pds-solutions/scancode/docker/scripts/scancode_mock.sh +++ b/sechub-pds-solutions/scancode/docker/scripts/scancode_mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source "${HELPER_FOLDER}/message.sh" diff --git a/sechub-pds-solutions/scancode/test/generate/generate.sh b/sechub-pds-solutions/scancode/test/generate/generate.sh index 4d5943d0c0..db1f3483d3 100755 --- a/sechub-pds-solutions/scancode/test/generate/generate.sh +++ b/sechub-pds-solutions/scancode/test/generate/generate.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT readonly BUILD_FOLDER="build" diff --git a/sechub-pds-solutions/scancode/test/prepare.sh b/sechub-pds-solutions/scancode/test/prepare.sh index 91a0f6625f..3beb514617 100755 --- a/sechub-pds-solutions/scancode/test/prepare.sh +++ b/sechub-pds-solutions/scancode/test/prepare.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT DOWNLOAD_FOLDER="downloads" diff --git a/sechub-pds-solutions/tern/01-start-single-docker-compose.sh b/sechub-pds-solutions/tern/01-start-single-docker-compose.sh index e1285c8fb8..7c929cd99d 100755 --- a/sechub-pds-solutions/tern/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/tern/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/tern/01-stop-single-docker-compose.sh b/sechub-pds-solutions/tern/01-stop-single-docker-compose.sh index acf46b5b01..67ec2b4a51 100755 --- a/sechub-pds-solutions/tern/01-stop-single-docker-compose.sh +++ b/sechub-pds-solutions/tern/01-stop-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT docker compose --file docker-compose_pds_tern.yaml down \ No newline at end of file diff --git a/sechub-pds-solutions/tern/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/tern/05-start-single-sechub-network-docker-compose.sh index 362c3de3d9..9125e34365 100755 --- a/sechub-pds-solutions/tern/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/tern/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/tern/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/tern/05-stop-single-sechub-network-docker-compose.sh index 06b53b1d12..ffb167988f 100755 --- a/sechub-pds-solutions/tern/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/tern/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT docker compose --file docker-compose_pds_scancode_external-network.yaml down \ No newline at end of file diff --git a/sechub-pds-solutions/tern/deployment/01-start-single-docker-compose.sh b/sechub-pds-solutions/tern/deployment/01-start-single-docker-compose.sh index ef0fc7c13a..af8776eecf 100755 --- a/sechub-pds-solutions/tern/deployment/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/tern/deployment/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env" diff --git a/sechub-pds-solutions/tern/deployment/01-stop-single-docker-compose.sh b/sechub-pds-solutions/tern/deployment/01-stop-single-docker-compose.sh index acf46b5b01..67ec2b4a51 100755 --- a/sechub-pds-solutions/tern/deployment/01-stop-single-docker-compose.sh +++ b/sechub-pds-solutions/tern/deployment/01-stop-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT docker compose --file docker-compose_pds_tern.yaml down \ No newline at end of file diff --git a/sechub-pds-solutions/tern/docker/scripts/tern.sh b/sechub-pds-solutions/tern/docker/scripts/tern.sh index 747cff73c5..f09c6b50a0 100755 --- a/sechub-pds-solutions/tern/docker/scripts/tern.sh +++ b/sechub-pds-solutions/tern/docker/scripts/tern.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source "${HELPER_FOLDER}/message.sh" diff --git a/sechub-pds-solutions/tern/tests/alpine-build-run.sh b/sechub-pds-solutions/tern/tests/alpine-build-run.sh index 5e89488acb..12b89afef5 100755 --- a/sechub-pds-solutions/tern/tests/alpine-build-run.sh +++ b/sechub-pds-solutions/tern/tests/alpine-build-run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT name="sechub-test-alpine" diff --git a/sechub-pds-solutions/tern/tests/build-run.sh b/sechub-pds-solutions/tern/tests/build-run.sh index 1cc54b86f7..39e9f7e353 100644 --- a/sechub-pds-solutions/tern/tests/build-run.sh +++ b/sechub-pds-solutions/tern/tests/build-run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT function build_and_run() { diff --git a/sechub-pds-solutions/tern/tests/debian-build-run.sh b/sechub-pds-solutions/tern/tests/debian-build-run.sh index 49e6bb02cb..2ad9b639d3 100755 --- a/sechub-pds-solutions/tern/tests/debian-build-run.sh +++ b/sechub-pds-solutions/tern/tests/debian-build-run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/tern/tests/minimal-build-run.sh b/sechub-pds-solutions/tern/tests/minimal-build-run.sh index 40e65348ae..9f16205617 100755 --- a/sechub-pds-solutions/tern/tests/minimal-build-run.sh +++ b/sechub-pds-solutions/tern/tests/minimal-build-run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/tern/tests/minimal-go-build-run.sh b/sechub-pds-solutions/tern/tests/minimal-go-build-run.sh index ec0c9c2fee..3a8631c197 100755 --- a/sechub-pds-solutions/tern/tests/minimal-go-build-run.sh +++ b/sechub-pds-solutions/tern/tests/minimal-go-build-run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT name="sechub-test-minimal-go" diff --git a/sechub-pds-solutions/tern/tests/run-suite.sh b/sechub-pds-solutions/tern/tests/run-suite.sh index b6ed128aad..46eb8d5e90 100644 --- a/sechub-pds-solutions/tern/tests/run-suite.sh +++ b/sechub-pds-solutions/tern/tests/run-suite.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source test-tern.sh diff --git a/sechub-pds-solutions/tern/tests/test-tern.sh b/sechub-pds-solutions/tern/tests/test-tern.sh index 4113d6c039..aa54652460 100755 --- a/sechub-pds-solutions/tern/tests/test-tern.sh +++ b/sechub-pds-solutions/tern/tests/test-tern.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT BUILD_FOLDER="build" diff --git a/sechub-pds-solutions/xray/01-start-single-docker-compose.sh b/sechub-pds-solutions/xray/01-start-single-docker-compose.sh index 8109dfef8d..5567a24103 100755 --- a/sechub-pds-solutions/xray/01-start-single-docker-compose.sh +++ b/sechub-pds-solutions/xray/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/xray/05-start-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/xray/05-start-single-sechub-network-docker-compose.sh index dbed65a360..dcc1aa4787 100755 --- a/sechub-pds-solutions/xray/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/xray/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-pds-solutions/xray/05-stop-single-sechub-network-docker-compose.sh b/sechub-pds-solutions/xray/05-stop-single-sechub-network-docker-compose.sh index c6eaf6ea48..4dd00360be 100755 --- a/sechub-pds-solutions/xray/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-pds-solutions/xray/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit 1 diff --git a/sechub-pds-solutions/xray/docker/scripts/xray.sh b/sechub-pds-solutions/xray/docker/scripts/xray.sh index 149ea283fb..c7df08f86a 100755 --- a/sechub-pds-solutions/xray/docker/scripts/xray.sh +++ b/sechub-pds-solutions/xray/docker/scripts/xray.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT function check_env_var_is_set { diff --git a/sechub-pds/src/main/resources/application.yml b/sechub-pds/src/main/resources/application.yml index 1a05f8f0dd..d48e41fce6 100644 --- a/sechub-pds/src/main/resources/application.yml +++ b/sechub-pds/src/main/resources/application.yml @@ -63,11 +63,11 @@ spring: servlet: # MultiPart file-size limits, # https://spring.io/guides/gs/uploading-files/ - multipart.max-file-size: 5MB - multipart.max-request-size: 5MB - multipart.resolve-lazily: true - http: - multipart.enabled: false + multipart: + max-file-size: 5MB + max-request-size: 5MB + resolve-lazily: true + enabled: true # -------------------------------------- # - Security # -------------------------------------- diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/CreateProductExecutorConfigService.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/CreateProductExecutorConfigService.java index 72c885f004..5c6f253454 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/CreateProductExecutorConfigService.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/CreateProductExecutorConfigService.java @@ -60,7 +60,7 @@ public String createProductExecutorConfig(ProductExecutorConfig configFromUser) } private void resetFieldsNeverFromUser(ProductExecutorConfig configFromUser) { - configFromUser.uUID = null; + configFromUser.uuid = null; configFromUser.version = null; } diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutionrProfileValidationImpl.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutionrProfileValidationImpl.java index ee07dce859..8bb64281b2 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutionrProfileValidationImpl.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutionrProfileValidationImpl.java @@ -48,7 +48,7 @@ protected void validate(ValidationContext context) { /* check we got at last a UUID inside each configuration */ for (ProductExecutorConfig config : profile.getConfigurations()) { if (config.getUUID() == null) { - context.addError("config.uuid", "One configuration does not hava UUID key set!"); + context.addError("config.uuid", "One configuration does not have UUID key set!"); break; } } diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfig.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfig.java index 0b72638059..6cb3430913 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfig.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfig.java @@ -10,7 +10,6 @@ import org.hibernate.annotations.GenericGenerator; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; import com.mercedesbenz.sechub.sharedkernel.ProductIdentifier; import jakarta.persistence.Basic; @@ -66,8 +65,7 @@ public class ProductExecutorConfig implements ProductExecutorConfigInfo { @GeneratedValue(generator = "UUID") @GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator") @Column(name = COLUMN_UUID, updatable = false, nullable = false, columnDefinition = "UUID") - @JsonProperty("uuid") - UUID uUID; + UUID uuid; @Column(name = COLUMN_NAME) String name; @@ -113,7 +111,7 @@ public ProductExecutorConfig(ProductIdentifier productIdentifier, int executorVe } public UUID getUUID() { - return uUID; + return uuid; } public ProductIdentifier getProductIdentifier() { @@ -140,7 +138,7 @@ public String getName() { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((uUID == null) ? 0 : uUID.hashCode()); + result = prime * result + ((uuid == null) ? 0 : uuid.hashCode()); return result; } @@ -153,17 +151,17 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) return false; ProductExecutorConfig other = (ProductExecutorConfig) obj; - if (uUID == null) { - if (other.uUID != null) + if (uuid == null) { + if (other.uuid != null) return false; - } else if (!uUID.equals(other.uUID)) + } else if (!uuid.equals(other.uuid)) return false; return true; } @Override public String toString() { - return "ProductExecutorConfig [" + (uUID != null ? "uUID=" + uUID + ", " : "") + (name != null ? "name=" + name + ", " : "") + return "ProductExecutorConfig [" + (uuid != null ? "uUID=" + uuid + ", " : "") + (name != null ? "name=" + name + ", " : "") + (productIdentifier != null ? "productIdentifier=" + productIdentifier + ", " : "") + (executorVersion != null ? "executorVersion=" + executorVersion + ", " : "") + (enabled != null ? "enabled=" + enabled : "") + "]"; } diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigRestController.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigRestController.java index 85e23c65e9..748c981d78 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigRestController.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigRestController.java @@ -64,7 +64,7 @@ public class ProductExecutorConfigRestController { name="Rest call", needsRestDoc=true, description="Administrator adds a new product executor configuration by calling REST API")) - @RequestMapping(path = "executor", method = RequestMethod.POST, produces= {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(path = "executor", method = RequestMethod.POST, produces= {MediaType.TEXT_PLAIN_VALUE}) @ResponseStatus(HttpStatus.CREATED) public String addProductExecutorConfig(@RequestBody ProductExecutorConfig configFromUser) { return createService.createProductExecutorConfig(configFromUser); diff --git a/sechub-schedule/src/main/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestController.java b/sechub-schedule/src/main/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestController.java index ac5f880df9..86a457ef80 100644 --- a/sechub-schedule/src/main/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestController.java +++ b/sechub-schedule/src/main/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestController.java @@ -10,13 +10,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.mercedesbenz.sechub.domain.schedule.job.SecHubJobInfoForUserListPage; @@ -94,7 +88,7 @@ public SchedulerResult createJob(@PathVariable("projectId") String projectId, @R public void uploadSourceCode( @PathVariable("projectId") String projectId, @PathVariable("jobUUID") UUID jobUUID, - @RequestParam(MULTIPART_FILE) MultipartFile file, + @RequestPart(MULTIPART_FILE) MultipartFile file, @RequestParam(MULTIPART_CHECKSUM) String checkSum ) { sourcecodeUploadService.uploadSourceCode(projectId, jobUUID, file, checkSum); diff --git a/sechub-server/src/main/resources/application.yml b/sechub-server/src/main/resources/application.yml index fbd990afe8..8c6db5c83b 100644 --- a/sechub-server/src/main/resources/application.yml +++ b/sechub-server/src/main/resources/application.yml @@ -53,11 +53,11 @@ spring: servlet: # MultiPart file-size limits, # https://spring.io/guides/gs/uploading-files/ - multipart.max-file-size: 5MB - multipart.max-request-size: 5MB - multipart.resolve-lazily: true - http: - multipart.enabled: false + multipart: + max-file-size: 5MB + max-request-size: 5MB + resolve-lazily: true + enabled: true # -------------------------------------- # - Security # -------------------------------------- diff --git a/sechub-solution/01-start-single-docker-compose-alpine.sh b/sechub-solution/01-start-single-docker-compose-alpine.sh index 4bb646e39b..aa927353ad 100755 --- a/sechub-solution/01-start-single-docker-compose-alpine.sh +++ b/sechub-solution/01-start-single-docker-compose-alpine.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-start-single-docker-compose-fedora.sh b/sechub-solution/01-start-single-docker-compose-fedora.sh index f2220b5b98..0b2e39a473 100755 --- a/sechub-solution/01-start-single-docker-compose-fedora.sh +++ b/sechub-solution/01-start-single-docker-compose-fedora.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-start-single-docker-compose-prepare.sh b/sechub-solution/01-start-single-docker-compose-prepare.sh index f02ffd6690..3ea29d09b6 100755 --- a/sechub-solution/01-start-single-docker-compose-prepare.sh +++ b/sechub-solution/01-start-single-docker-compose-prepare.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-start-single-docker-compose-rocky.sh b/sechub-solution/01-start-single-docker-compose-rocky.sh index a141f79337..7afd17a6ab 100755 --- a/sechub-solution/01-start-single-docker-compose-rocky.sh +++ b/sechub-solution/01-start-single-docker-compose-rocky.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-start-single-docker-compose-ubuntu.sh b/sechub-solution/01-start-single-docker-compose-ubuntu.sh index a2dee734fd..63b8c60160 100755 --- a/sechub-solution/01-start-single-docker-compose-ubuntu.sh +++ b/sechub-solution/01-start-single-docker-compose-ubuntu.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-start-single-docker-compose.sh b/sechub-solution/01-start-single-docker-compose.sh index f87b1582fe..245de47cb1 100755 --- a/sechub-solution/01-start-single-docker-compose.sh +++ b/sechub-solution/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT ENVIRONMENT_FILE=".env-single" diff --git a/sechub-solution/01-stop-single-docker-compose.sh b/sechub-solution/01-stop-single-docker-compose.sh index ff9b46b0f0..872ee64afa 100755 --- a/sechub-solution/01-stop-single-docker-compose.sh +++ b/sechub-solution/01-stop-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd "$(dirname "$0")" || exit diff --git a/sechub-solution/10-create-image-alpine.sh b/sechub-solution/10-create-image-alpine.sh index d80484a883..82a559a548 100755 --- a/sechub-solution/10-create-image-alpine.sh +++ b/sechub-solution/10-create-image-alpine.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-solution/10-create-image-debian.sh b/sechub-solution/10-create-image-debian.sh index af190cf20e..1d7054b571 100755 --- a/sechub-solution/10-create-image-debian.sh +++ b/sechub-solution/10-create-image-debian.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-solution/20-push-image.sh b/sechub-solution/20-push-image.sh index c0ab2fb35c..76f6ba2f19 100755 --- a/sechub-solution/20-push-image.sh +++ b/sechub-solution/20-push-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-solution/50-start-multiple-docker-compose.sh b/sechub-solution/50-start-multiple-docker-compose.sh index 8cbd05b02f..2e56affc89 100755 --- a/sechub-solution/50-start-multiple-docker-compose.sh +++ b/sechub-solution/50-start-multiple-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-solution/51-start-multiple-object-storage-docker-compose.sh b/sechub-solution/51-start-multiple-object-storage-docker-compose.sh index 7001e3b742..bc67d5d644 100755 --- a/sechub-solution/51-start-multiple-object-storage-docker-compose.sh +++ b/sechub-solution/51-start-multiple-object-storage-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-solution/docker/clone.sh b/sechub-solution/docker/clone.sh index cf670bd2ac..929cb10c64 100644 --- a/sechub-solution/docker/clone.sh +++ b/sechub-solution/docker/clone.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # SPDX-License-Identifier: MIT GIT_URL="$1" diff --git a/sechub-solution/setup-pds/8800-setup-project-and-user.sh b/sechub-solution/setup-pds/8800-setup-project-and-user.sh index 344b0e1256..1d35f22fc2 100755 --- a/sechub-solution/setup-pds/8800-setup-project-and-user.sh +++ b/sechub-solution/setup-pds/8800-setup-project-and-user.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # creates project with user variable as owner and assign user to project using the sechub-api.sh diff --git a/sechub-solution/setup-pds/8801-create-executor-and-profile.sh b/sechub-solution/setup-pds/8801-create-executor-and-profile.sh index c419ca900d..512936c8f2 100755 --- a/sechub-solution/setup-pds/8801-create-executor-and-profile.sh +++ b/sechub-solution/setup-pds/8801-create-executor-and-profile.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # creates a sechub executor from an executor file and a sechub project diff --git a/sechub-solution/setup-pds/8802-assign-profile-to-project.sh b/sechub-solution/setup-pds/8802-assign-profile-to-project.sh index 54a1e07116..560402c7ac 100755 --- a/sechub-solution/setup-pds/8802-assign-profile-to-project.sh +++ b/sechub-solution/setup-pds/8802-assign-profile-to-project.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # uses the sechub-api.sh script to assign an existing profile to an existing project diff --git a/sechub-solution/setup-pds/8900-helper.sh b/sechub-solution/setup-pds/8900-helper.sh index 3d9899fcc6..e832894cc1 100644 --- a/sechub-solution/setup-pds/8900-helper.sh +++ b/sechub-solution/setup-pds/8900-helper.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # checks if a string is a json array diff --git a/sechub-solution/setup-pds/8901-check-setup.sh b/sechub-solution/setup-pds/8901-check-setup.sh index b0450f7176..1176449feb 100644 --- a/sechub-solution/setup-pds/8901-check-setup.sh +++ b/sechub-solution/setup-pds/8901-check-setup.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT source "8900-helper.sh" diff --git a/sechub-solution/setup-pds/setup-bandit.sh b/sechub-solution/setup-pds/setup-bandit.sh index 47a7daa825..e860a70f5e 100755 --- a/sechub-solution/setup-pds/setup-bandit.sh +++ b/sechub-solution/setup-pds/setup-bandit.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-checkmarx-mock.sh b/sechub-solution/setup-pds/setup-checkmarx-mock.sh index d87be69d86..abccc34971 100755 --- a/sechub-solution/setup-pds/setup-checkmarx-mock.sh +++ b/sechub-solution/setup-pds/setup-checkmarx-mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-checkmarx.sh b/sechub-solution/setup-pds/setup-checkmarx.sh index 3c0b6ce63b..f5e4081173 100755 --- a/sechub-solution/setup-pds/setup-checkmarx.sh +++ b/sechub-solution/setup-pds/setup-checkmarx.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-cloc.sh b/sechub-solution/setup-pds/setup-cloc.sh index 6dbcd57db4..8504df71d9 100755 --- a/sechub-solution/setup-pds/setup-cloc.sh +++ b/sechub-solution/setup-pds/setup-cloc.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-findsecuritybugs.sh b/sechub-solution/setup-pds/setup-findsecuritybugs.sh index 6ed569ab33..917d895c3f 100755 --- a/sechub-solution/setup-pds/setup-findsecuritybugs.sh +++ b/sechub-solution/setup-pds/setup-findsecuritybugs.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-flawfinder.sh b/sechub-solution/setup-pds/setup-flawfinder.sh index 4d7f888dc0..49eb541e3e 100755 --- a/sechub-solution/setup-pds/setup-flawfinder.sh +++ b/sechub-solution/setup-pds/setup-flawfinder.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-gitleaks.sh b/sechub-solution/setup-pds/setup-gitleaks.sh index 63e50e4866..fbcb30ad68 100755 --- a/sechub-solution/setup-pds/setup-gitleaks.sh +++ b/sechub-solution/setup-pds/setup-gitleaks.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-gosec.sh b/sechub-solution/setup-pds/setup-gosec.sh index d76fb2553e..0cb066a15d 100755 --- a/sechub-solution/setup-pds/setup-gosec.sh +++ b/sechub-solution/setup-pds/setup-gosec.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-kics.sh b/sechub-solution/setup-pds/setup-kics.sh index 0fe675e732..7b3cd231f6 100755 --- a/sechub-solution/setup-pds/setup-kics.sh +++ b/sechub-solution/setup-pds/setup-kics.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-mobsfscan.sh b/sechub-solution/setup-pds/setup-mobsfscan.sh index 98248b6669..905c9df904 100755 --- a/sechub-solution/setup-pds/setup-mobsfscan.sh +++ b/sechub-solution/setup-pds/setup-mobsfscan.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-njsscan.sh b/sechub-solution/setup-pds/setup-njsscan.sh index a18fa1e30d..389286ffe2 100755 --- a/sechub-solution/setup-pds/setup-njsscan.sh +++ b/sechub-solution/setup-pds/setup-njsscan.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-owasp-zap.sh b/sechub-solution/setup-pds/setup-owasp-zap.sh index 2f59089cfb..7f1729c139 100755 --- a/sechub-solution/setup-pds/setup-owasp-zap.sh +++ b/sechub-solution/setup-pds/setup-owasp-zap.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-pmd.sh b/sechub-solution/setup-pds/setup-pmd.sh index 7b982d647d..6f9ab6d6b6 100755 --- a/sechub-solution/setup-pds/setup-pmd.sh +++ b/sechub-solution/setup-pds/setup-pmd.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-prepare-mock.sh b/sechub-solution/setup-pds/setup-prepare-mock.sh index d44cc24529..cbff6e3583 100755 --- a/sechub-solution/setup-pds/setup-prepare-mock.sh +++ b/sechub-solution/setup-pds/setup-prepare-mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-prepare.sh b/sechub-solution/setup-pds/setup-prepare.sh index c855770598..964ab66453 100755 --- a/sechub-solution/setup-pds/setup-prepare.sh +++ b/sechub-solution/setup-pds/setup-prepare.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT # Print helpFunction in case parameters are empty diff --git a/sechub-solution/setup-pds/setup-scancode.sh b/sechub-solution/setup-pds/setup-scancode.sh index 0280e5316e..29d6a187a9 100755 --- a/sechub-solution/setup-pds/setup-scancode.sh +++ b/sechub-solution/setup-pds/setup-scancode.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-tern-mock.sh b/sechub-solution/setup-pds/setup-tern-mock.sh index 7c96c15b3b..48a359e5f5 100755 --- a/sechub-solution/setup-pds/setup-tern-mock.sh +++ b/sechub-solution/setup-pds/setup-tern-mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-tern.sh b/sechub-solution/setup-pds/setup-tern.sh index 96f0fed4ac..371da29f03 100755 --- a/sechub-solution/setup-pds/setup-tern.sh +++ b/sechub-solution/setup-pds/setup-tern.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-xray-mock.sh b/sechub-solution/setup-pds/setup-xray-mock.sh index 128b7ac014..33c750350b 100755 --- a/sechub-solution/setup-pds/setup-xray-mock.sh +++ b/sechub-solution/setup-pds/setup-xray-mock.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solution/setup-pds/setup-xray.sh b/sechub-solution/setup-pds/setup-xray.sh index e67e5e6edc..a91cc6e2ef 100755 --- a/sechub-solution/setup-pds/setup-xray.sh +++ b/sechub-solution/setup-pds/setup-xray.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT declare -r SCRIPT_PARAMETERS=" " diff --git a/sechub-solutions-shared/resource-analyzer/record-resources.sh b/sechub-solutions-shared/resource-analyzer/record-resources.sh index 5753b42c39..f84d766c59 100755 --- a/sechub-solutions-shared/resource-analyzer/record-resources.sh +++ b/sechub-solutions-shared/resource-analyzer/record-resources.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT result_file="" diff --git a/sechub-systemtest/build.gradle b/sechub-systemtest/build.gradle index 909efdc009..12f54b8675 100644 --- a/sechub-systemtest/build.gradle +++ b/sechub-systemtest/build.gradle @@ -14,7 +14,7 @@ version = versionData.getServerVersion() dependencies { implementation project(':sechub-pds-commons-core') - implementation project(':sechub-api-java') + implementation project(':sechub-openapi-java-client') implementation project(':sechub-commons-pds') implementation project(':sechub-commons-archive') diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/AssertSechubResultDefinition.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/AssertSechubResultDefinition.java index be38ea1e5a..86d54327be 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/AssertSechubResultDefinition.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/AssertSechubResultDefinition.java @@ -3,7 +3,7 @@ import java.util.Optional; -import com.mercedesbenz.sechub.commons.model.TrafficLight; +import com.mercedesbenz.sechub.api.internal.gen.model.TrafficLight; public class AssertSechubResultDefinition extends AbstractDefinition { diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinition.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinition.java index 91c7bdec2e..b5d1ac2647 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinition.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinition.java @@ -5,12 +5,12 @@ import java.util.List; import java.util.Optional; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationMetaData; -import com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubCodeScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubConfigurationMetaData; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubInfrastructureScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubLicenseScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubSecretScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubWebScanConfiguration; public class RunSecHubJobDefinition extends AbstractDefinition { diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformer.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformer.java index 803bd61aae..16076454bf 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformer.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformer.java @@ -6,11 +6,7 @@ import java.util.List; import java.util.Optional; -import com.mercedesbenz.sechub.commons.model.SecHubBinaryDataConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -import com.mercedesbenz.sechub.commons.model.SecHubDataConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubFileSystemConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSourceDataConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.*; public class RunSecHubJobDefinitionTransformer { @@ -18,12 +14,12 @@ public class RunSecHubJobDefinitionTransformer { * Transforms a given SecHub job definition to a configuration model * * @param definition - * @return {@link SecHubConfigurationModel} instance + * @return {@link SecHubConfiguration} instance */ - public SecHubConfigurationModel transformToSecHubConfiguration(RunSecHubJobDefinition definition) { + public SecHubConfiguration transformToSecHubConfiguration(RunSecHubJobDefinition definition) { requireNonNull(definition, "The defintion may not be null!"); - SecHubConfigurationModel config = new SecHubConfigurationModel(); + SecHubConfiguration config = new SecHubConfiguration(); config.setApiVersion("1.0"); config.setProjectId(definition.getProject()); @@ -71,7 +67,7 @@ private void handleSources(SecHubDataConfiguration data, UploadDefinition upload fileSystem.getFiles().add(sourceFileOpt.get()); } sourceConfig.setFileSystem(fileSystem); - sourceConfig.setUniqueName(upload.getReferenceId().orElse(null)); + sourceConfig.setName(upload.getReferenceId().orElse(null)); data.getSources().add(sourceConfig); } @@ -90,7 +86,7 @@ private void handleBinaries(SecHubDataConfiguration data, UploadDefinition uploa fileSystem.getFiles().add(binaryFileOpt.get()); } binaryConfig.setFileSystem(fileSystem); - binaryConfig.setUniqueName(upload.getReferenceId().orElse(null)); + binaryConfig.setName(upload.getReferenceId().orElse(null)); data.getBinaries().add(binaryConfig); } diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationBuilder.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationBuilder.java index 695fedbcb6..4bfca7a673 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationBuilder.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationBuilder.java @@ -9,13 +9,12 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName; -import com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; -import com.mercedesbenz.sechub.commons.model.TrafficLight; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubCodeScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubInfrastructureScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubLicenseScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubSecretScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubWebScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.TrafficLight; import com.mercedesbenz.sechub.systemtest.runtime.testengine.TestTemplateSupport; public class SystemTestConfigurationBuilder { @@ -715,29 +714,6 @@ public UploadBuilder binaryFile(String path) { } } - public abstract class AbstractWithUploadReferencesScanConfigBuilder, C extends SecHubDataConfigurationUsageByName> { - - private C configuration; - - private AbstractWithUploadReferencesScanConfigBuilder(C configuration) { - this.configuration = configuration; - } - - protected C getConfiguration() { - return configuration; - } - - @SuppressWarnings("unchecked") - public T use(String... referenceIds) { - configuration.getNamesOfUsedDataConfigurationObjects().addAll(Arrays.asList(referenceIds)); - return (T) this; - } - - public SecHubRunBuilder endScan() { - return SecHubRunBuilder.this; - } - } - public CodeScanConfigBuilder codeScan() { return new CodeScanConfigBuilder(); } @@ -766,49 +742,109 @@ private WebScanConfigBuilder() { runSecHubJob.setWebScan(Optional.of(webScanConfig)); } + public WebScanConfigBuilder use(String... referenceIds) { + List referenceIdsList = Arrays.asList(referenceIds); + webScanConfig.setUse(new ArrayList<>(referenceIdsList)); + return this; + } + public SecHubRunBuilder endScan() { return SecHubRunBuilder.this; } - public WebScanConfigBuilder url(String urlAsString) { - webScanConfig.setUrl(URI.create(urlAsString)); + public WebScanConfigBuilder url(String uri) { + webScanConfig.setUrl(URI.create(uri)); return this; } } public class InfraScanConfigBuilder { + SecHubInfrastructureScanConfiguration configuration; + private InfraScanConfigBuilder() { - SecHubInfrastructureScanConfiguration configuration = new SecHubInfrastructureScanConfiguration(); + configuration = new SecHubInfrastructureScanConfiguration(); runSecHubJob.setInfraScan(Optional.of(configuration)); } + public InfraScanConfigBuilder use(String... referenceIds) { + List referenceIdsList = Arrays.asList(referenceIds); + configuration.setUse(new ArrayList<>(referenceIdsList)); + return this; + } + public SecHubRunBuilder endScan() { return SecHubRunBuilder.this; } } - public class SecretScanConfigBuilder extends AbstractWithUploadReferencesScanConfigBuilder { + public class SecretScanConfigBuilder { + private final SecHubSecretScanConfiguration configuration; + + private SecretScanConfigBuilder(SecHubSecretScanConfiguration configuration) { + this.configuration = configuration; + } + private SecretScanConfigBuilder() { - super(new SecHubSecretScanConfiguration()); - runSecHubJob.setSecretScan(Optional.of(getConfiguration())); + this(new SecHubSecretScanConfiguration()); + runSecHubJob.setSecretScan(Optional.of(configuration)); + } + + public SecretScanConfigBuilder use(String... referenceIds) { + List referenceIdsList = Arrays.asList(referenceIds); + configuration.setUse(new ArrayList<>(referenceIdsList)); + return this; + } + + public SecHubRunBuilder endScan() { + return SecHubRunBuilder.this; } } - public class CodeScanConfigBuilder extends AbstractWithUploadReferencesScanConfigBuilder { + public class CodeScanConfigBuilder { + private final SecHubCodeScanConfiguration configuration; + + private CodeScanConfigBuilder(SecHubCodeScanConfiguration secHubCodeScanConfiguration) { + this.configuration = secHubCodeScanConfiguration; + } + private CodeScanConfigBuilder() { - super(new SecHubCodeScanConfiguration()); - runSecHubJob.setCodeScan(Optional.of(getConfiguration())); + this(new SecHubCodeScanConfiguration()); + runSecHubJob.setCodeScan(Optional.of(configuration)); + } + + public CodeScanConfigBuilder use(String... referenceIds) { + List referenceIdsList = Arrays.asList(referenceIds); + configuration.setUse(new ArrayList<>(referenceIdsList)); + return this; + } + + public SecHubRunBuilder endScan() { + return SecHubRunBuilder.this; } } - public class LicenseScanConfigBuilder - extends AbstractWithUploadReferencesScanConfigBuilder { + public class LicenseScanConfigBuilder { + private final SecHubLicenseScanConfiguration configuration; + + public LicenseScanConfigBuilder(SecHubLicenseScanConfiguration secHubLicenseScanConfiguration) { + this.configuration = secHubLicenseScanConfiguration; + } + private LicenseScanConfigBuilder() { - super(new SecHubLicenseScanConfiguration()); - runSecHubJob.setLicenseScan(Optional.of(getConfiguration())); + this(new SecHubLicenseScanConfiguration()); + runSecHubJob.setLicenseScan(Optional.of(configuration)); } - } + public LicenseScanConfigBuilder use(String... referenceIds) { + List referenceIdsList = Arrays.asList(referenceIds); + configuration.setUse(new ArrayList<>(referenceIdsList)); + return this; + } + + public SecHubRunBuilder endScan() { + return SecHubRunBuilder.this; + } + } } private TestBuilder(String testName) { diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/ArtifactStorageSecHubClientListener.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/ArtifactStorageSecHubClientListener.java index 79c9565ed0..7917b43a62 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/ArtifactStorageSecHubClientListener.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/ArtifactStorageSecHubClientListener.java @@ -11,11 +11,11 @@ import org.slf4j.LoggerFactory; import com.mercedesbenz.sechub.api.SecHubClientListener; -import com.mercedesbenz.sechub.api.SecHubReport; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubReport; import com.mercedesbenz.sechub.commons.TextFileWriter; import com.mercedesbenz.sechub.commons.archive.ArchiveSupport.ArchivesCreationResult; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; /** * This class stores files inside the runtime artifacts folder of the current @@ -37,7 +37,7 @@ public ArtifactStorageSecHubClientListener(SystemTestRuntimeContext context) { } @Override - public void beforeUpload(UUID secHubJobUUID, SecHubConfigurationModel model, ArchivesCreationResult archiveCreationResult) { + public void beforeUpload(UUID secHubJobUUID, SecHubConfiguration secHubConfiguration, ArchivesCreationResult archiveCreationResult) { Path targetFolder = ensureArtifactsFolderForTest(); storeSecHubJobUUIDFile(secHubJobUUID, targetFolder); diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntime.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntime.java index 025a89e26b..d5b57f775e 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntime.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntime.java @@ -91,6 +91,7 @@ private int getValue(String key, int defaultValue) { } } + @SuppressWarnings("all") private SystemTestResult runAfterInitialization(SystemTestRuntimeContext context) { switchToStage("Setup", context); diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimeMetaData.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimeMetaData.java index 8355baa74f..fe5fe78e7e 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimeMetaData.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimeMetaData.java @@ -24,7 +24,7 @@ public class SystemTestRuntimeMetaData { private Map pdsSolutionConfigurations = new LinkedHashMap<>(); private TextFileReader textFileReader; - class PdsSolutionData { + private static class PdsSolutionData { private PDSServerConfiguration serverConfiguration; private Path pathToServerConfiguration; private PDSSolutionDefinition solutionDefinition; diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/config/SystemTestRuntimeLocalSecHubProductConfigurator.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/config/SystemTestRuntimeLocalSecHubProductConfigurator.java index 7ea38d4d05..96c5dc9292 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/config/SystemTestRuntimeLocalSecHubProductConfigurator.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/config/SystemTestRuntimeLocalSecHubProductConfigurator.java @@ -4,6 +4,7 @@ import static com.mercedesbenz.sechub.commons.pds.PDSDefaultParameterKeyConstants.*; +import java.net.URI; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; @@ -16,15 +17,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mercedesbenz.sechub.api.ExecutionProfileCreate; -import com.mercedesbenz.sechub.api.ExecutorConfiguration; -import com.mercedesbenz.sechub.api.ExecutorConfigurationInfo; -import com.mercedesbenz.sechub.api.ExecutorConfigurationSetup; -import com.mercedesbenz.sechub.api.ExecutorConfigurationSetupCredentials; -import com.mercedesbenz.sechub.api.Project; -import com.mercedesbenz.sechub.api.ProjectWhiteList; import com.mercedesbenz.sechub.api.SecHubClient; -import com.mercedesbenz.sechub.api.SecHubClientException; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.model.ScanType; import com.mercedesbenz.sechub.systemtest.config.CredentialsDefinition; import com.mercedesbenz.sechub.systemtest.config.ProjectDefinition; @@ -36,7 +31,7 @@ public class SystemTestRuntimeLocalSecHubProductConfigurator { private static final Logger LOG = LoggerFactory.getLogger(SystemTestRuntimeLocalSecHubProductConfigurator.class); - public void configure(SystemTestRuntimeContext context) throws SecHubClientException { + public void configure(SystemTestRuntimeContext context) throws ApiException { if (!context.isLocalRun()) { return; } @@ -44,9 +39,18 @@ public void configure(SystemTestRuntimeContext context) throws SecHubClientExcep return; } - /* remove old stuff of former run - we insist on a clean setup on local runs! */ + /* Make sure that existing projects are removed */ deleteExistingProjects(context); - deleteExistingProfiles(context); + + /* Make sure that existing profiles are removed */ + try { + deleteExistingProfiles(context); + } catch (ApiException e) { + if (e.getCode() != 404) { + LOG.error("Failed to delete existing profiles with reason {}", e.getMessage()); + throw e; + } + } createProjects(context); assignAdminAsUserToProjects(context); @@ -57,7 +61,7 @@ public void configure(SystemTestRuntimeContext context) throws SecHubClientExcep addExecutorConfigurationsToProfiles(context, profileIdsToExecutorUUIDs); } - private void deleteExistingProjects(SystemTestRuntimeContext context) throws SecHubClientException { + private void deleteExistingProjects(SystemTestRuntimeContext context) throws ApiException { SecHubClient client = context.getLocalAdminSecHubClient(); for (String projectId : context.createSetForLocalSecHubProjectIdDefinitions()) { @@ -65,14 +69,15 @@ private void deleteExistingProjects(SystemTestRuntimeContext context) throws Sec LOG.info("Dry run: delete existing project '{}' is skipped", projectId); continue; } - if (client.isProjectExisting(projectId)) { + List projectIds = client.withProjectAdministrationApi().adminListAllProjects(); + if (projectIds.contains(projectId)) { LOG.warn("Project '{}' did already exist - will delete old project!", projectId); - client.deleteProject(projectId); + client.withProjectAdministrationApi().adminDeleteProject(projectId); } } } - private void deleteExistingProfiles(SystemTestRuntimeContext context) throws SecHubClientException { + private void deleteExistingProfiles(SystemTestRuntimeContext context) throws ApiException { Set profileIds = context.createSetForLocalSecHubProfileIdsInExecutors(); SecHubClient client = context.getLocalAdminSecHubClient(); @@ -82,14 +87,17 @@ private void deleteExistingProfiles(SystemTestRuntimeContext context) throws Sec LOG.info("Dry run: delete existing profile '{}' is skipped", profileId); continue; } - if (client.isExecutionProfileExisting(profileId)) { - client.deleteExecutionProfile(profileId); + try { + client.withConfigurationApi().adminDeleteExecutionProfile(profileId); + } catch (ApiException e) { + if (e.getCode() != 404) { + throw e; + } } - } } - private void createProjects(SystemTestRuntimeContext context) throws SecHubClientException { + private void createProjects(SystemTestRuntimeContext context) throws ApiException { SecHubConfigurationDefinition config = context.getLocalSecHubConfigurationOrFail(); if (config.getProjects().isEmpty()) { @@ -106,22 +114,27 @@ private void createProjects(SystemTestRuntimeContext context) throws SecHubClien LOG.info("Dry run: create project '{}' is skipped", projectName); continue; } - Project project = new Project(); + ProjectInput project = new ProjectInput(); project.setApiVersion("1.0"); project.setDescription("System test project " + projectName); project.setName(projectName); project.setOwner(client.getUserId());// we use the administrator as owner of the project - ProjectWhiteList whiteList = project.getWhiteList(); - for (String whiteListEntry : projectDefinition.getWhitelistedURIs()) { - whiteList.getUris().add(whiteListEntry); + ProjectWhitelist whiteList = project.getWhiteList(); + if (whiteList != null) { + for (String whiteListEntry : projectDefinition.getWhitelistedURIs()) { + if (whiteList.getUris() != null) { + whiteList.getUris().add(URI.create(whiteListEntry)); + } + } } - client.createProject(project); + + client.withProjectAdministrationApi().adminCreateProject(project); } } - private Map> createExecutorConfigurationsAndMapToProfileIds(SystemTestRuntimeContext context) throws SecHubClientException { + private Map> createExecutorConfigurationsAndMapToProfileIds(SystemTestRuntimeContext context) throws ApiException { Map> map = new LinkedHashMap<>(); if (context.isDryRun()) { LOG.info("Dry run: Skip executor configuration creation"); @@ -137,43 +150,47 @@ private Map> createExecutorConfigurationsAndMapToProfileIds(S } private void createAndMapExecutorConfiguration(SecHubExecutorConfigDefinition executorConfigDefinition, Map> map, - SystemTestRuntimeContext context) throws SecHubClientException { + SystemTestRuntimeContext context) throws ApiException { SecHubClient client = context.getLocalAdminSecHubClient(); String name = executorConfigDefinition.getName(); - List executorConfigurations = client.fetchAllExecutorConfigurationInfo(); + ProductExecutorConfigList productExecutorConfigList = client.withConfigurationApi().adminFetchExecutorConfigurationList(); Set oldEntries = new HashSet<>(); - for (ExecutorConfigurationInfo info : executorConfigurations) { - if (name.equals(info.getName())) { - oldEntries.add(info.getUuid()); + if (productExecutorConfigList.getExecutorConfigurations() != null) { + for (ProductExecutorConfigListEntry entry : productExecutorConfigList.getExecutorConfigurations()) { + if (name.equals(entry.getName())) { + oldEntries.add(entry.getUuid()); + } } } - for (UUID oldEntry : oldEntries) { - LOG.info("Delete existing executor configuration: {} - {}", name, oldEntry); - client.deleteExecutorConfiguration(oldEntry); + for (UUID uuid : oldEntries) { + LOG.info("Delete existing executor configuration: {} - {}", name, uuid); + client.withConfigurationApi().adminDeleteExecutorConfiguration(uuid); } String pdsProductId = executorConfigDefinition.getPdsProductId(); ScanType scanType = context.getScanTypeForPdsProduct(pdsProductId); - String secHubProductIdentifier = resolveSecHubProductIdentifierForPdsWithSCanType(scanType); + ProductIdentifier productIdentifier = resolveSecHubProductIdentifierForPdsWithSCanType(scanType); /* create and configure new executor configuration */ - ExecutorConfiguration config = new ExecutorConfiguration(); + ProductExecutorConfig config = new ProductExecutorConfig(); config.setEnabled(true); config.setName(name); config.setExecutorVersion(executorConfigDefinition.getVersion()); - config.setProductIdentifier(secHubProductIdentifier); + config.setProductIdentifier(productIdentifier); - ExecutorConfigurationSetup setup = config.getSetup(); + ProductExecutorConfigSetup setup = new ProductExecutorConfigSetup(); setup.setBaseURL(executorConfigDefinition.getBaseURL()); + config.setSetup(setup); handleCredentials(executorConfigDefinition, setup, context); handleParametersForNewExecutorConfiguration(executorConfigDefinition, setup, pdsProductId, scanType); /* store executor configuration */ - UUID uuid = client.createExecutorConfiguration(config); + String uuidString = client.withConfigurationApi().adminCreateExecutorConfiguration(config); + UUID uuid = UUID.fromString(uuidString); /* map profiles with created executor configuration */ Set profileIds = executorConfigDefinition.getProfiles(); @@ -183,9 +200,9 @@ private void createAndMapExecutorConfiguration(SecHubExecutorConfigDefinition ex } } - private void handleCredentials(SecHubExecutorConfigDefinition executorConfigDefinition, ExecutorConfigurationSetup setup, + private void handleCredentials(SecHubExecutorConfigDefinition executorConfigDefinition, ProductExecutorConfigSetup setup, SystemTestRuntimeContext context) { - ExecutorConfigurationSetupCredentials executorSetupCredentials = new ExecutorConfigurationSetupCredentials(); + ProductExecutorConfigSetupCredentials executorSetupCredentials = new ProductExecutorConfigSetupCredentials(); Optional executorConfigOptCredentials = executorConfigDefinition.getCredentials(); @@ -208,30 +225,31 @@ private void handleCredentials(SecHubExecutorConfigDefinition executorConfigDefi setup.setCredentials(executorSetupCredentials); } - private void handleParametersForNewExecutorConfiguration(SecHubExecutorConfigDefinition executorConfigDefinition, ExecutorConfigurationSetup setup, + private void handleParametersForNewExecutorConfiguration(SecHubExecutorConfigDefinition executorConfigDefinition, ProductExecutorConfigSetup setup, String pdsProductId, ScanType scanType) { Map parameters = executorConfigDefinition.getParameters(); /* define internal standard settings which can be overriden by developers */ - setup.addParameter(PARAM_KEY_PDS_CONFIG_SCRIPT_TRUSTALL_CERTIFICATES_ENABLED, "true"); - setup.addParameter(PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE, "false"); + setup.addJobParametersItem(new ProductExecutorConfigSetupJobParameter().key(PARAM_KEY_PDS_CONFIG_SCRIPT_TRUSTALL_CERTIFICATES_ENABLED).value("true")); + setup.addJobParametersItem(new ProductExecutorConfigSetupJobParameter().key(PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE).value("false")); /* developer settings: */ for (String paramKey : parameters.keySet()) { String paramValue = parameters.get(paramKey); - - setup.addParameter(paramKey, paramValue); + ProductExecutorConfigSetupJobParameter jobParameter = new ProductExecutorConfigSetupJobParameter().key(paramKey).value(paramValue); + setup.addJobParametersItem(jobParameter); } /* fix parts, which cannot be overriden */ - setup.addParameter(PARAM_KEY_PDS_CONFIG_PRODUCTIDENTIFIER, pdsProductId); - setup.addParameter(PARAM_KEY_PDS_SCAN_TARGET_TYPE, scanType.name()); + setup.addJobParametersItem(new ProductExecutorConfigSetupJobParameter().key(PARAM_KEY_PDS_CONFIG_PRODUCTIDENTIFIER).value(pdsProductId)); + setup.addJobParametersItem(new ProductExecutorConfigSetupJobParameter().key(PARAM_KEY_PDS_SCAN_TARGET_TYPE).value(scanType.name())); } - private String resolveSecHubProductIdentifierForPdsWithSCanType(ScanType scanType) { - return "PDS_" + (scanType.name().replace("_", "")); + private ProductIdentifier resolveSecHubProductIdentifierForPdsWithSCanType(ScanType scanType) { + String productIdentifierString = "PDS_" + (scanType.name().replace("_", "")); + return ProductIdentifier.fromValue(productIdentifierString); } - private void createProfilesAndAssignToProjects(SystemTestRuntimeContext context) throws SecHubClientException { + private void createProfilesAndAssignToProjects(SystemTestRuntimeContext context) throws ApiException { List executorDefinitions = context.getLocalSecHubExecutorConfigurationsOrFail(); for (SecHubExecutorConfigDefinition executorDefinition : executorDefinitions) { for (String profileId : executorDefinition.getProfiles()) { @@ -244,13 +262,13 @@ private void createProfilesAndAssignToProjects(SystemTestRuntimeContext context) } } - private void createProfileAndAssignProjects(String profileId, SystemTestRuntimeContext context) throws SecHubClientException { + private void createProfileAndAssignProjects(String profileId, SystemTestRuntimeContext context) throws ApiException { SecHubClient client = context.getLocalAdminSecHubClient(); SecHubConfigurationDefinition config = context.getLocalSecHubConfigurationOrFail(); - ExecutionProfileCreate profile = new ExecutionProfileCreate(); - profile.setEnabled(true); + ProductExecutionProfile productExecutionProfile = new ProductExecutionProfile(); + productExecutionProfile.setEnabled(true); List projectIdsForThisProfile = new ArrayList<>(); for (ProjectDefinition projectDefinition : config.getProjects().get()) { @@ -258,28 +276,37 @@ private void createProfileAndAssignProjects(String profileId, SystemTestRuntimeC projectIdsForThisProfile.add(projectDefinition.getName()); } } - profile.setProjectIds(projectIdsForThisProfile); - profile.setDescription("Generated by system test framework"); + productExecutionProfile.setProjectIds(projectIdsForThisProfile); - client.createExecutionProfile(profileId, profile); + client.withConfigurationApi().adminCreateExecutionProfile(profileId, productExecutionProfile); } - private void addExecutorConfigurationsToProfiles(SystemTestRuntimeContext context, Map> profileIdsToExecutorUUIDs) - throws SecHubClientException { + private void addExecutorConfigurationsToProfiles(SystemTestRuntimeContext context, Map> profileIdsToExecutorUUIDs) throws ApiException { /* assign executor configurations to profiles */ SecHubClient client = context.getLocalAdminSecHubClient(); + for (String profileId : profileIdsToExecutorUUIDs.keySet()) { + ProductExecutionProfile productExecutionProfile = new ProductExecutionProfile(); + productExecutionProfile.setEnabled(true); + List productExecutorConfigs = new ArrayList<>(); + for (UUID executorConfigurationUUID : profileIdsToExecutorUUIDs.get(profileId)) { if (context.isDryRun()) { LOG.info("Dry run: add executor config '{}' to profile '{}' is skipped", executorConfigurationUUID, profileId); continue; } - client.addExecutorConfigurationToProfile(executorConfigurationUUID, profileId); + ProductExecutorConfig productExecutorConfig = new ProductExecutorConfig(); + productExecutorConfig.setUuid(executorConfigurationUUID); + productExecutorConfigs.add(productExecutorConfig); } + + productExecutionProfile.setConfigurations(productExecutorConfigs); + + client.withConfigurationApi().adminUpdateExecutionProfile(profileId, productExecutionProfile); } } - private void assignAdminAsUserToProjects(SystemTestRuntimeContext context) throws SecHubClientException { + private void assignAdminAsUserToProjects(SystemTestRuntimeContext context) throws ApiException { SecHubConfigurationDefinition config = context.getLocalSecHubConfigurationOrFail(); if (config.getProjects().isEmpty()) { return; @@ -288,12 +315,12 @@ private void assignAdminAsUserToProjects(SystemTestRuntimeContext context) throw SecHubClient client = context.getLocalAdminSecHubClient(); String userId = client.getUserId(); for (ProjectDefinition projectDefinition : config.getProjects().get()) { - String projectid = projectDefinition.getName(); + String projectId = projectDefinition.getName(); if (context.isDryRun()) { - LOG.info("Dry run: assign user '{}' to project '{}' is skipped", userId, projectid); + LOG.info("Dry run: assign user '{}' to project '{}' is skipped", userId, projectId); continue; } - client.assignUserToProject(userId, projectid); + client.withProjectAdministrationApi().adminAssignUserToProject(projectId, userId); } } diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimeContextHealthCheck.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimeContextHealthCheck.java index 411cb54b74..58052b45eb 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimeContextHealthCheck.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimeContextHealthCheck.java @@ -5,27 +5,13 @@ import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.core.util.SimpleStringUtils; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModelValidationResult; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModelValidationResult.SecHubConfigurationModelValidationErrorData; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModelValidator; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanApiConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; import com.mercedesbenz.sechub.pds.commons.core.config.PDSProductParameterDefinition; import com.mercedesbenz.sechub.pds.commons.core.config.PDSProductParameterSetup; import com.mercedesbenz.sechub.pds.commons.core.config.PDSProductSetup; @@ -82,65 +68,72 @@ private void assertRunSecHubJobCorrect(SystemTestRuntimeContext context, TestDef /* last but not least */ RunSecHubJobDefinitionTransformer transformer = new RunSecHubJobDefinitionTransformer(); - SecHubConfigurationModel model = transformer.transformToSecHubConfiguration(runSecHubJob); - SecHubConfigurationModelValidator validator = new SecHubConfigurationModelValidator(); - SecHubConfigurationModelValidationResult result = validator.validate(model); - if (result.hasErrors()) { - for (SecHubConfigurationModelValidationErrorData errorData : result.getErrors()) { - throw new WrongConfigurationException("Test: " + test.getName() + " leads to an invalid sechub configurarion:" + errorData.toString(), context); - } - } + SecHubConfiguration secHubConfiguration = transformer.transformToSecHubConfiguration(runSecHubJob); + /* + * + * FIXME: This code is commented out because the + * SecHubConfigurationModelValidator is deprecated. + * + * SecHubConfigurationModelValidator validator = new + * SecHubConfigurationModelValidator(); SecHubConfigurationModelValidationResult + * result = validator.validate(secHubConfiguration); if (result.hasErrors()) { + * for (SecHubConfigurationModelValidationErrorData errorData : + * result.getErrors()) { throw new WrongConfigurationException("Test: " + + * test.getName() + " leads to an invalid sechub configurarion:" + + * errorData.toString(), context); } } + * + */ } private void assertReferenceIds(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { - Set existingReferenceIds = collectReferenceIdsAndFailIfMissing(context, runSecHubJob); + List existingReferenceIds = collectReferenceIdsAndFailIfMissing(context, runSecHubJob); assertReferencesCorrectForCodeScan(context, runSecHubJob, existingReferenceIds); assertReferencesCorrectForWebScan(context, runSecHubJob, existingReferenceIds); assertReferencesCorrectForLicenseScan(context, runSecHubJob, existingReferenceIds); - assertReferencesCorrectForSecretcan(context, runSecHubJob, existingReferenceIds); + assertReferencesCorrectForSecretScan(context, runSecHubJob, existingReferenceIds); /* Because infrastructure scans do not have references we do not handled them */ } - private void assertReferencesCorrectForCodeScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set existingReferenceIds) { + private void assertReferencesCorrectForCodeScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, List existingReferenceIds) { Optional codeConfigOpt = runSecHubJob.getCodeScan(); if (codeConfigOpt.isPresent()) { - assertReferenceIdsCorrect("code scan", context, existingReferenceIds, codeConfigOpt.get().getNamesOfUsedDataConfigurationObjects()); + assertReferenceIdsCorrect("code scan", context, existingReferenceIds, codeConfigOpt.get().getUse()); } } - private void assertReferencesCorrectForSecretcan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set existingReferenceIds) { + private void assertReferencesCorrectForSecretScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, + List existingReferenceIds) { Optional secretConfigOpt = runSecHubJob.getSecretScan(); if (secretConfigOpt.isPresent()) { - assertReferenceIdsCorrect("secret scan", context, existingReferenceIds, secretConfigOpt.get().getNamesOfUsedDataConfigurationObjects()); + assertReferenceIdsCorrect("secret scan", context, existingReferenceIds, secretConfigOpt.get().getUse()); } } private void assertReferencesCorrectForLicenseScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, - Set existingReferenceIds) { + List existingReferenceIds) { Optional licenseConfigOpt = runSecHubJob.getLicenseScan(); if (licenseConfigOpt.isPresent()) { - assertReferenceIdsCorrect("license scan", context, existingReferenceIds, licenseConfigOpt.get().getNamesOfUsedDataConfigurationObjects()); + assertReferenceIdsCorrect("license scan", context, existingReferenceIds, licenseConfigOpt.get().getUse()); } } - private void assertReferencesCorrectForWebScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set existingReferenceIds) { + private void assertReferencesCorrectForWebScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, List existingReferenceIds) { Optional webConfigOpt = runSecHubJob.getWebScan(); if (webConfigOpt.isPresent()) { - Optional apiOpt = webConfigOpt.get().getApi(); - if (apiOpt.isEmpty()) { + SecHubWebScanApiConfiguration secHubWebScanApiConfiguration = webConfigOpt.get().getApi(); + if (secHubWebScanApiConfiguration == null) { return; } - SecHubWebScanApiConfiguration api = apiOpt.get(); - assertReferenceIdsCorrect("web scan api", context, existingReferenceIds, api.getNamesOfUsedDataConfigurationObjects()); + assertReferenceIdsCorrect("web scan api", context, existingReferenceIds, secHubWebScanApiConfiguration.getUse()); } } - private Set collectReferenceIdsAndFailIfMissing(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { + private List collectReferenceIdsAndFailIfMissing(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { List uploads = runSecHubJob.getUploads(); - Set existingReferenceIds = new TreeSet<>(); + List existingReferenceIds = new ArrayList<>(uploads.size()); for (UploadDefinition upload : uploads) { Optional refIdOpt = upload.getReferenceId(); if (refIdOpt.isEmpty()) { @@ -156,8 +149,8 @@ private Set collectReferenceIdsAndFailIfMissing(SystemTestRuntimeContext return existingReferenceIds; } - private void assertReferenceIdsCorrect(String configName, SystemTestRuntimeContext context, Set existingReferenceIds, - Set referencedByScanOrNull) { + private void assertReferenceIdsCorrect(String configName, SystemTestRuntimeContext context, List existingReferenceIds, + List referencedByScanOrNull) { if (referencedByScanOrNull == null) { return; } diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimePreparator.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimePreparator.java index 1e07409307..82c2e2db05 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimePreparator.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/init/SystemTestRuntimePreparator.java @@ -15,14 +15,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.core.util.SimpleStringUtils; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName; -import com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; import com.mercedesbenz.sechub.commons.pds.PDSDefaultParameterKeyConstants; import com.mercedesbenz.sechub.systemtest.config.CalculatedVariables; import com.mercedesbenz.sechub.systemtest.config.CredentialsDefinition; @@ -128,10 +123,11 @@ private void handleWebScan(TestDefinition test, SystemTestRuntimeContext context } SecHubWebScanConfiguration webScan = webScanOpt.get(); LOG.warn("Web scan found, but no special preparation done for url: {}", webScan.getUrl()); - if (webScan.getApi().isEmpty()) { + SecHubWebScanApiConfiguration secHubWebScanApiConfiguration = webScan.getApi(); + if (secHubWebScanApiConfiguration == null) { return; } - handleUsedDataConfigurationObjects(webScan.getApi().get(), test, context); + handleUsedDataConfigurationObjects(secHubWebScanApiConfiguration.getUse()); } private void handleInfraScan(TestDefinition test, SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { @@ -150,7 +146,7 @@ private void handleCodeScan(TestDefinition test, SystemTestRuntimeContext contex return; } SecHubCodeScanConfiguration codeScan = codeScanOpt.get(); - handleUsedDataConfigurationObjects(codeScan, test, context); + handleUsedDataConfigurationObjects(codeScan.getUse()); } private void handleLicenseScan(TestDefinition test, SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { @@ -159,7 +155,7 @@ private void handleLicenseScan(TestDefinition test, SystemTestRuntimeContext con return; } SecHubLicenseScanConfiguration licenseScan = licenseScanOpt.get(); - handleUsedDataConfigurationObjects(licenseScan, test, context); + handleUsedDataConfigurationObjects(licenseScan.getUse()); } private void handleSecretScan(TestDefinition test, SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) { @@ -168,12 +164,12 @@ private void handleSecretScan(TestDefinition test, SystemTestRuntimeContext cont return; } SecHubSecretScanConfiguration secretScan = secretScanOpt.get(); - handleUsedDataConfigurationObjects(secretScan, test, context); + handleUsedDataConfigurationObjects(secretScan.getUse()); } - private void handleUsedDataConfigurationObjects(SecHubDataConfigurationUsageByName usageByName, TestDefinition test, SystemTestRuntimeContext context) { - if (usageByName.getNamesOfUsedDataConfigurationObjects().isEmpty()) { - usageByName.getNamesOfUsedDataConfigurationObjects().add(FALLBACK_UPLOAD_REF_ID.getValue()); + private void handleUsedDataConfigurationObjects(List usageByNames) { + if (usageByNames != null && usageByNames.isEmpty()) { + usageByNames.add(FALLBACK_UPLOAD_REF_ID.getValue()); } } diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/launch/SystemTestRuntimeProductLauncher.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/launch/SystemTestRuntimeProductLauncher.java index 5bbbd9064a..7a27d64406 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/launch/SystemTestRuntimeProductLauncher.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/launch/SystemTestRuntimeProductLauncher.java @@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory; import com.mercedesbenz.sechub.api.SecHubClient; -import com.mercedesbenz.sechub.api.SecHubClientException; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; import com.mercedesbenz.sechub.systemtest.config.ExecutionStepDefinition; import com.mercedesbenz.sechub.systemtest.config.LocalSecHubDefinition; import com.mercedesbenz.sechub.systemtest.config.LocalSetupDefinition; @@ -31,18 +31,15 @@ */ public class SystemTestRuntimeProductLauncher { - private static final AtomicInteger parallelStepExecutionCounter = new AtomicInteger(); - - private static final int ONE_SECOND_IN_MILLISECONDS = 1000; - private int maximumSecondsToWaitForSecHubAlive = 120; - private int maximumSecondsToWaitForPDSSolutionAlive = 120; - private static final Logger LOG = LoggerFactory.getLogger(SystemTestRuntimeProductLauncher.class); - + private static final AtomicInteger parallelStepExecutionCounter = new AtomicInteger(); + private static final long ONE_SECOND_IN_MILLISECONDS = 1000L; + private static final long MAXIMUM_SECONDS_TO_WAIT_FOR_SEC_HUB_ALIVE = 120L; + private static final long MAXIMUM_SECONDS_TO_WAIT_FOR_PDS_SOLUTION_ALIVE = 120L; private static final int MAX_AMOUNT_OF_ADMIN_AVAILABLE_CHECKS = 60; - private static final int MILLISECONDS_TO_WAIT_FOR_NEXT_ADMIN_AVAILABLE_CHECK = 1000; + private static final long MILLISECONDS_TO_WAIT_FOR_NEXT_ADMIN_AVAILABLE_CHECK = 1000L; - private ExecutionSupport execSupport; + private final ExecutionSupport execSupport; public SystemTestRuntimeProductLauncher(ExecutionSupport executionSupport) { this.execSupport = executionSupport; @@ -179,11 +176,11 @@ public void waitUntilSecHubAvailable(SystemTestRuntimeContext context) throws Sy } try { long start = System.currentTimeMillis(); - LOG.info("Wait until SecHub server at {} is alive - will wait {} seconds (max).", client.getServerUri(), maximumSecondsToWaitForSecHubAlive); + LOG.info("Wait until SecHub server at {} is alive - will wait {} seconds (max).", client.getServerUri(), MAXIMUM_SECONDS_TO_WAIT_FOR_SEC_HUB_ALIVE); while (!client.isServerAlive()) { Thread.sleep(MILLISECONDS_TO_WAIT_FOR_NEXT_ALIVE_CHECK()); long millisecondsWaited = System.currentTimeMillis() - start; - boolean timedOut = millisecondsWaited > maximumSecondsToWaitForSecHubAlive * ONE_SECOND_IN_MILLISECONDS; + boolean timedOut = millisecondsWaited > MAXIMUM_SECONDS_TO_WAIT_FOR_SEC_HUB_ALIVE * ONE_SECOND_IN_MILLISECONDS; if (timedOut) { throw new IllegalStateException( "Check for SecHub server alive timed out after " + (millisecondsWaited / ONE_SECOND_IN_MILLISECONDS) + " seconds."); @@ -191,7 +188,7 @@ public void waitUntilSecHubAvailable(SystemTestRuntimeContext context) throws Sy } LOG.debug("SecHub server at {} is alive", client.getServerUri()); - } catch (SecHubClientException e) { + } catch (ApiException e) { throw new SystemTestRuntimeException("Was not able to check if SecHub server is alive.", e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); @@ -211,9 +208,9 @@ public void waitUntilSecHubAdminAvailable(SystemTestRuntimeContext context) { for (int i = 0; !adminAccountAvailable && i < MAX_AMOUNT_OF_ADMIN_AVAILABLE_CHECKS; i++) { try { - sechubClient.fetchSecHubStatus(); + sechubClient.withOtherApi().adminListStatusInformation(); adminAccountAvailable = true; - } catch (SecHubClientException e) { + } catch (ApiException e) { try { Thread.sleep(MILLISECONDS_TO_WAIT_FOR_NEXT_ADMIN_AVAILABLE_CHECK); } catch (InterruptedException e1) { @@ -266,11 +263,11 @@ private void waitForPDSSolution(PDSSolutionDefinition pdsSolution, SystemTestRun try { long start = System.currentTimeMillis(); LOG.info("Wait until PDS solution '" + pdsSolutionName + "' at {} is alive - will wait {} seconds (max).", client.getServerUri(), - maximumSecondsToWaitForPDSSolutionAlive); + MAXIMUM_SECONDS_TO_WAIT_FOR_PDS_SOLUTION_ALIVE); while (!client.checkIsServerAlive()) { Thread.sleep(1000); long millisecondsWaited = System.currentTimeMillis() - start; - boolean timedOut = millisecondsWaited > maximumSecondsToWaitForPDSSolutionAlive * ONE_SECOND_IN_MILLISECONDS; + boolean timedOut = millisecondsWaited > MAXIMUM_SECONDS_TO_WAIT_FOR_PDS_SOLUTION_ALIVE * ONE_SECOND_IN_MILLISECONDS; if (timedOut) { throw new IllegalStateException("Check alive for PDS solution '" + pdsSolutionName + "' timed out after " + (millisecondsWaited / ONE_SECOND_IN_MILLISECONDS) + " seconds."); diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestAssertion.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestAssertion.java index c77f6a4670..45e0c0db76 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestAssertion.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestAssertion.java @@ -8,9 +8,9 @@ import java.util.Optional; import java.util.UUID; -import com.mercedesbenz.sechub.api.SecHubReport; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubReport; +import com.mercedesbenz.sechub.api.internal.gen.model.TrafficLight; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.TrafficLight; import com.mercedesbenz.sechub.systemtest.config.AssertContainsStringsDefinition; import com.mercedesbenz.sechub.systemtest.config.AssertEqualsFileDefinition; import com.mercedesbenz.sechub.systemtest.config.AssertSechubResultDefinition; @@ -53,7 +53,8 @@ private void handleSecHubAssert(AssertSechubResultDefinition sechubResultAssert, if (sechubResultAssert.getHasTrafficLight().isPresent()) { TrafficLight expected = sechubResultAssert.getHasTrafficLight().get(); - if (!expected.equals(report.getTrafficLight())) { + TrafficLight actual = report.getTrafficLight(); + if (!expected.equals(actual)) { testContext.markAsFailed( "SecHub report not as wanted. Expected was traffic light: " + expected + ", but result was: " + report.getTrafficLight(), "SecHub report was:\n" + reportAsJson); diff --git a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngine.java b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngine.java index 448556f5f5..a2b3d6f773 100644 --- a/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngine.java +++ b/sechub-systemtest/src/main/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngine.java @@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory; import com.mercedesbenz.sechub.api.SecHubClient; -import com.mercedesbenz.sechub.api.SecHubClientException; -import com.mercedesbenz.sechub.api.SecHubReport; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.TextFileReader; import com.mercedesbenz.sechub.commons.TextFileWriter; import com.mercedesbenz.sechub.commons.archive.ArchiveExtractionConstraints; @@ -28,10 +28,7 @@ import com.mercedesbenz.sechub.commons.archive.ArchiveSupport.ArchiveType; import com.mercedesbenz.sechub.commons.archive.FileSize; import com.mercedesbenz.sechub.commons.core.util.SimpleStringUtils; -import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.MetaDataModel; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -import com.mercedesbenz.sechub.commons.model.SecHubMessagesList; +import com.mercedesbenz.sechub.commons.model.*; import com.mercedesbenz.sechub.commons.pds.PDSMetaDataKeys; import com.mercedesbenz.sechub.systemtest.config.CopyDefinition; import com.mercedesbenz.sechub.systemtest.config.ExecutionStepDefinition; @@ -144,7 +141,7 @@ private void downloadPdsJobDataForDebugging(final TestEngineTestContext testCont return; } - SecHubClient adminClient = runtimeContext.getLocalAdminSecHubClient(); + SecHubClient client = runtimeContext.getLocalAdminSecHubClient(); Path testWorkingDirectory = runtimeContext.getLocationSupport().ensureTestWorkingDirectoryRealPath(testContext.getTest()); Path sechubJobFolder = testWorkingDirectory.resolve("sechub-job-" + secHubJobUUID); try { @@ -155,11 +152,10 @@ private void downloadPdsJobDataForDebugging(final TestEngineTestContext testCont Files.createDirectories(extractedScanLogFolder); Path jobFullScanLogFile; try { - jobFullScanLogFile = adminClient.downloadFullScanLog(secHubJobUUID, scanLogFolder); - } catch (SecHubClientException e) { + jobFullScanLogFile = client.downloadFullScanLog(secHubJobUUID, scanLogFolder); + } catch (ApiException e) { throw new CannotProvideDebugInformationException( - "Was not able to download full scan log file for sechub job:" + secHubJobUUID + ". Used SecHub admin user: " + adminClient.getUserId(), - e); + "Was not able to download full scan log file for sechub job:" + secHubJobUUID + ". Used SecHub admin user: " + client.getUserId(), e); } LOG.debug("Full scan downloaded to {}", jobFullScanLogFile); @@ -327,15 +323,16 @@ private void executeTest(TestEngineTestContext testContext) { } private void launchSecHubJob(TestEngineTestContext testContext) throws Exception { - SecHubClient clientForScheduling = null; + SecHubClient client = null; SystemTestRuntimeContext runtimeContext = testContext.getRuntimeContext(); if (runtimeContext.isLocalRun()) { - clientForScheduling = runtimeContext.getLocalAdminSecHubClient(); + client = runtimeContext.getLocalAdminSecHubClient(); } else { - clientForScheduling = runtimeContext.getRemoteUserSecHubClient(); + client = runtimeContext.getRemoteUserSecHubClient(); } - SecHubConfigurationModel configuration = testContext.getSecHubRunData().getSecHubConfiguration(); + SecHubConfiguration configuration = testContext.getSecHubRunData().getSecHubConfiguration(); + String projectId = testContext.getSecHubRunData().getSecHubConfiguration().getProjectId(); UUID jobUUID = null; if (LOG.isTraceEnabled()) { @@ -346,7 +343,7 @@ private void launchSecHubJob(TestEngineTestContext testContext) throws Exception jobUUID = UUID.randomUUID(); LOG.debug("Skip job creation - use fake job uuid"); } else { - jobUUID = clientForScheduling.createJob(configuration); + jobUUID = client.withSecHubExecutionApi().userCreateNewJob(configuration.getProjectId(), configuration).getJobId(); } LOG.debug("SecHub job {} created", jobUUID); testContext.getSecHubRunData().sechubJobUUID = jobUUID; @@ -355,13 +352,12 @@ private void launchSecHubJob(TestEngineTestContext testContext) throws Exception Path workingDirectory = resolveWorkingDirectoryRealPathForCurrentTest(testContext); LOG.debug("Start upload job data. Use working directory of current test: {}", workingDirectory); - String projectId = configuration.getProjectId(); if (runtimeContext.isDryRun()) { LOG.debug("Skip job upload because dry run"); } else { waitMilliseconds(300); // give server chance to create project parts - clientForScheduling.upload(projectId, jobUUID, configuration, workingDirectory); + client.userUpload(projectId, jobUUID, configuration, workingDirectory); waitMilliseconds(300); // give server chance to store result } @@ -369,7 +365,7 @@ private void launchSecHubJob(TestEngineTestContext testContext) throws Exception if (runtimeContext.isDryRun()) { LOG.debug("Skip job approve because dry run"); } else { - clientForScheduling.approveJob(projectId, jobUUID); + client.withSecHubExecutionApi().userApproveJob(projectId, jobUUID); } /* wait for job failed or done */ @@ -377,12 +373,14 @@ private void launchSecHubJob(TestEngineTestContext testContext) throws Exception LOG.debug("Skip job status fetching because dry run"); } else { long started = System.currentTimeMillis(); - while (!clientForScheduling.fetchJobStatus(projectId, jobUUID).getResult().hasFinished()) { + ScheduleJobStatusResult result = client.withSecHubExecutionApi().userCheckJobStatus(projectId, jobUUID).getResult(); + while (result.equals(ScheduleJobStatusResult.NONE)) { long diff = System.currentTimeMillis() - started; if (diff > MILLISECONDS_TO_WAIT_FOR_JOB_FINISHED) { throw new SystemTestRuntimeException("Job status for " + jobUUID + " took " + diff + " milliseconds (time out)"); } waitMilliseconds(300); + result = client.withSecHubExecutionApi().userCheckJobStatus(projectId, jobUUID).getResult(); } } @@ -392,14 +390,14 @@ private void launchSecHubJob(TestEngineTestContext testContext) throws Exception report = new SecHubReport(); report.setJobUUID(jobUUID); } else { - report = clientForScheduling.downloadSecHubReportAsJson(projectId, jobUUID); + report = client.withSecHubExecutionApi().userDownloadJobReport(projectId, jobUUID); } if (LOG.isDebugEnabled()) { - LOG.debug("Report returned from SecHub server for job: {}:\n", report.toFormattedJSON()); + LOG.debug("Report returned from SecHub server for job: {}:\n", report); } testContext.getSecHubRunData().report = report; testContext.markCurrentSecHubJob(jobUUID); - + testContext.storeSecHubResultFile(); } private void waitMilliseconds(int milliSeconds) { @@ -513,7 +511,7 @@ private void executeScript(TestEngineTestContext testContext, ScriptDefinition s * @author Albert Tregnaghi * */ - class CannotProvideDebugInformationException extends Exception { + private static class CannotProvideDebugInformationException extends Exception { private static final long serialVersionUID = 1L; @@ -523,17 +521,17 @@ public CannotProvideDebugInformationException(String message, Exception cause) { } - class SecHubRunData { + static class SecHubRunData { SecHubReport report; - SecHubConfigurationModel secHubConfiguration; + SecHubConfiguration secHubConfiguration; UUID sechubJobUUID; private SecHubRunData() { } - public SecHubConfigurationModel getSecHubConfiguration() { + public SecHubConfiguration getSecHubConfiguration() { return secHubConfiguration; } @@ -544,10 +542,9 @@ public SecHubReport getReport() { public UUID getSecHubJobUUID() { return sechubJobUUID; } - } - class DefaultCurrentTestVariableCalculatorFactory implements CurrentTestVariableCalculatorFactory { + private static class DefaultCurrentTestVariableCalculatorFactory implements CurrentTestVariableCalculatorFactory { @Override public CurrentTestVariableCalculator create(TestDefinition test, SystemTestRuntimeContext runtimeContext) { @@ -608,18 +605,18 @@ private void appendSecHubRunData() { } JSONConverter converter = JSONConverter.get(); - secHubRunData = systemTestRuntimeTestEngine.new SecHubRunData(); + secHubRunData = new SecHubRunData(); RunSecHubJobDefinition runSecHubJobDefinition = runSecHOptional.get(); - SecHubConfigurationModel secHubConfiguration = systemTestRuntimeTestEngine.runSecHubJobTransformer + SecHubConfiguration secHubConfiguration = systemTestRuntimeTestEngine.runSecHubJobTransformer .transformToSecHubConfiguration(runSecHubJobDefinition); String configurationAsJson = converter.toJSON(secHubConfiguration); String changedConfigurationAsJson = currentTestVariableCalculator.replace(configurationAsJson); - secHubRunData.secHubConfiguration = converter.fromJSON(SecHubConfigurationModel.class, changedConfigurationAsJson); + secHubRunData.secHubConfiguration = converter.fromJSON(SecHubConfiguration.class, changedConfigurationAsJson); storeSecHubConfigFile(secHubRunData.secHubConfiguration); } @@ -663,7 +660,7 @@ public void markCurrentSecHubJob(UUID sechubJobUUID) { runtimeContext.getCurrentResult().setSecHubJobUUID(sechubJobUUID); } - private void storeSecHubConfigFile(SecHubConfigurationModel configuration) { + private void storeSecHubConfigFile(SecHubConfiguration configuration) { Path targetFolder = resolveWorkingDirectoryRealPathForCurrentTest(this); String prettyPrintedJson = JSONConverter.get().toJSON(configuration, true); @@ -673,7 +670,22 @@ private void storeSecHubConfigFile(SecHubConfigurationModel configuration) { try { textFileWriter.writeTextToFile(targetFile, prettyPrintedJson, true); } catch (IOException e) { - LOG.error("Was not able to store sechub config file: {}", targetFile, e); + LOG.error("Was not able to store SecHub config file: {}", targetFile, e); + } + } + + private void storeSecHubResultFile() { + Path targetFolder = resolveWorkingDirectoryRealPathForCurrentTest(this); + + String prettyPrintedJson = JSONConverter.get().toJSON(getSecHubRunData().getReport(), true); + + String fileName = "sechub-report-%s.json".formatted(getSecHubRunData().getSecHubJobUUID()); + File targetFile = new File(targetFolder.toFile(), fileName); + + try { + textFileWriter.writeTextToFile(targetFile, prettyPrintedJson, true); + } catch (IOException e) { + LOG.error("Was not able to store SecHub report file: {}", targetFile, e); } } diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java index 85d575a740..052b62642e 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java @@ -19,7 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.mercedesbenz.sechub.commons.model.TrafficLight; +import com.mercedesbenz.sechub.api.internal.gen.model.TrafficLight; import com.mercedesbenz.sechub.commons.pds.PDSDefaultParameterKeyConstants; import com.mercedesbenz.sechub.systemtest.config.RuntimeVariable; import com.mercedesbenz.sechub.systemtest.config.SystemTestConfiguration; diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformerTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformerTest.java index cd3c70554c..9a511cc560 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformerTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/RunSecHubJobDefinitionTransformerTest.java @@ -12,16 +12,7 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; -import com.mercedesbenz.sechub.commons.model.SecHubBinaryDataConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -import com.mercedesbenz.sechub.commons.model.SecHubDataConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubFileSystemConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSourceDataConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.*; class RunSecHubJobDefinitionTransformerTest { @@ -44,7 +35,7 @@ void configuration_has_project_id_from_definition() { definition.setProject("projectName1"); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ assertEquals("projectName1", result.getProjectId()); @@ -56,7 +47,7 @@ void configuration_has_api_1_0() { RunSecHubJobDefinition definition = new RunSecHubJobDefinition(); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ assertEquals("1.0", result.getApiVersion()); @@ -71,10 +62,10 @@ void configuration_contains_code_scan_from_definition() { definition.setCodeScan(codeScanOpt); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - assertEquals(codeScan, result.getCodeScan().get()); + assertEquals(codeScan, result.getCodeScan()); } @Test @@ -86,10 +77,10 @@ void configuration_contains_web_scan_from_definition() { definition.setWebScan(webScanOpt); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - assertEquals(webScan, result.getWebScan().get()); + assertEquals(webScan, result.getWebScan()); } @Test @@ -101,10 +92,10 @@ void configuration_contains_license_scan_from_definition() { definition.setLicenseScan(licenseScanOpt); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - assertEquals(licenseScan, result.getLicenseScan().get()); + assertEquals(licenseScan, result.getLicenseScan()); } @Test @@ -116,10 +107,10 @@ void configuration_contains_infrascan_scan_from_definition() { definition.setInfraScan(infraScanOpt); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - assertEquals(infraScan, result.getInfraScan().get()); + assertEquals(infraScan, result.getInfraScan()); } @Test @@ -131,10 +122,10 @@ void configuration_contains_secretscan_scan_from_definition() { definition.setSecretScan(secretScanOpt); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - assertEquals(secretScan, result.getSecretScan().get()); + assertEquals(secretScan, result.getSecretScan()); } @Test @@ -154,25 +145,26 @@ void source_uploads_are_transformed_to_data_section() { definition.getUploads().add(upload); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - Optional dataOpt = result.getData(); - assertTrue(dataOpt.isPresent()); - SecHubDataConfiguration data = dataOpt.get(); + SecHubDataConfiguration data = result.getData(); + assertNotNull(data); List sourceConfigurations = data.getSources(); + assertNotNull(sourceConfigurations); assertEquals(1, sourceConfigurations.size()); SecHubSourceDataConfiguration sourceConfig = sourceConfigurations.iterator().next(); - String uniqueName1 = sourceConfig.getUniqueName(); + String uniqueName1 = sourceConfig.getName(); assertEquals(referenceId, uniqueName1); - Optional fileSystemConfigurationOpt = sourceConfig.getFileSystem(); - assertTrue(fileSystemConfigurationOpt.isPresent()); - SecHubFileSystemConfiguration fileSystemConfiguration = fileSystemConfigurationOpt.get(); + SecHubFileSystemConfiguration fileSystemConfiguration = sourceConfig.getFileSystem(); + assertNotNull(fileSystemConfiguration); List folders = fileSystemConfiguration.getFolders(); + assertNotNull(folders); assertTrue(folders.contains(folder)); List files = fileSystemConfiguration.getFiles(); + assertNotNull(files); assertTrue(files.contains(file)); } @@ -193,25 +185,26 @@ void binary_uploads_are_transformed_to_data_section() { definition.getUploads().add(upload); /* execute */ - SecHubConfigurationModel result = transformerToTest.transformToSecHubConfiguration(definition); + SecHubConfiguration result = transformerToTest.transformToSecHubConfiguration(definition); /* test */ - Optional dataOpt = result.getData(); - assertTrue(dataOpt.isPresent()); - SecHubDataConfiguration data = dataOpt.get(); + SecHubDataConfiguration data = result.getData(); + assertNotNull(data); List binaryConfigurations = data.getBinaries(); + assertNotNull(binaryConfigurations); assertEquals(1, binaryConfigurations.size()); SecHubBinaryDataConfiguration binaryConfig = binaryConfigurations.iterator().next(); - String uniqueName1 = binaryConfig.getUniqueName(); + String uniqueName1 = binaryConfig.getName(); assertEquals(referenceId, uniqueName1); - Optional fileSystemConfigurationOpt = binaryConfig.getFileSystem(); - assertTrue(fileSystemConfigurationOpt.isPresent()); - SecHubFileSystemConfiguration fileSystemConfiguration = fileSystemConfigurationOpt.get(); + SecHubFileSystemConfiguration fileSystemConfiguration = binaryConfig.getFileSystem(); + assertNotNull(fileSystemConfiguration); List folders = fileSystemConfiguration.getFolders(); + assertNotNull(folders); assertTrue(folders.contains(folder)); List files = fileSystemConfiguration.getFiles(); + assertNotNull(files); assertTrue(files.contains(file)); } diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java index a7388b8abb..840f8246af 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java @@ -14,10 +14,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubCodeScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.SecHubSecretScanConfiguration; +import com.mercedesbenz.sechub.api.internal.gen.model.TrafficLight; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.TrafficLight; import com.mercedesbenz.sechub.test.TestFileReader; class SystemTestConfigurationTest { @@ -286,11 +286,17 @@ private void buildTest(SystemTestConfiguration configuration) { runSecHubJob1.getUploads().add(upload); SecHubCodeScanConfiguration codeScan = new SecHubCodeScanConfiguration(); - codeScan.getNamesOfUsedDataConfigurationObjects().add(DEFINED_REFERENCE_ID); + if (codeScan.getUse() == null) { + codeScan.setUse(new ArrayList<>()); + } + codeScan.getUse().add(DEFINED_REFERENCE_ID); runSecHubJob1.setCodeScan(Optional.of(codeScan)); SecHubSecretScanConfiguration secretScan = new SecHubSecretScanConfiguration(); - secretScan.getNamesOfUsedDataConfigurationObjects().add(DEFINED_REFERENCE_ID); + if (secretScan.getUse() == null) { + secretScan.setUse(new ArrayList<>()); + } + secretScan.getUse().add(DEFINED_REFERENCE_ID); runSecHubJob1.setSecretScan(Optional.of(secretScan)); test1execute1.setRunSecHubJob(Optional.of(runSecHubJob1)); diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimePreparatorTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimePreparatorTest.java index 2fc991fbd4..00d82989c1 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimePreparatorTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/SystemTestRuntimePreparatorTest.java @@ -7,8 +7,8 @@ import java.io.IOException; import java.nio.file.Path; import java.util.Arrays; +import java.util.List; import java.util.Optional; -import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -17,15 +17,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.ScanType; -import com.mercedesbenz.sechub.commons.model.SecHubCodeScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName; -import com.mercedesbenz.sechub.commons.model.SecHubInfrastructureScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubLicenseScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubSecretScanConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanApiConfiguration; -import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; import com.mercedesbenz.sechub.systemtest.config.CredentialsDefinition; import com.mercedesbenz.sechub.systemtest.config.DefaultFallback; import com.mercedesbenz.sechub.systemtest.config.LocalSetupDefinition; @@ -273,20 +266,42 @@ private void assertUploadRefUsesReferenceId(RunSecHubJobDefinition job, String e private void assertJobScansUseReferenceId(RunSecHubJobDefinition job, String expectedReferenceId) { if (job.getCodeScan().isPresent()) { - assertContainsReference(job.getCodeScan().get().getNamesOfUsedDataConfigurationObjects(), expectedReferenceId); + SecHubCodeScanConfiguration codeScan = job.getCodeScan().get(); + List codeScanUsageByNames = codeScan.getUse(); + if (codeScanUsageByNames != null) { + assertContainsReference(codeScanUsageByNames, expectedReferenceId); + } } + if (job.getSecretScan().isPresent()) { - assertContainsReference(job.getSecretScan().get().getNamesOfUsedDataConfigurationObjects(), expectedReferenceId); + SecHubSecretScanConfiguration secretScan = job.getSecretScan().get(); + List secretScanUsageByNames = secretScan.getUse(); + if (secretScanUsageByNames != null) { + assertContainsReference(secretScanUsageByNames, expectedReferenceId); + } } + if (job.getLicenseScan().isPresent()) { - assertContainsReference(job.getLicenseScan().get().getNamesOfUsedDataConfigurationObjects(), expectedReferenceId); + SecHubLicenseScanConfiguration licenseScan = job.getLicenseScan().get(); + List licenseScanUsageByNames = licenseScan.getUse(); + if (licenseScanUsageByNames != null) { + assertContainsReference(licenseScanUsageByNames, expectedReferenceId); + } } - if (job.getWebScan().isPresent() && job.getWebScan().get().getApi().isPresent()) { - assertContainsReference(job.getWebScan().get().getApi().get().getNamesOfUsedDataConfigurationObjects(), expectedReferenceId); + + if (job.getWebScan().isPresent()) { + SecHubWebScanConfiguration webScan = job.getWebScan().get(); + SecHubWebScanApiConfiguration api = webScan.getApi(); + if (api != null) { + List webScanApiUsageByNames = api.getUse(); + if (webScanApiUsageByNames != null) { + assertContainsReference(webScanApiUsageByNames, expectedReferenceId); + } + } } } - private void assertContainsReference(Set list, String exptectedReferenceId) { + private void assertContainsReference(List list, String exptectedReferenceId) { if (list.contains(exptectedReferenceId)) { return; } @@ -297,24 +312,24 @@ private void assertContainsReference(Set list, String exptectedReference private void prepareScanConfigurationsForScanTypes(PreparationTestData data, RunSecHubJobDefinition secHubJob) { if (data.scope.isTypeContained(ScanType.CODE_SCAN)) { SecHubCodeScanConfiguration codeScan = new SecHubCodeScanConfiguration(); - prepareRefidIfDefined(data, codeScan); + prepareRefIdIfDefined(data, codeScan.getUse()); secHubJob.setCodeScan(Optional.of(codeScan)); } if (data.scope.isTypeContained(ScanType.SECRET_SCAN)) { SecHubSecretScanConfiguration secretScan = new SecHubSecretScanConfiguration(); - prepareRefidIfDefined(data, secretScan); + prepareRefIdIfDefined(data, secretScan.getUse()); secHubJob.setSecretScan(Optional.of(secretScan)); } if (data.scope.isTypeContained(ScanType.LICENSE_SCAN)) { SecHubLicenseScanConfiguration licenseScan = new SecHubLicenseScanConfiguration(); - prepareRefidIfDefined(data, licenseScan); + prepareRefIdIfDefined(data, licenseScan.getUse()); secHubJob.setLicenseScan(Optional.of(licenseScan)); } if (data.scope.isTypeContained(ScanType.WEB_SCAN)) { SecHubWebScanConfiguration webScan = new SecHubWebScanConfiguration(); SecHubWebScanApiConfiguration apiConfig = new SecHubWebScanApiConfiguration(); - webScan.setApi(Optional.of(apiConfig)); - prepareRefidIfDefined(data, apiConfig); + webScan.setApi(apiConfig); + prepareRefIdIfDefined(data, apiConfig.getUse()); secHubJob.setWebScan(Optional.of(webScan)); } if (data.scope.isTypeContained(ScanType.INFRA_SCAN)) { @@ -324,11 +339,11 @@ private void prepareScanConfigurationsForScanTypes(PreparationTestData data, Run } } - private void prepareRefidIfDefined(PreparationTestData data, SecHubDataConfigurationUsageByName target) { + private void prepareRefIdIfDefined(PreparationTestData data, List usages) { if (data.scope.refId == null) { return; } - target.getNamesOfUsedDataConfigurationObjects().add(data.scope.refId); + usages.add(data.scope.refId); } private void prepareUpload(PreparationTestData data, RunSecHubJobDefinition secHubJob) { diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngineTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngineTest.java index e9e554157d..6927027032 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngineTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/runtime/testengine/SystemTestRuntimeTestEngineTest.java @@ -11,14 +11,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.api.JobStatus; import com.mercedesbenz.sechub.api.SecHubClient; -import com.mercedesbenz.sechub.api.SecHubClientException; -import com.mercedesbenz.sechub.api.SecHubReport; +import com.mercedesbenz.sechub.api.internal.gen.SecHubExecutionApi; +import com.mercedesbenz.sechub.api.internal.gen.invoker.ApiException; +import com.mercedesbenz.sechub.api.internal.gen.model.*; import com.mercedesbenz.sechub.commons.model.JSONConverter; -import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; -import com.mercedesbenz.sechub.commons.model.TrafficLight; -import com.mercedesbenz.sechub.commons.model.job.ExecutionResult; import com.mercedesbenz.sechub.systemtest.config.AssertSechubResultDefinition; import com.mercedesbenz.sechub.systemtest.config.RunSecHubJobDefinition; import com.mercedesbenz.sechub.systemtest.config.TestAssertDefinition; @@ -32,23 +29,26 @@ class SystemTestRuntimeTestEngineTest { private static final TrafficLight EXPECTED_TRAFFIC_LIGHT_YELLOW = TrafficLight.YELLOW; + private SystemTestRuntimeTestEngine engineToTest; - private ExecutionSupport execSupport; private CurrentTestVariableCalculatorFactory currentTestVariableCalculatorFactory; private CurrentTestVariableCalculator calculator; private SystemTestRuntimeContext runtimeContext; private SecHubClient secHubClient; + private SecHubExecutionApi secHubExecutionApi; private LocationSupport locationSupport; private SystemTestRunResult currentTestResult; private TestAssertDefinition assertDefinition; @BeforeEach - void beforeEach() { - execSupport = mock(ExecutionSupport.class); + void beforeEach() throws ApiException { + ExecutionSupport execSupport = mock(ExecutionSupport.class); + calculator = mock(CurrentTestVariableCalculator.class); runtimeContext = mock(SystemTestRuntimeContext.class); currentTestVariableCalculatorFactory = mock(CurrentTestVariableCalculatorFactory.class); secHubClient = mock(SecHubClient.class); + secHubExecutionApi = mock(SecHubExecutionApi.class); locationSupport = mock(LocationSupport.class); currentTestResult = TestRuntimeAccess.createDummyTestRunResult(); assertDefinition = mock(TestAssertDefinition.class); @@ -57,18 +57,20 @@ void beforeEach() { engineToTest.currentTestVariableCalculatorFactory = currentTestVariableCalculatorFactory; when(locationSupport.ensureTestWorkingDirectoryRealPath(any())).thenReturn(Paths.get("./build/tmp/workingdirectory")); + when(secHubExecutionApi.userCreateNewJob(any(), any())).thenReturn(mock(SchedulerResult.class)); + when(secHubClient.withSecHubExecutionApi()).thenReturn(secHubExecutionApi); } @Test void sechub_client_without_errors_assertion_done__variant_valid() throws Exception { /* prepare */ - JobStatus status = new JobStatus(); - status.setResult(ExecutionResult.OK); - when(secHubClient.fetchJobStatus(any(), any())).thenReturn(status); + ScheduleJobStatus status = new ScheduleJobStatus(); + status.setResult(ScheduleJobStatusResult.OK); + when(secHubExecutionApi.userCheckJobStatus(any(), any())).thenReturn(status); SecHubReport report = new SecHubReport(); report.setTrafficLight(EXPECTED_TRAFFIC_LIGHT_YELLOW); - when(secHubClient.downloadSecHubReportAsJson(any(), any())).thenReturn(report); + when(secHubExecutionApi.userDownloadJobReport(any(), any())).thenReturn(report); TestDefinition test = configureSecHubLocalRunAndReturnTestDefinition(); @@ -87,13 +89,13 @@ void sechub_client_without_errors_assertion_done__variant_valid() throws Excepti @Test void sechub_client_without_errors_assertion_done__variant_assertion_fails_for_trafficlight() throws Exception { /* prepare */ - JobStatus status = new JobStatus(); - status.setResult(ExecutionResult.OK); - when(secHubClient.fetchJobStatus(any(), any())).thenReturn(status); + ScheduleJobStatus status = new ScheduleJobStatus(); + status.setResult(ScheduleJobStatusResult.OK); + when(secHubExecutionApi.userCheckJobStatus(any(), any())).thenReturn(status); SecHubReport report = new SecHubReport(); report.setTrafficLight(TrafficLight.RED); - when(secHubClient.downloadSecHubReportAsJson(any(), any())).thenReturn(report); + when(secHubExecutionApi.userDownloadJobReport(any(), any())).thenReturn(report); TestDefinition test = configureSecHubLocalRunAndReturnTestDefinition(); @@ -112,7 +114,7 @@ void sechub_client_without_errors_assertion_done__variant_assertion_fails_for_tr @Test void sechub_job_creation_fails() throws Exception { /* prepare */ - when(secHubClient.createJob(any())).thenThrow(new SecHubClientException("unable to create job")); + when(secHubExecutionApi.userCreateNewJob(any(), any())).thenThrow(new ApiException("unable to create job")); TestDefinition test = configureSecHubLocalRunAndReturnTestDefinition(); @@ -129,10 +131,10 @@ void sechub_job_creation_fails() throws Exception { @Test void sechub_download_fails() throws Exception { /* prepare */ - JobStatus status = new JobStatus(); - status.setResult(ExecutionResult.OK); - when(secHubClient.fetchJobStatus(any(), any())).thenReturn(status); - when(secHubClient.downloadSecHubReportAsJson(any(), any())).thenThrow(new NullPointerException()); + ScheduleJobStatus status = new ScheduleJobStatus(); + status.setResult(ScheduleJobStatusResult.OK); + when(secHubExecutionApi.userCheckJobStatus(any(), any())).thenReturn(status); + when(secHubExecutionApi.userDownloadJobReport(any(), any())).thenThrow(new NullPointerException()); TestDefinition test = configureSecHubLocalRunAndReturnTestDefinition(); /* execute */ @@ -147,7 +149,7 @@ void sechub_download_fails() throws Exception { @Test void sechub_status_fails() throws Exception { /* prepare */ - when(secHubClient.fetchJobStatus(any(),any())).thenThrow(new SecHubClientException("no status readable")); + when(secHubExecutionApi.userCheckJobStatus(any(),any())).thenThrow(new ApiException("no status readable")); TestDefinition test = configureSecHubLocalRunAndReturnTestDefinition(); @@ -167,8 +169,8 @@ private TestDefinition configureSecHubLocalRunAndReturnTestDefinition() { when(runtimeContext.getLocationSupport()).thenReturn(locationSupport); when(runtimeContext.getCurrentResult()).thenReturn(currentTestResult); - SecHubConfigurationModel dummyModel = new SecHubConfigurationModel(); - when(calculator.replace(any())).thenReturn(JSONConverter.get().toJSON(dummyModel)); + SecHubConfiguration dummySecHubConfiguration = new SecHubConfiguration(); + when(calculator.replace(any())).thenReturn(JSONConverter.get().toJSON(dummySecHubConfiguration)); AssertSechubResultDefinition sechubResult = new AssertSechubResultDefinition(); diff --git a/sechub-systemtest/src/test/resources/additional-resources/expected-output/sechub-result1.json b/sechub-systemtest/src/test/resources/additional-resources/expected-output/sechub-result1.json index 3b48e3543c..35d31d5baa 100644 --- a/sechub-systemtest/src/test/resources/additional-resources/expected-output/sechub-result1.json +++ b/sechub-systemtest/src/test/resources/additional-resources/expected-output/sechub-result1.json @@ -1,5 +1,15 @@ { - "jobUUID" : "{sechub.jobuuid}", + "messages" : [ { + "type" : "ERROR", + "text" : "error for PDS job: {*:36} but with\n a multine ....\n " + }, { + "type" : "WARNING", + "text" : "warn for PDS job: {*:36}" + }, { + "type" : "INFO", + "text" : "info for PDS job: {*:36}" + } ], + "status" : "SUCCESS", "trafficLight" : "YELLOW", "result" : { "count" : 4, @@ -53,10 +63,9 @@ "type" : "codeScan" } ] }, - "status" : "SUCCESS", + "jobUUID" : "{sechub.jobuuid}", "reportVersion" : "1.0", "metaData" : { - "labels" : { }, "summary" : { "codeScan" : { "total" : 4, @@ -82,15 +91,5 @@ } } } - }, - "messages" : [ { - "type" : "ERROR", - "text" : "error for PDS job: {*:36} but with\n a multine ....\n " - }, { - "type" : "WARNING", - "text" : "warn for PDS job: {*:36}" - }, { - "type" : "INFO", - "text" : "info for PDS job: {*:36}" - } ] + } } \ No newline at end of file diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-start-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-start-single-sechub-network-docker-compose.sh index 1379b3fdf0..38ae4a3c7a 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-stop-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-stop-single-sechub-network-docker-compose.sh index 815b3cb413..55d77ba0ce 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-fail_on_start/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-start-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-start-single-sechub-network-docker-compose.sh index aa143b013d..c8d0c65fcf 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-stop-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-stop-single-sechub-network-docker-compose.sh index 1fc22b47a0..d70d11dba4 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-gosec/05-stop-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-start-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-start-single-sechub-network-docker-compose.sh index 65ffb7be1e..7e54ba5d7a 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-start-single-sechub-network-docker-compose.sh @@ -1,2 +1,2 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-stop-single-sechub-network-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-stop-single-sechub-network-docker-compose.sh index bfef1c47dc..2cd2a68009 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-stop-single-sechub-network-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-pds-solutions/faked-xray/05-stop-single-sechub-network-docker-compose.sh @@ -1,3 +1,3 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-alpine.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-alpine.sh index 5d9ce01ff4..a71ef57d05 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-alpine.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-alpine.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-fedora.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-fedora.sh index 325124e59e..1dd1072f4e 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-fedora.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-fedora.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-rocky.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-rocky.sh index 23002a02c4..c16c8948fc 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-rocky.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-rocky.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-ubuntu.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-ubuntu.sh index 8ba9376908..03932a3b1f 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-ubuntu.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose-ubuntu.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose.sh index 96516ebfc8..d5387e9417 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-stop-single-docker-compose.sh b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-stop-single-docker-compose.sh index 8b120b9e35..09a24d6643 100755 --- a/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-stop-single-docker-compose.sh +++ b/sechub-systemtest/src/test/resources/fake-root/sechub-solution/01-stop-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2SecHubReportTest.java b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java similarity index 98% rename from sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2SecHubReportTest.java rename to sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java index 770f127393..2dc14b2ec0 100644 --- a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2SecHubReportTest.java +++ b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java @@ -29,7 +29,7 @@ * @author Albert Tregnaghi * */ -public class Sarif2Sereco2SecHubReportTest { +public class Sarif2Sereco2ScanSecHubReportLoaderTest { @Test void example1_owasp_zap_report_is_transformed_to_expected_sechub_report() throws Exception { diff --git a/sechub-webui-solution/01-start-single-docker-compose.sh b/sechub-webui-solution/01-start-single-docker-compose.sh index bba166d86a..b524c9df28 100755 --- a/sechub-webui-solution/01-start-single-docker-compose.sh +++ b/sechub-webui-solution/01-start-single-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-webui-solution/05-start-single-sechub-network-docker-compose.sh b/sechub-webui-solution/05-start-single-sechub-network-docker-compose.sh index fff4a65d62..44309e1924 100755 --- a/sechub-webui-solution/05-start-single-sechub-network-docker-compose.sh +++ b/sechub-webui-solution/05-start-single-sechub-network-docker-compose.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd $(dirname "$0") diff --git a/sechub-webui-solution/10-create-image.sh b/sechub-webui-solution/10-create-image.sh index 8a740b3d17..430b02fadf 100755 --- a/sechub-webui-solution/10-create-image.sh +++ b/sechub-webui-solution/10-create-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT REGISTRY="$1" diff --git a/sechub-webui-solution/20-push-image.sh b/sechub-webui-solution/20-push-image.sh index c0ab2fb35c..76f6ba2f19 100755 --- a/sechub-webui-solution/20-push-image.sh +++ b/sechub-webui-solution/20-push-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash # SPDX-License-Identifier: MIT cd `dirname $0` diff --git a/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/sechubaccess/SecHubAccessService.java b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/sechubaccess/SecHubAccessService.java index 26a799f4dd..c25d3ff76a 100644 --- a/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/sechubaccess/SecHubAccessService.java +++ b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/sechubaccess/SecHubAccessService.java @@ -8,8 +8,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import com.mercedesbenz.sechub.api.DefaultSecHubClient; import com.mercedesbenz.sechub.api.MockedSecHubClient; +import com.mercedesbenz.sechub.api.OldDefaultSecHubClient; import com.mercedesbenz.sechub.api.SecHubClient; import com.mercedesbenz.sechub.api.SecHubClientException; @@ -62,7 +62,7 @@ void initSecHubClient() { this.client = MockedSecHubClient.from(serverUri, userId, apiToken, trustAllCertificates); } else { - this.client = DefaultSecHubClient.builder(). + this.client = OldDefaultSecHubClient.builder(). server(serverUri). user(userId). apiToken(apiToken).