forked from jfrog/jfrog-cli-security
-
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.
Docker scan JAS support, dumb copy with broken imports jfrog#4
- Loading branch information
1 parent
d44be67
commit 3a1caf5
Showing
9 changed files
with
173 additions
and
50 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
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,45 @@ | ||
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/log" | ||
) | ||
|
||
func runJasScannersAndSetResults(scanResults *utils.Results, cveList []string, | ||
serverDetails *config.ServerDetails, workingDirs []string) (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 | ||
} | ||
multiScanId := "" // Also empty for audit | ||
scanner, err := jas.NewJasScanner(workingDirs, serverDetails, multiScanId) | ||
if err != nil { | ||
return | ||
} | ||
|
||
defer func() { | ||
cleanup := scanner.ScannerDirCleanupFunc | ||
err = errors.Join(err, cleanup()) | ||
}() | ||
|
||
scanResults.ExtendedScanResults.ApplicabilityScanResults, err = applicability.RunApplicabilityWithScanCves(scanResults.GetScaScansXrayResults(), cveList, scanResults.GetScaScannedTechnologies(), scanner) | ||
if err != nil { | ||
fmt.Println("there was an error:", err) | ||
return | ||
} | ||
|
||
scanResults.ExtendedScanResults.SecretsScanResults, err = secrets.RunSecretsScan(scanner, secrets.SecretsScannerDockerScanType) | ||
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
Oops, something went wrong.