Skip to content

Commit b8db994

Browse files
committed
am 110 + fix xray-url cred and test jas-scanner
1 parent 63c7e1d commit b8db994

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

audit_test.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/jfrog/jfrog-cli-security/utils/formats"
1818
"github.com/jfrog/jfrog-cli-security/utils/validations"
1919

20+
testsUtils "github.com/jfrog/jfrog-cli-security/tests/utils"
2021
xrayUtils "github.com/jfrog/jfrog-client-go/xray/services/utils"
2122

2223
"github.com/stretchr/testify/assert"
@@ -753,8 +754,7 @@ func TestXrayAuditNotEntitledForJasWithXrayUrl(t *testing.T) {
753754
}
754755

755756
func TestXrayAuditJasSimpleJsonWithXrayUrl(t *testing.T) {
756-
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, true, getRealAuditCommand)
757-
defer cleanUp()
757+
cliToRun := testsUtils.GetTestCli(cli.GetJfrogCliSecurityApp(), true)
758758
output := testXrayAuditJas(t, cliToRun, filepath.Join("jas", "jas"), "3", false, false)
759759
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{
760760
Sast: 1,
@@ -768,20 +768,3 @@ func TestXrayAuditJasSimpleJsonWithXrayUrl(t *testing.T) {
768768
NotApplicable: 2,
769769
})
770770
}
771-
772-
func getRealAuditCommand() components.Command {
773-
return components.Command{
774-
Name: docs.Audit,
775-
Flags: docs.GetCommandFlags(docs.Audit),
776-
Category: "Security",
777-
Action: cli.AuditCmd,
778-
}
779-
}
780-
781-
//func getRealAuditCommand() []components.Command {
782-
// var cmds []components.Command
783-
// for i := range cli.GetJfrogCliSecurityApp().Subcommands {
784-
// cmds = append(cmds, cli.GetJfrogCliSecurityApp().Subcommands[i].Commands...)
785-
// }
786-
// return cmds
787-
//}

jas/analyzermanager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
ApplicabilityFeatureId = "contextual_analysis"
2626
AnalyzerManagerZipName = "analyzerManager.zip"
27-
defaultAnalyzerManagerVersion = "1.9.9"
27+
defaultAnalyzerManagerVersion = "1.10.0"
2828
analyzerManagerDownloadPath = "xsc-gen-exe-analyzer-manager-local/v1"
2929
analyzerManagerDirName = "analyzerManager"
3030
analyzerManagerExecutableName = "analyzerManager"

jas/common.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ func CreateJasScanner(serverDetails *config.ServerDetails, validateSecrets bool,
5555
if len(serverDetails.XrayUrl) != 0 {
5656
log.Debug("Xray URL provided without platform URL")
5757
} else {
58+
if len(serverDetails.ArtifactoryUrl) != 0 {
59+
log.Debug("Artifactory URL provided without platform URL")
60+
}
5861
log.Warn(NoServerUrlWarn)
62+
return
5963
}
60-
if len(serverDetails.ArtifactoryUrl) != 0 {
61-
log.Debug("Artifactory URL provided without platform URL")
62-
}
63-
return
6464
}
6565
scanner = &JasScanner{}
6666
if scanner.EnvVars, err = getJasEnvVars(serverDetails, validateSecrets, envVars); err != nil {

tests/utils/test_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ func GetTestCli(testApplication components.App, xrayUrlOnly bool) (testCli *core
6161

6262
func authenticateXray(xrayUrlOnly bool) string {
6363
*configTests.JfrogUrl = clientUtils.AddTrailingSlashIfNeeded(*configTests.JfrogUrl)
64+
cred := fmt.Sprintf("--url=%s", *configTests.JfrogUrl)
6465
if xrayUrlOnly {
66+
cred = fmt.Sprintf("--xray-url=%s", configTests.XrDetails.XrayUrl)
6567
configTests.XrDetails = &config.ServerDetails{XrayUrl: *configTests.JfrogUrl + configTests.XrayEndpoint}
6668
} else {
6769
configTests.XrDetails = &config.ServerDetails{Url: *configTests.JfrogUrl, ArtifactoryUrl: *configTests.JfrogUrl + configTests.ArtifactoryEndpoint, XrayUrl: *configTests.JfrogUrl + configTests.XrayEndpoint}
6870
}
69-
cred := fmt.Sprintf("--url=%s", configTests.XrDetails.XrayUrl)
7071
if *configTests.JfrogAccessToken != "" {
7172
configTests.XrDetails.AccessToken = *configTests.JfrogAccessToken
7273
cred += fmt.Sprintf(" --access-token=%s", configTests.XrDetails.AccessToken)

0 commit comments

Comments
 (0)