jas

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ApplicabilityFeatureId = "contextual_analysis"
	AnalyzerManagerZipName = "analyzerManager.zip"

	ErrFailedScannerRun = "failed to run %s scan. Exit code received: %s"

	JfPackageManagerEnvVariable = "AM_PACKAGE_MANAGER"
	JfLanguageEnvVariable       = "AM_LANGUAGE"
	// #nosec G101 -- Not credentials.
	JfSecretValidationEnvVariable = "JF_VALIDATE_SECRETS"
)
View Source
const (
	NoServerUrlError     = "" /* 191-byte string literal not displayed */
	NoServerDetailsError = "jfrog Server details are missing"
)

Variables

View Source
var FakeBasicXrayResults = []services.ScanResponse{
	{
		ScanId: "scanId_1",
		Vulnerabilities: []services.Vulnerability{
			{IssueId: "issueId_1", Technology: techutils.Pipenv.String(),
				Cves:       []services.Cve{{Id: "testCve1"}, {Id: "testCve2"}, {Id: "testCve3"}},
				Components: map[string]services.Component{"issueId_1_direct_dependency": {}, "issueId_3_direct_dependency": {}}},
		},
		Violations: []services.Violation{
			{IssueId: "issueId_2", Technology: techutils.Pipenv.String(),
				Cves:       []services.Cve{{Id: "testCve4"}, {Id: "testCve5"}},
				Components: map[string]services.Component{"issueId_2_direct_dependency": {}, "issueId_4_direct_dependency": {}}},
		},
	},
}
View Source
var FakeServerDetails = config.ServerDetails{
	Url:      "platformUrl",
	Password: "password",
	User:     "user",
}

Functions

func CheckForSecretValidation added in v1.10.0

func CheckForSecretValidation(xrayManager *xray.XrayServicesManager, xrayVersion string, validateSecrets bool) bool

func CreateJFrogAppsConfig added in v1.4.0

func CreateJFrogAppsConfig(workingDirs []string) (*jfrogappsconfig.JFrogAppsConfig, error)

func CreateScannerTempDirectory added in v1.4.0

func CreateScannerTempDirectory(scanner *JasScanner, scanType string) (string, error)

func CreateScannersConfigFile

func CreateScannersConfigFile(fileName string, fileContent interface{}, scanType jasutils.JasScanType) error

func DownloadAnalyzerManagerIfNeeded added in v1.5.0

func DownloadAnalyzerManagerIfNeeded(threadId int) error

Download the latest AnalyzerManager executable if not cached locally. By default, the zip is downloaded directly from jfrog releases.

func GetAnalyzerManagerDirAbsolutePath added in v1.5.0

func GetAnalyzerManagerDirAbsolutePath() (string, error)

func GetAnalyzerManagerDownloadPath added in v1.5.0

func GetAnalyzerManagerDownloadPath() (string, error)

func GetAnalyzerManagerEnvVariables added in v1.5.0

func GetAnalyzerManagerEnvVariables(serverDetails *config.ServerDetails) (envVars map[string]string, err error)

func GetAnalyzerManagerExecutable added in v1.5.0

func GetAnalyzerManagerExecutable() (analyzerManagerPath string, err error)

func GetAnalyzerManagerExecutableName added in v1.5.0

func GetAnalyzerManagerExecutableName() string

func GetAnalyzerManagerVersion added in v1.5.0

func GetAnalyzerManagerVersion() string

func GetAnalyzerManagerXscEnvVars added in v1.5.0

func GetAnalyzerManagerXscEnvVars(msi string, validateSecrets bool, technologies ...techutils.Technology) map[string]string

func GetExcludePatterns

func GetExcludePatterns(module jfrogappsconfig.Module, scanner *jfrogappsconfig.Scanner, exclusions ...string) []string

func GetSourceRoots

func GetSourceRoots(module jfrogappsconfig.Module, scanner *jfrogappsconfig.Scanner) ([]string, error)

func GetTestDataPath

func GetTestDataPath() string

func IsEntitledForJas

func IsEntitledForJas(xrayManager *xray.XrayServicesManager, xrayVersion string) (entitled bool, err error)

func ParseAnalyzerManagerError added in v1.5.0

func ParseAnalyzerManagerError(scanner jasutils.JasScanType, err error) (formatErr error)

func ReadJasScanRunsFromFile

func ReadJasScanRunsFromFile(fileName, wd, informationUrlSuffix string, minSeverity severityutils.Severity) (sarifRuns []*sarif.Run, err error)

func ShouldSkipScanner

func ShouldSkipScanner(module jfrogappsconfig.Module, scanType jasutils.JasScanType) bool

Types

type AnalyzerManager added in v1.5.0

type AnalyzerManager struct {
	AnalyzerManagerFullPath string
	MultiScanId             string
}

func (*AnalyzerManager) Exec added in v1.5.0

func (am *AnalyzerManager) Exec(configFile, scanCommand, workingDir string, serverDetails *config.ServerDetails, envVars map[string]string) (err error)

func (*AnalyzerManager) ExecWithOutputFile added in v1.5.0

func (am *AnalyzerManager) ExecWithOutputFile(configFile, scanCommand, workingDir, outputFile string, serverDetails *config.ServerDetails, envVars map[string]string) (err error)

type JasScanner

type JasScanner struct {
	TempDir               string
	AnalyzerManager       AnalyzerManager
	ServerDetails         *config.ServerDetails
	JFrogAppsConfig       *jfrogappsconfig.JFrogAppsConfig
	ScannerDirCleanupFunc func() error
	EnvVars               map[string]string
	Exclusions            []string
	MinSeverity           severityutils.Severity
}

func CreateJasScanner added in v1.4.0

func CreateJasScanner(jfrogAppsConfig *jfrogappsconfig.JFrogAppsConfig, serverDetails *config.ServerDetails, minSeverity severityutils.Severity, envVars map[string]string, exclusions ...string) (scanner *JasScanner, err error)

func InitJasTest

func InitJasTest(t *testing.T, workingDirs ...string) (*JasScanner, func())

func (*JasScanner) Run

func (a *JasScanner) Run(scannerCmd ScannerCmd, module jfrogappsconfig.Module) (err error)

type ScannerCmd

type ScannerCmd interface {
	Run(module jfrogappsconfig.Module) (err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL