Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle binaries and sourcecode data section parts at PDS and SecHub side #1316

Merged
merged 19 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5f9ff7a
Start implementing support for binaries on PDS side #1167
de-jcup May 6, 2022
4403785
Moved gradle sub parts to gradle folder #1321 + introduce archive
de-jcup May 9, 2022
e207666
Replaced PDSScanType with ScanType #1322,consolidate archive parts #1323
de-jcup May 9, 2022
32a60fc
Combined Tar and ZipSupport into one single codebase #1323
de-jcup May 9, 2022
e7f99c1
Implemented transformation while extracting ZIP and Tars #1167
de-jcup May 9, 2022
d9169a3
made integration tests faster #1340
de-jcup May 12, 2022
b57c749
Using now always growing scenarios to speed up execution time #1340
de-jcup May 16, 2022
0c1e4e8
Integration test enhancements #1340
de-jcup May 17, 2022
ab078f4
Created javadoc overview and details about profiles for testing #1167
de-jcup May 18, 2022
55b70f1
Implemented integration test for binary PDS handling #1167
de-jcup May 19, 2022
3b05a35
Merge branch 'develop' into feature-1167-handle-binaries-on-PDS-serve…
de-jcup May 19, 2022
c0f208d
Implementation changes for #1167
de-jcup May 19, 2022
ef49e51
Implementation changes for #1167
de-jcup May 20, 2022
9e82d60
Introduce environment variables + handle uploads different #1308
de-jcup May 24, 2022
3390eca
Use binary upload mechanism introduced in sechub for pds uploads #1351
de-jcup May 24, 2022
ce33e7a
Added integration tests + updated documentation #1167
de-jcup May 25, 2022
5386162
Merge branch 'develop' into feature-1167
de-jcup May 25, 2022
be41d9c
Added archive extraction documentation #1177
de-jcup May 25, 2022
ce0ac1f
Review changes for PR #1316
de-jcup Jun 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions apply-headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ echo -e " --------------------------------------------"
##########################################################
# Apply SPDX license headers:
applySPDXonFirstLine "adoc" "// $SPDX_TEXT"
applySPDXonFirstLine "puml" "' $SPDX_TEXT"
applySPDXonFirstLine "plantuml" "' $SPDX_TEXT"
applySPDXonFirstLine "bat" ":: $SPDX_TEXT"
applySPDXonFirstLine "c" "// $SPDX_TEXT"
applySPDXonFirstLine "dockerfile" "# $SPDX_TEXT"
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
buildscript{

apply from: "${rootProject.projectDir}/libraries.gradle"
apply from: "${rootProject.projectDir}/projects.gradle"
apply from: "${rootProject.projectDir}/gradle/libraries.gradle"
apply from: "${rootProject.projectDir}/gradle/projects.gradle"

def customMavenRepoURL4plugins = System.getenv('CUST_MVN_URL_PLUGINS')
if (customMavenRepoURL4plugins!=null){
Expand Down Expand Up @@ -120,9 +120,9 @@ spotless {
}
}

apply from: "${rootProject.projectDir}/build-versioning.gradle"
apply from: "${rootProject.projectDir}/build-java.gradle"
apply from: "${rootProject.projectDir}/build-spring.gradle"
apply from: "${rootProject.projectDir}/build-maven.gradle"
apply from: "${rootProject.projectDir}/build-eclipse.gradle"
apply from: "${rootProject.projectDir}/build-report.gradle"
apply from: "${rootProject.projectDir}/gradle/build-versioning.gradle"
apply from: "${rootProject.projectDir}/gradle/build-java.gradle"
apply from: "${rootProject.projectDir}/gradle/build-spring.gradle"
apply from: "${rootProject.projectDir}/gradle/build-maven.gradle"
apply from: "${rootProject.projectDir}/gradle/build-eclipse.gradle"
apply from: "${rootProject.projectDir}/gradle/build-report.gradle"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion libraries.gradle → gradle/libraries.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ext {
apache_commons_io: "2.11.0",
apache_commons_validator: "1.7",
apache_commons_fileupload: "1.4",
apache_commons_compress: "1.21",

/* testing */
junit4: "4.13.2",
Expand All @@ -69,7 +70,6 @@ ext {
owaspzap_client_api: "1.10.0",
jcommander: "1.82",


]

library = [
Expand Down Expand Up @@ -115,6 +115,8 @@ ext {
apache_commons_io: "commons-io:commons-io:${libraryVersion.apache_commons_io}",
apache_commons_cli: "commons-cli:commons-cli:${libraryVersion.apache_commons_cli}",
apache_commons_fileupload: "commons-fileupload:commons-fileupload:${libraryVersion.apache_commons_fileupload}",
apache_commons_compress: "org.apache.commons:commons-compress:${libraryVersion.apache_commons_compress}",

// JDK 10 build problems handling
// https://stackoverflow.com/questions/43574426/how-to-resolve-java-langnoclassdeffounderror-javax-xml-bind-jaxbexception-in-j
jdk_missing_jaxb_api: "javax.xml.bind:jaxb-api:${libraryVersion.jaxb_api}",
Expand Down
1 change: 1 addition & 0 deletions projects.gradle → gradle/projects.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ projectType = [
project(':sechub-commons-model'),
project(':sechub-commons-model-testframework'),
project(':sechub-commons-pds'),
project(':sechub-commons-archive'),
project(':sechub-storage-core'),
project(':sechub-wrapper-owasp-zap'),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.mercedesbenz.sechub.adapter.AdapterRuntimeContext;
import com.mercedesbenz.sechub.adapter.mock.MockedAdapter;
import com.mercedesbenz.sechub.adapter.mock.MockedAdapterSetupService;
import com.mercedesbenz.sechub.commons.pds.PDSDefaultParameterKeyConstants;

/**
* Special adapter which is per default mocked, but can be defined to use real
Expand All @@ -26,8 +27,6 @@
public class DelegatingMockablePDSAdapterV1 extends AbstractAdapter<PDSAdapterContext, PDSAdapterConfig>
implements MockedAdapter<PDSAdapterConfig>, PDSAdapter {

public static final String JOB_PARAMETER_KEY__PDS_MOCKING_DISABLED = "pds.mocking.disabled";

private static final Logger LOG = LoggerFactory.getLogger(DelegatingMockablePDSAdapterV1.class);

MockedPDSAdapterV1 mockedPdsAdapterV1;
Expand All @@ -51,7 +50,9 @@ public int getAdapterVersion() {

@Override
protected String execute(PDSAdapterConfig config, AdapterRuntimeContext runtimeContext) throws AdapterException {
String mockingDisabled = config.getJobParameters().get(JOB_PARAMETER_KEY__PDS_MOCKING_DISABLED);
PDSAdapterConfigData data = config.getPDSAdapterConfigData();
String mockingDisabled = data.getJobParameters().get(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_MOCKING_DISABLED);

boolean useMock = !Boolean.parseBoolean(mockingDisabled);

LOG.info("execution starting, using mocked adapter={}", useMock);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

import java.util.Map;
import java.util.UUID;

import com.mercedesbenz.sechub.adapter.AdapterConfig;

public interface PDSAdapterConfig extends AdapterConfig {

Map<String, String> getJobParameters();

UUID getSecHubJobUUID();

String getPdsProductIdentifier();
public interface PDSAdapterConfig extends AdapterConfig, PDSAdapterConfigDataProvider {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

import com.mercedesbenz.sechub.adapter.AdapterConfigBuilder;

public interface PDSAdapterConfigBuilder extends AdapterConfigBuilder, PDSAdapterConfiguratorProvider {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

import java.io.InputStream;
import java.util.Map;
import java.util.UUID;

import com.mercedesbenz.sechub.commons.model.ScanType;
import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel;

public interface PDSAdapterConfigData {

/**
* @return an unmodifiable map with job parameters
*/
Map<String, String> getJobParameters();

UUID getSecHubJobUUID();

String getPdsProductIdentifier();

InputStream getSourceCodeZipFileInputStreamOrNull();

String getSourceCodeZipFileChecksumOrNull();

InputStream getBinaryTarFileInputStreamOrNull();

String getBinariesTarFileChecksumOrNull();

boolean isReusingSecHubStorage();

boolean isSourceCodeZipFileRequired();

boolean isBinaryTarFileRequired();

SecHubConfigurationModel getSecHubConfigurationModel();

ScanType getScanType();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

public interface PDSAdapterConfigDataProvider {

PDSAdapterConfigData getPDSAdapterConfigData();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

import java.io.InputStream;
import java.util.Map;
import java.util.UUID;

import com.mercedesbenz.sechub.commons.model.ScanType;
import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel;

public interface PDSAdapterConfigurator {

void setPdsProductIdentifier(String pdsProductIdentifier);

void setSourceCodeZipFileInputStreamOrNull(InputStream sourceCodeZipFileInputStreamOrNull);

void setSourceCodeZipFileChecksumOrNull(String sourceCodeZipFileChecksumOrNull);

void setBinaryTarFileInputStreamOrNull(InputStream binaryTarFileInputStreamOrNull);

void setBinariesTarFileChecksumOrNull(String binaryTarFileChecksum);

void setSecHubJobUUID(UUID secHubJobUUID);

void setJobParameters(Map<String, String> jobParameters);
de-jcup marked this conversation as resolved.
Show resolved Hide resolved

void setSecHubConfigurationModel(SecHubConfigurationModel secHubConfigurationModel);

void setReusingSecHubStorage(boolean reusingSecHubStorage);

void setSourceCodeZipFileRequired(boolean sourceCodeZipFileRequired);

void setBinaryTarFileRequired(boolean binaryTarFileRequired);

void setScanType(ScanType scanType);

/**
* Will be automatically called by {@link #configure()}. and validates defined
* parts only
*/
void validateNonCalculatedParts();

/**
* Will be automatically called by {@link #configure()}. If the calculated parts
* needs a validation as well, this must be done also here. The
* {@link #validateNonCalculatedParts()} method does only check the non
* calculated parts.
*/
void calculate();

/**
* First {@link #validateNonCalculatedParts()} will be called by this method.
* Then the {@link #calculate()} method is called. The default implementation
* does this already and should not be changed.
*/
public default void configure() {
validateNonCalculatedParts();
calculate();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: MIT
package com.mercedesbenz.sechub.adapter.pds;

public interface PDSAdapterConfiguratorProvider {

PDSAdapterConfigurator getPDSAdapterConfigurator();
}
Loading