-
Notifications
You must be signed in to change notification settings - Fork 0
Feature enhance source link #52
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
base: pre-release-1.0.35
Are you sure you want to change the base?
Feature enhance source link #52
Conversation
| var sastResultsUrl = apibaseurl + '/sast-results/' + appId + '/' + scanId; | ||
| var sastVulnerabilityLink = ''; | ||
| var resultHash = jsonLastScanReportResp.results[item].data.resultHash; | ||
| if (resultHash && resultHash != '') { |
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.
Replace if (resultHash && resultHash != '') with if (resultHash)
being falsy already covers empty strings.
| var kicsResultsUrl = apibaseurl + '/results/' + scanId + '/' + appId + '/kics'; | ||
| var kicsVulnerabilityLink = ''; | ||
| var kicsAlternateId = jsonLastScanReportResp.results[item].alternateId; | ||
| if (kicsAlternateId && kicsAlternateId != '') { |
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 can be simplified to just: if (kicsAlternateId)
| var imageName = jsonLastScanReportResp.results[item].data.imageName; | ||
| var imageTag = jsonLastScanReportResp.results[item].data.imageTag; | ||
|
|
||
| var encodedFilePath = encodeURIComponent(gs.base64Encode(imageFilePath)); |
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.
Optional : If any of the key fields are undefined or null (imageFilePath, imageName), the encoding functions may throw or produce "undefined" strings.
We may need to consider validations.
if (imageFilePath && imageName) {
// operations
}
| resultObj['source_link'] = node.getAttribute('sourcefile'); | ||
|
|
||
| var vulnerabilityLink = node.getAttribute('vulnerability_link'); | ||
| if (vulnerabilityLink && vulnerabilityLink != '') { |
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.
just use if (vulnerabilityLink) instead of if (vulnerabilityLink && vulnerabilityLink != '')
Enhanced source vulnerability links