Skip to content

Commit 5cfb804

Browse files
authored
Merge branch 'dev' into python-audit-params
2 parents 90572b7 + f8f9413 commit 5cfb804

27 files changed

+269
-88
lines changed

audit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515

1616
"github.com/jfrog/jfrog-cli-security/cli"
1717
"github.com/jfrog/jfrog-cli-security/cli/docs"
18+
"github.com/jfrog/jfrog-cli-security/tests/validations"
1819
"github.com/jfrog/jfrog-cli-security/utils/formats"
19-
"github.com/jfrog/jfrog-cli-security/utils/validations"
2020

2121
xrayUtils "github.com/jfrog/jfrog-client-go/xray/services/utils"
2222

commands/audit/audit_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616

1717
"github.com/stretchr/testify/assert"
1818

19+
"github.com/jfrog/jfrog-cli-security/tests/validations"
1920
"github.com/jfrog/jfrog-cli-security/utils"
2021
"github.com/jfrog/jfrog-cli-security/utils/results"
2122
"github.com/jfrog/jfrog-cli-security/utils/results/conversion"
2223
"github.com/jfrog/jfrog-cli-security/utils/techutils"
23-
"github.com/jfrog/jfrog-cli-security/utils/validations"
2424

2525
biutils "github.com/jfrog/build-info-go/utils"
2626

@@ -652,7 +652,7 @@ func TestCreateResultsContext(t *testing.T) {
652652
expectedIncludeVulnerabilitiesIfOnlyGitRepoUrlProvided := false
653653
if len(test.expectedPlatformWatches.GitRepositoryWatches) > 0 {
654654
// We should include the value of gitRepoUrl only if a watch is assigned to this git_repository
655-
testCaseExpectedGitRepoHttpsCloneUrl = validations.TestMockGitInfo.GitRepoHttpsCloneUrl
655+
testCaseExpectedGitRepoHttpsCloneUrl = validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl
656656
} else {
657657
// If only the git repo url is provided but not supported or there are no defined watches, the expected includeVulnerabilities flag should be set to true even if not provided
658658
expectedIncludeVulnerabilitiesIfOnlyGitRepoUrlProvided = true
@@ -704,13 +704,13 @@ func TestCreateResultsContext(t *testing.T) {
704704
},
705705
{
706706
name: "Git Clone Url",
707-
httpCloneUrl: validations.TestMockGitInfo.GitRepoHttpsCloneUrl,
707+
httpCloneUrl: validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl,
708708
expectedHttpCloneUrl: testCaseExpectedGitRepoHttpsCloneUrl,
709709
expectedIncludeVulnerabilities: expectedIncludeVulnerabilitiesIfOnlyGitRepoUrlProvided,
710710
},
711711
{
712712
name: "All",
713-
httpCloneUrl: validations.TestMockGitInfo.GitRepoHttpsCloneUrl,
713+
httpCloneUrl: validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl,
714714
watches: mockWatches,
715715
jfrogProjectKey: mockProjectKey,
716716
includeVulnerabilities: true,

commands/audit/sca/pnpm/pnpm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestBuildDependencyTreeLimitedDepth(t *testing.T) {
4444
name: "With transitive dependencies",
4545
treeDepth: "1",
4646
expectedUniqueDeps: []string{
47-
"npm://axios:1.8.1",
47+
"npm://axios:1.8.3",
4848
"npm://balaganjs:1.0.0",
4949
"npm://yargs:13.3.0",
5050
"npm://zen-website:1.0.0",
@@ -54,7 +54,7 @@ func TestBuildDependencyTreeLimitedDepth(t *testing.T) {
5454
Nodes: []*xrayUtils.GraphNode{
5555
{
5656
Id: "npm://balaganjs:1.0.0",
57-
Nodes: []*xrayUtils.GraphNode{{Id: "npm://axios:1.8.1"}, {Id: "npm://yargs:13.3.0"}},
57+
Nodes: []*xrayUtils.GraphNode{{Id: "npm://axios:1.8.3"}, {Id: "npm://yargs:13.3.0"}},
5858
},
5959
},
6060
},

commands/git/audit/gitaudit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func toAuditParams(params GitAuditParams) *sourceAudit.AuditParams {
8383
params.resultsContext.Watches,
8484
params.resultsContext.RepoPath,
8585
params.resultsContext.ProjectKey,
86-
params.source.GitRepoHttpsCloneUrl,
86+
params.source.Source.GitRepoHttpsCloneUrl,
8787
params.resultsContext.IncludeVulnerabilities,
8888
params.resultsContext.IncludeLicenses,
8989
false,

git_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import (
77
"github.com/stretchr/testify/assert"
88

99
"github.com/jfrog/jfrog-cli-core/v2/common/format"
10+
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
1011
"github.com/jfrog/jfrog-cli-security/commands/git/contributors"
1112
securityTests "github.com/jfrog/jfrog-cli-security/tests"
1213
securityTestUtils "github.com/jfrog/jfrog-cli-security/tests/utils"
1314
"github.com/jfrog/jfrog-cli-security/tests/utils/integration"
15+
"github.com/jfrog/jfrog-cli-security/tests/validations"
1416
securityUtils "github.com/jfrog/jfrog-cli-security/utils"
1517
"github.com/jfrog/jfrog-cli-security/utils/results"
16-
"github.com/jfrog/jfrog-cli-security/utils/validations"
1718
"github.com/jfrog/jfrog-cli-security/utils/xray/scangraph"
1819
"github.com/jfrog/jfrog-client-go/utils/tests"
1920
"github.com/jfrog/jfrog-client-go/xray/services"
@@ -87,6 +88,9 @@ func TestGitAuditSimpleJson(t *testing.T) {
8788
}
8889

8990
func TestGitAuditViolationsWithIgnoreRule(t *testing.T) {
91+
if !coreutils.IsLinux() {
92+
t.Skip("Skipping test. This test only runs on Linux to avoid flaky tests when running in parallel tests.")
93+
}
9094
xrayVersion, xscVersion, testCleanUp := integration.InitGitTest(t, services.MinXrayVersionGitRepoKey)
9195
defer testCleanUp()
9296

@@ -95,7 +99,7 @@ func TestGitAuditViolationsWithIgnoreRule(t *testing.T) {
9599
// Create policy and watch for the git repo so we will also get violations (unknown = all vulnerabilities will be reported as violations)
96100
policyName, cleanUpPolicy := securityTestUtils.CreateTestSecurityPolicy(t, "git-repo-ignore-rule-policy", utils.Unknown, true, false)
97101
defer cleanUpPolicy()
98-
watchName, cleanUpWatch := securityTestUtils.CreateWatchForTests(t, policyName, "git-repo-ignore-rule-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl))
102+
watchName, cleanUpWatch := securityTestUtils.CreateWatchForTests(t, policyName, "git-repo-ignore-rule-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl))
99103
defer cleanUpWatch()
100104

101105
// Run the audit command with git repo and verify violations are reported to the platform.
@@ -111,19 +115,19 @@ func TestGitAuditViolationsWithIgnoreRule(t *testing.T) {
111115

112116
// Create an ignore rules for the git repo
113117
cleanUpCveIgnoreRule := securityTestUtils.CreateTestIgnoreRules(t, "security cli tests - Sca ignore rule", utils.IgnoreFilters{
114-
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl)},
118+
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl)},
115119
CVEs: []string{"any"}, Licenses: []string{"any"},
116120
Watches: []string{watchName},
117121
})
118122
defer cleanUpCveIgnoreRule()
119123
cleanUpExposureIgnoreRule := securityTestUtils.CreateTestIgnoreRules(t, "security cli tests - Exposure ignore rule", utils.IgnoreFilters{
120-
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl)},
124+
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl)},
121125
Exposures: &utils.ExposuresFilterName{Categories: []utils.ExposureType{utils.SecretExposureType, utils.IacExposureType}},
122126
Watches: []string{watchName},
123127
})
124128
defer cleanUpExposureIgnoreRule()
125129
cleanSastUpIgnoreRule := securityTestUtils.CreateTestIgnoreRules(t, "security cli tests - Sast ignore rule", utils.IgnoreFilters{
126-
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl)},
130+
GitRepositories: []string{xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl)},
127131
Sast: &utils.SastFilterName{Rule: []string{"any"}},
128132
Watches: []string{watchName},
129133
})
@@ -178,7 +182,7 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
178182
cleanUpPolicy()
179183
}
180184
}()
181-
watchName, cleanUpWatch := securityTestUtils.CreateWatchForTests(t, policyName, "without-skip-not-applicable-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl))
185+
watchName, cleanUpWatch := securityTestUtils.CreateWatchForTests(t, policyName, "without-skip-not-applicable-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl))
182186
defer func() {
183187
if !firstWatchCleaned {
184188
cleanUpWatch()
@@ -207,7 +211,7 @@ func TestXrayAuditJasSkipNotApplicableCvesViolations(t *testing.T) {
207211
// Create policy and watch for the git repo so we will also get violations - This watch SKIP not-applicable results
208212
skipPolicyName, skipCleanUpPolicy := securityTestUtils.CreateTestSecurityPolicy(t, "skip-non-applicable-policy", utils.Low, false, true)
209213
defer skipCleanUpPolicy()
210-
skipWatchName, skipCleanUpWatch := securityTestUtils.CreateWatchForTests(t, skipPolicyName, "skip-not-applicable-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.GitRepoHttpsCloneUrl))
214+
skipWatchName, skipCleanUpWatch := securityTestUtils.CreateWatchForTests(t, skipPolicyName, "skip-not-applicable-watch", xscutils.GetGitRepoUrlKey(validations.TestMockGitInfo.Source.GitRepoHttpsCloneUrl))
211215
defer skipCleanUpWatch()
212216

213217
// Run the audit command with git repo and verify violations are reported to the platform and not applicable issues are skipped.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ require (
111111
gopkg.in/warnings.v0 v0.1.2 // indirect
112112
)
113113

114-
// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go dev
114+
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250309113753-9cb691a755b5
115115

116116
// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 dev
117117

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ github.com/jfrog/jfrog-cli-artifactory v0.2.0 h1:4jEbIpJIeu8HsduZHr8L6e0bKQrhn6B
132132
github.com/jfrog/jfrog-cli-artifactory v0.2.0/go.mod h1:U9gkQhxSPv6tXYEdj0kdsCrmFUjcvYmizrh+DztDxXc=
133133
github.com/jfrog/jfrog-cli-core/v2 v2.58.1 h1:ZktHuEVDBkM21JNp/0V3HGcMAMt7DLl1iQlbyBNKucE=
134134
github.com/jfrog/jfrog-cli-core/v2 v2.58.1/go.mod h1:75J6/Z5sMuRAloMAqJtMJIXqNTC1eFh/SulgLGm2fIY=
135-
github.com/jfrog/jfrog-client-go v1.51.0 h1:O9sgpgEDBW9t05brGYwNR/NMqJ/e3WZY9G8Wge2xR+Q=
136-
github.com/jfrog/jfrog-client-go v1.51.0/go.mod h1:2tQPwRhGS/F357BOKFfZrQbjd4XbzHPYUQm/OFNwLHg=
135+
github.com/jfrog/jfrog-client-go v1.28.1-0.20250309113753-9cb691a755b5 h1:Q9dVmb8sz2SXlqbtIuvIajIWFZwkp4269VXFaSqP1yM=
136+
github.com/jfrog/jfrog-client-go v1.28.1-0.20250309113753-9cb691a755b5/go.mod h1:2tQPwRhGS/F357BOKFfZrQbjd4XbzHPYUQm/OFNwLHg=
137137
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
138138
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
139139
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=

scans_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
securityTests "github.com/jfrog/jfrog-cli-security/tests"
2020
securityTestUtils "github.com/jfrog/jfrog-cli-security/tests/utils"
2121
"github.com/jfrog/jfrog-cli-security/tests/utils/integration"
22+
"github.com/jfrog/jfrog-cli-security/tests/validations"
2223
"github.com/jfrog/jfrog-cli-security/utils/formats"
2324
"github.com/jfrog/jfrog-cli-security/utils/jasutils"
24-
"github.com/jfrog/jfrog-cli-security/utils/validations"
2525

2626
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/container"
2727
containerUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container"
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ var (
3939
versionApiUrl = "/%s/%ssystem/version"
4040

4141
TestMockGitInfo = xscservices.XscGitInfoContext{
42-
GitRepoHttpsCloneUrl: "https://github.com/jfrog/dummy-repo.git",
43-
GitProvider: "github",
44-
GitRepoName: "dummy-repo",
45-
GitProject: "jfrog",
46-
BranchName: "dev",
47-
LastCommitHash: "4be861f9a585d8ae5dde0b9550669972ee05c9d7",
42+
Source: xscservices.CommitContext{
43+
GitRepoHttpsCloneUrl: "https://github.com/jfrog/dummy-repo.git",
44+
GitRepoName: "dummy-repo",
45+
GitProject: "jfrog",
46+
BranchName: "dev",
47+
CommitHash: "4be861f9a585d8ae5dde0b9550669972ee05c9d7",
48+
},
49+
GitProvider: "github",
4850
}
4951
)
5052

0 commit comments

Comments
 (0)