-
Notifications
You must be signed in to change notification settings - Fork 24
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
Malicious code scanner #296
base: dev
Are you sure you want to change the base?
Conversation
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.
- Improve PR details, Link related PRs
- Please add tests! there are multiple places to add them
- Take a look at my comments.
- Make sure the PM are aware of the output and approve the text and UI before merge
@@ -49,6 +49,7 @@ const ( | |||
IacScan SubScanType = "iac" | |||
SastScan SubScanType = "sast" | |||
SecretsScan SubScanType = "secrets" | |||
MaliciousCodeScan SubScanType = "malicious_code" |
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.
also add to GetAllSupportedScans
and IsJASRequested
MaliciousVulnerabilities []SourceCodeRow `json:"malicious_code"` | ||
MaliciousViolations []SourceCodeRow `json:"maliciousViolations"` |
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.
MaliciousVulnerabilities []SourceCodeRow `json:"malicious_code"` | |
MaliciousViolations []SourceCodeRow `json:"maliciousViolations"` | |
MaliciousVulnerabilities []SourceCodeRow `json:"maliciousCode"` | |
MaliciousViolations []SourceCodeRow `json:"maliciousViolations"` |
make sure the formats are the same...
if sjc.current == nil { | ||
return results.ErrResetConvertor | ||
} | ||
maliciousSimpleJson, err := PrepareSimpleJsonJasIssues(sjc.entitledForJas, sjc.pretty, results.ScanResultsToRuns(maliciousFindings)...) | ||
if err != nil || len(maliciousSimpleJson) == 0 { | ||
return | ||
} |
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.
if sjc.current == nil { | |
return results.ErrResetConvertor | |
} | |
maliciousSimpleJson, err := PrepareSimpleJsonJasIssues(sjc.entitledForJas, sjc.pretty, results.ScanResultsToRuns(maliciousFindings)...) | |
if err != nil || len(maliciousSimpleJson) == 0 { | |
return | |
} | |
if sjc.current == nil { | |
return results.ErrResetConvertor | |
} | |
for i := range maliciousFindings { | |
if shouldUpdateStatus(sjc.current.Statuses.MaliciousStatusCode, &maliciousFindings[i].StatusCode) { | |
sjc.current.Statuses.MaliciousStatusCode = &maliciousFindings[i].StatusCode | |
} | |
} | |
maliciousSimpleJson, err := PrepareSimpleJsonJasIssues(sjc.entitledForJas, sjc.pretty, results.ScanResultsToRuns(maliciousFindings)...) | |
if err != nil || len(maliciousSimpleJson) == 0 { | |
return | |
} |
Add this scan to the status attributes so we can use it in all other places to display the command information
@@ -114,7 +114,7 @@ require ( | |||
gopkg.in/warnings.v0 v0.1.2 // indirect | |||
) | |||
|
|||
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250126110945-81abbdde452f | |||
replace github.com/jfrog/jfrog-client-go => ../jfrog-client-go |
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.
for remote push, while developing, make sure you are pointing to a valid branch.
This is expceting the code to be in the machine locally.
if generalError = addJasScanTaskForModuleIfNeeded(params, utils.ContextualAnalysisScan, runContextualScan(params.Runner, params.Scanner, params.ScanResults, params.Module, params.DirectDependencies, params.ThirdPartyApplicabilityScan, params.ApplicableScanType, params.TargetOutputDir)); generalError != nil { | ||
return | ||
} | ||
//if generalError = addJasScanTaskForModuleIfNeeded(params, utils.ContextualAnalysisScan, runContextualScan(params.Runner, params.Scanner, params.ScanResults, params.Module, params.DirectDependencies, params.ThirdPartyApplicabilityScan, params.ApplicableScanType, params.TargetOutputDir)); generalError != nil { |
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.
don't forget to uncomment when done
dev
branch.go vet ./...
.go fmt ./...
.