-
Notifications
You must be signed in to change notification settings - Fork 65
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
Feature 3611 zap wrapper webscan template login #3622
base: develop
Are you sure you want to change the base?
Conversation
winzj
commented
Nov 18, 2024
- closes Implement template login for ZAP wrapper application #3611
- add entry to openapi.yaml - add field with default - extend unit tests - extend examples, documentation and RestDocTest
- add decoder with autodetect method and unit testcases - add seed to totp generator and change signature - update unit testcases
- add parts for script execution with session management - add script authentication to ZapScanner - add necessary dependencies to gradle files - add configuration option via commandline parameter and ENV variable
- add groovy script example to README.adoc - add short explanations - add method to TOTPGenerator to generate a currently valid TOTP - update examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I found still some parts which should be changed.
If the changes are too big (e.g. refactoring of client wrapper, to use only dedicated values (e.g. booleans, integers ) etc.
feel free to create a new issue to handle this later.
...ub-commons-model/src/main/java/com/mercedesbenz/sechub/commons/model/login/EncodingType.java
Show resolved
Hide resolved
sechub-doc/src/docs/asciidoc/documents/shared/configuration/sechub_config.adoc
Show resolved
Hide resolved
sechub-doc/src/docs/asciidoc/documents/shared/configuration/sechub_config.adoc
Show resolved
Hide resolved
private String hashAlgorithmName; | ||
private int totpLength; | ||
private int tokenValidityTimeInSeconds; | ||
private long digitsTruncate; | ||
|
||
public TOTPGenerator() { | ||
this(DEFAULT_TOTP_LENGTH, TOTPHashAlgorithm.HMAC_SHA1, DEFAULT_TOKEN_VALIDITY_TIME_IN_SECONDS); | ||
public TOTPGenerator(String seed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor is only used inside 2 tests.
Do we really need this one? Or should we create instead a static test helper method inside the tests or something else?
@Test | ||
void file_does_not_exist_and_so_no_scan_is_cancelled() throws IOException { | ||
/* prepare */ | ||
String scanContextName = UUID.randomUUID().toString(); | ||
ZapPDSEventHandler zapPDSEventHandler = new ZapPDSEventHandler(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a parameterized test and
injecting "" ," " and null as value parameters?
|
||
/* execute + test */ | ||
assertFalse(zapPDSEventHandler.isScanCancelled()); | ||
assertDoesNotThrow(() -> zapPDSEventHandler.cancelScan(scanContextName)); | ||
} | ||
|
||
@Test | ||
void file_does_exist_and_so_scan_is_cancelled(@TempDir File tempDir) throws IOException { | ||
void file_does_exist_and_so_scan_is_cancelled(@TempDir Path tempDir) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whabt about file DOES NOT exist case? should we add an additional test here?
private StringDecoder supportToTest = new StringDecoder(); | ||
|
||
@Test | ||
void when_secret_key_is_null_an_exception_is_thrown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if secret key is blank ("", " ") -> is this a valid key?
It is not tested in any test, so i am not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when encoding type is null, or different? Should this be tested as well?