Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions commands/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,18 +590,14 @@ func addJasScansToRunner(auditParallelRunner *utils.SecurityParallelRunner, audi
return
}
auditParallelRunner.ResultsMu.Lock()
repoKey := utils.GetGitRepoUrlKey(auditParams.resultsContext.GitRepoHttpsCloneUrl)
if isNewFlow {
// Violations by git repo key In JAS by AM not needed in the new flow.
repoKey = ""
}
scannerOptions := []jas.JasScannerOption{
jas.WithEnvVars(
scanResults.SecretValidation,
jas.GetDiffScanTypeValue(auditParams.diffMode, auditParams.resultsToCompare),
jas.GetAnalyzerManagerXscEnvVars(
isNewFlow,
auditParams.GetMultiScanId(),
repoKey,
utils.GetGitRepoUrlKey(auditParams.resultsContext.GitRepoHttpsCloneUrl),
auditParams.resultsContext.ProjectKey,
auditParams.resultsContext.Watches,
scanResults.GetTechnologies()...,
Expand Down
7 changes: 1 addition & 6 deletions commands/maliciousscan/maliciousscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,7 @@ func (cmd *MaliciousScanCommand) createJasScanner() (*jas.JasScanner, error) {
jas.WithEnvVars(
false,
jas.NotDiffScanEnvValue,
jas.GetAnalyzerManagerXscEnvVars(
"",
"",
cmd.project,
nil,
),
jas.GetAnalyzerManagerXscEnvVars(false, "", "", cmd.project, nil),
),
jas.WithMinSeverity(cmd.minSeverityFilter),
}
Expand Down
1 change: 1 addition & 0 deletions commands/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ func (scanCmd *ScanCommand) RunBinaryJasScans(cmdType utils.CommandType, msi str
secretValidation,
jas.NotDiffScanEnvValue,
jas.GetAnalyzerManagerXscEnvVars(
false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what situations the AM_DUMMY_MODE will be true? i only see this case here where you assigned it to false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is binary scans, static-sca is not implemented there so always false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what situations the AM_DUMMY_MODE will be true?

msi,
// Passing but empty since not supported for binary scans
scanCmd.resultsContext.GitRepoHttpsCloneUrl,
Expand Down
1 change: 1 addition & 0 deletions jas/analyzermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
watchesEnvVariable = "AM_WATCHES"
projectEnvVariable = "AM_PROJECT_KEY"
gitRepoEnvVariable = "AM_GIT_REPO_VIOLATIONS"
newFlowEnvVariable = "AM_DUMMY_MODE"
notEntitledExitCode = 31
unsupportedCommandExitCode = 13
unsupportedOsExitCode = 55
Expand Down
4 changes: 2 additions & 2 deletions jas/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ func CheckForSecretValidation(xrayManager *xray.XrayServicesManager, xrayVersion
return err == nil && isEnabled
}

func GetAnalyzerManagerXscEnvVars(msi string, gitRepoUrl, projectKey string, watches []string, technologies ...techutils.Technology) map[string]string {
envVars := map[string]string{utils.JfMsiEnvVariable: msi}
func GetAnalyzerManagerXscEnvVars(newFlow bool, msi string, gitRepoUrl, projectKey string, watches []string, technologies ...techutils.Technology) map[string]string {
envVars := map[string]string{utils.JfMsiEnvVariable: msi, newFlowEnvVariable: strconv.FormatBool(newFlow)}
if gitRepoUrl != "" {
envVars[gitRepoEnvVariable] = gitRepoUrl
}
Expand Down
2 changes: 1 addition & 1 deletion jas/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func TestGetAnalyzerManagerXscEnvVars(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert.Equal(t, test.expectedOutput, GetAnalyzerManagerXscEnvVars(test.msi, test.gitRepoUrl, test.projectKey, test.watches, test.technologies...))
assert.Equal(t, test.expectedOutput, GetAnalyzerManagerXscEnvVars(false, test.msi, test.gitRepoUrl, test.projectKey, test.watches, test.technologies...))
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion jas/runner/jasrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestJasRunner(t *testing.T) {
securityParallelRunnerForTest := utils.CreateSecurityParallelRunner(cliutils.Threads)
targetResults := results.NewCommandResults(utils.SourceCode).SetEntitledForJas(true).SetSecretValidation(true).NewScanResults(results.ScanTarget{Target: "target", Technology: techutils.Pip})

jasScanner, err := jas.NewJasScanner(&jas.FakeServerDetails, jas.WithEnvVars(false, jas.NotDiffScanEnvValue, jas.GetAnalyzerManagerXscEnvVars("", "", "", []string{}, targetResults.GetTechnologies()...)))
jasScanner, err := jas.NewJasScanner(&jas.FakeServerDetails, jas.WithEnvVars(false, jas.NotDiffScanEnvValue, jas.GetAnalyzerManagerXscEnvVars(false, "", "", "", []string{}, targetResults.GetTechnologies()...)))
assert.NoError(t, err)
jasScanner.AnalyzerManager.AnalyzerManagerFullPath, err = jas.GetAnalyzerManagerExecutable()
assert.NoError(t, err)
Expand Down
Loading