-
Notifications
You must be signed in to change notification settings - Fork 29
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
DAST rescan #236
Open
vishalhcl-5960
wants to merge
24
commits into
master
Choose a base branch
from
DAST-rescan
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
DAST rescan #236
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
93187be
dast-rescan
vishalhcl-5960 a6e7a87
Update DynamicAnalyzer.java
vishalhcl-5960 5ae512d
Update DynamicAnalyzer.java
vishalhcl-5960 aa98bd6
URL validation check for A360
vishalhcl-5960 a7ea86f
updated scanId validation method
vishalhcl-5960 4a405fa
UI scanId validation
vishalhcl-5960 4ce66b7
Code enhancement for better UI
vishalhcl-5960 54e4c81
indentation checks & bug fixes
vishalhcl-5960 372de05
updated the scanId validation method
vishalhcl-5960 b3797ba
A360 version check for URL validation
vishalhcl-5960 408208a
UI URL validation for A360 connection
vishalhcl-5960 16b7a85
A360 version check for URL validation
vishalhcl-5960 b686bdb
As per PR comments
vishalhcl-5960 193d928
Addressing PR comments
vishalhcl-5960 66a62fb
Moved the common validation method to the base scanner class
vishalhcl-5960 ffb79e6
UI validation for base scan field
vishalhcl-5960 63b9f39
As per comments
vishalhcl-5960 9d05f21
indentation checks
vishalhcl-5960 d75f3cc
ASA-10068
Vishal5960 c8bf28e
ASA-10067
vishalhcl-5960 2a1c29f
Merge branch 'DAST-rescan' of https://github.com/jenkinsci/appscan-pl…
vishalhcl-5960 c9b1522
Update DynamicAnalyzer.java
vishalhcl-5960 cb9ddc5
Updated the warning message statement
vishalhcl-5960 c4e1cbd
ASA-9275
vishalhcl-5960 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/hcl/appscan/jenkins/plugin/scanners/ScanDescriptor.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,8 +1,30 @@ | ||
package com.hcl.appscan.jenkins.plugin.scanners; | ||
|
||
import com.hcl.appscan.jenkins.plugin.Messages; | ||
import com.hcl.appscan.sdk.CoreConstants; | ||
import com.hcl.appscan.sdk.utils.ServiceUtil; | ||
import hudson.model.Descriptor; | ||
import hudson.util.FormValidation; | ||
import org.apache.wink.json4j.JSONException; | ||
import org.apache.wink.json4j.JSONObject; | ||
|
||
public abstract class ScanDescriptor extends Descriptor<Scanner> { | ||
public ScanDescriptor() { | ||
} | ||
|
||
protected FormValidation scanIdValidation(JSONObject scanDetails, String application) throws JSONException { | ||
if(scanDetails == null) { | ||
return FormValidation.error(Messages.error_invalid_scan_id_ui()); | ||
} else { | ||
String status = scanDetails.getJSONObject("LatestExecution").getString("Status"); | ||
if (!(status.equals("Ready") || status.equals("Paused") || status.equals("Failed"))) { | ||
return FormValidation.error(Messages.error_scan_id_validation_status(status)); | ||
} else if (!scanDetails.get("RescanAllowed").equals(true) && scanDetails.get("ParsedFromUploadedFile").equals(true)) { | ||
return FormValidation.error(Messages.error_invalid_scan_id_rescan_allowed_ui()); | ||
} else if (!scanDetails.get(CoreConstants.APP_ID).equals(application)) { | ||
return FormValidation.error(Messages.error_invalid_scan_id_application_ui()); | ||
} | ||
} | ||
return FormValidation.ok(); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Much of the same logic is repeated numerous times in each of the scanners doCheckScanId() method. Common logic should be placed in the base class and only scanner specific logic should be in the scanner classes.
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.
As this method for doing the UI validations, we can't have the same validations in the abstract scanner class.
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.
Why is that the case? We could add a protected static method to the Scanner base class that performed all of the common checks. That method would then be called in each of the subclasses doCheckScanId() method, along with any scanner specific checks that are needed for that technology.
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.
As the "DescriptorImpl" class of each scan-type extends the "ScanDescriptor" class. I will add a new method in common class which will handle all the common validations for scanId.
protected FormValidation scanIdValidation(JSONObject scanDetails, String application)