forked from jfrog/jfrog-cli-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for JAS docker scan support jfrog#1035
- Loading branch information
1 parent
84d80fb
commit ae08a93
Showing
5 changed files
with
147 additions
and
14 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package scan | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/jfrog/jfrog-cli-core/v2/utils/config" | ||
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/audit/jas" | ||
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/audit/jas/applicability" | ||
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/audit/jas/secrets" | ||
|
||
"github.com/jfrog/jfrog-cli-core/v2/xray/utils" | ||
"github.com/jfrog/jfrog-client-go/utils/io" | ||
"github.com/jfrog/jfrog-client-go/utils/log" | ||
) | ||
|
||
func runJasScannersAndSetResults(scanResults *utils.Results, cveList []string, | ||
serverDetails *config.ServerDetails, workingDirs []string, progress io.ProgressMgr, multiScanId string, thirdPartyApplicabilityScan bool) (err error) { | ||
|
||
if serverDetails == nil || len(serverDetails.Url) == 0 { | ||
log.Warn("To include 'Advanced Security' scan as part of the audit output, please run the 'jf c add' command before running this command.") | ||
return | ||
} | ||
|
||
scanner, err := jas.NewJasScanner(workingDirs, serverDetails, multiScanId) | ||
if err != nil { | ||
return | ||
} | ||
|
||
defer func() { | ||
cleanup := scanner.ScannerDirCleanupFunc | ||
err = errors.Join(err, cleanup()) | ||
}() | ||
|
||
// if progress != nil { | ||
// progress.SetHeadlineMsg("Running applicability scanning") | ||
// } | ||
|
||
scanResults.ExtendedScanResults.ApplicabilityScanResults, err = applicability.RunApplicabilityWithScanCves(scanResults.GetScaScansXrayResults(), cveList, scanResults.GetScaScannedTechnologies(), scanner, thirdPartyApplicabilityScan) | ||
if err != nil { | ||
fmt.Println("there was an error:", err) | ||
return | ||
} | ||
|
||
// if progress != nil { | ||
// progress.SetHeadlineMsg("Running secrets scanning") | ||
// } | ||
scanResults.ExtendedScanResults.SecretsScanResults, err = secrets.RunSecretsScan(scanner, secrets.SecretsScannerDockerType) | ||
if err != nil { | ||
return | ||
} | ||
return | ||
} |
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