-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SecHub PDS communication parts for assets and templates #3523
- it is now ensured on every pds job call, that the assets in storage are same as in db. Same logic for admin create/update operation is used. - improved PDSWebScanJobScenario12IntTest which does now uses templates and assets. The test ensures that the PDS instance will receive the pds template meta data. - changed templateDefinition format. Assets now no longer an array but only one entry. Means we have 1:n relation here from asset to templates and no longer m:n. - added unit tests - introduced TemplateData resolver in commons-model which can be used from PDS and wrapper applications - introduced TemplateData inside SecHub convfiguration file - Template and Asset REST controller are now annotated with profile admin access
- Loading branch information
Showing
63 changed files
with
1,823 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ore/src/main/java/com/mercedesbenz/sechub/commons/core/ConfigurationFailureException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
package com.mercedesbenz.sechub.commons.core; | ||
|
||
public class ConfigurationFailureException extends Exception { | ||
|
||
public ConfigurationFailureException(String message) { | ||
super(message); | ||
} | ||
|
||
public ConfigurationFailureException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
private static final long serialVersionUID = -384180667154600386L; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
...mons-model/src/main/java/com/mercedesbenz/sechub/commons/model/template/TemplateData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
package com.mercedesbenz.sechub.commons.model.template; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Template data for SecHub configuration model | ||
* Template data for SecHub configuration model. Here users can define user | ||
* specific template data - e.g. variables like "username", "password" | ||
* | ||
* @author Albert Tregnaghi | ||
* | ||
*/ | ||
public class TemplateData { | ||
|
||
private Map<String, String> variables = new LinkedHashMap<>(); | ||
|
||
public Map<String, String> getVariables() { | ||
return variables; | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...el/src/main/java/com/mercedesbenz/sechub/commons/model/template/TemplateDataResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
package com.mercedesbenz.sechub.commons.model.template; | ||
|
||
import java.util.Optional; | ||
|
||
import com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel; | ||
import com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration; | ||
import com.mercedesbenz.sechub.commons.model.login.WebLoginConfiguration; | ||
|
||
public class TemplateDataResolver { | ||
|
||
public TemplateData resolveTemplateData(TemplateType type, SecHubConfigurationModel configuration) { | ||
if (type == null) { | ||
return null; | ||
} | ||
if (configuration == null) { | ||
return null; | ||
} | ||
switch (type) { | ||
case WEBSCAN_LOGIN: | ||
return resolveWebScanLoginTemplateData(configuration); | ||
default: | ||
break; | ||
} | ||
return null; | ||
} | ||
|
||
private TemplateData resolveWebScanLoginTemplateData(SecHubConfigurationModel configuration) { | ||
Optional<SecHubWebScanConfiguration> webScanOpt = configuration.getWebScan(); | ||
if (webScanOpt.isEmpty()) { | ||
return null; | ||
} | ||
SecHubWebScanConfiguration webScan = webScanOpt.get(); | ||
Optional<WebLoginConfiguration> loginOpt = webScan.getLogin(); | ||
if (loginOpt.isEmpty()) { | ||
return null; | ||
} | ||
WebLoginConfiguration login = loginOpt.get(); | ||
return login.getTemplateData(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.