Services Scan Support#772
Conversation
attiasas
left a comment
There was a problem hiding this comment.
Nice Job! see my comments.
- looks like in general the implementation should be adjusted to be aligned with other sub-scans flow
- IMO, if we decided that Secrets and Services are different and display diff, it should not have combined
Exposurelogic in the code as well... - You are missing integration tests at
audit_test.go(orgit_test.go) for project that has at least oneServices Scanissue detected - Make sure you are aligned with
devbranch changes
| Watches: components.NewStringFlag(Watches, "Comma-separated list of Xray watches to determine violations. Supported violations are CVEs, operational risk, and Licenses. Incompatible with --project and --repo-path."), | ||
| RepoPath: components.NewStringFlag(RepoPath, "Artifactory repository path, to enable Xray to determine violations accordingly. The command accepts this option only if the --project and --watches options are not provided. If none of the three options are provided, the command will show all known vulnerabilities."), | ||
| Snippet: components.NewBoolFlag(Snippet, "Set to true if you'd like to enables snippet-level detection to identify copied code from third-party components and surface related license violations.", components.SetHiddenBoolFlag()), | ||
| Services: components.NewBoolFlag(Services, "Set to true to enable services detection.", components.SetHiddenBoolFlag()), |
There was a problem hiding this comment.
Do we want this to be similar to --sbom/--license/--snippet flags? or grouped with --secrets/--sca/--iac... kind of flags?.
right now seems similar to the first group but PR shows like the other type...
make sure description is approbed by tech writer, see similar flags for template
| func validateServicesDetection(c *components.Context) (bool, error) { | ||
| return isServicesDetectionEnabled(c), nil | ||
| } |
There was a problem hiding this comment.
do we need this func? don't see the point here
| if err != nil { | ||
| return "", "", nil, nil, err | ||
| } | ||
| includeServicesDetection, err := validateServicesDetection(c) |
There was a problem hiding this comment.
should be adjusted/set with getSubScansToPreform
| if err != nil { | ||
| return err | ||
| } | ||
| includeServicesDetection, err := validateServicesDetection(c) |
There was a problem hiding this comment.
should be adjusted/set with getSubScansToPreform
| func isServicesDetectionEnabled(c *components.Context) bool { | ||
| if !c.IsFlagSet(flags.Services) { | ||
| return false | ||
| } | ||
| return c.GetBoolFlagValue(flags.Services) | ||
| } |
There was a problem hiding this comment.
This is a flag for the scanner that produced issues, should be set/fetch value in getSubScansToPreform
| Location | ||
| Finding string `json:"finding,omitempty"` | ||
| Fingerprint string `json:"fingerprint,omitempty"` | ||
| Outcomes string `json:"outcomes,omitempty"` |
There was a problem hiding this comment.
make sure about this attribute...
| // Properties for secret validation | ||
| secretValidationPropertyTemplate = "jfrog:secret-validation:status:" + results.LocationIdTemplate | ||
| secretValidationMetadataPropertyTemplate = "jfrog:secret-validation:metadata:" + results.LocationIdTemplate | ||
| servicesOutcomesPropertyTemplate = "jfrog:services:outcomes:" + results.LocationIdTemplate |
There was a problem hiding this comment.
why do we need this? outcome has locations?... please validate
| if len(runs) == 0 { | ||
| return | ||
| } |
There was a problem hiding this comment.
| if len(runs) == 0 { | |
| return | |
| } |
not needed
| type ServicesScanManager struct { | ||
| scanner *jas.JasScanner | ||
|
|
||
| resultsToCompareFileName string | ||
| configFileName string | ||
| resultsFileName string | ||
| } |
There was a problem hiding this comment.
Adjust the file to have 2 ways to run (similar to the other scanners)
- Deprecated with apps config module
- New with scantarget (and config profile)
see sastscanner.go for more details:
func (sastScanManager *SastScanManager) runSastScan(params SastScanParams) (vulnerabilitiesResults []*sarif.Run, violationsResults []*sarif.Run, err error) {
if params.Target.DeprecatedAppsConfigModule == nil {
return sastScanManager.scanner.Run(sastScanManager, params.Target)
}
return sastScanManager.scanner.DeprecatedRun(sastScanManager, *params.Target.DeprecatedAppsConfigModule, params.Target.GetCentralConfigExclusions(utils.SastScan))
}
| log.Debug("Diff mode - Services results to compare provided") | ||
| manager.resultsToCompareFileName = filepath.Join(scannerTempDir, "target.sarif") | ||
| if err = jas.SaveScanResultsToCompareAsReport(manager.resultsToCompareFileName, resultsToCompare...); err != nil { | ||
| return | ||
| } |
There was a problem hiding this comment.
Make sure Diff logic is implemented in the AM (so Frogbot Scan PR can show only added issues for services).
devbranch.go vet ./....go fmt ./....depends on: