Skip to content

Commit 6ea4636

Browse files
authored
Update dependencies and tests for new config profile (#624)
1 parent d170e3e commit 6ea4636

File tree

6 files changed

+67
-78
lines changed

6 files changed

+67
-78
lines changed

commands/audit/audit_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
261261
},
262262
},
263263
}},
264-
IsDefault: false,
265264
},
266265
expectedScaIssues: 15,
267266
},
@@ -293,7 +292,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
293292
},
294293
},
295294
}},
296-
IsDefault: false,
297295
},
298296
expectedScaIssues: 0,
299297
},
@@ -324,7 +322,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
324322
},
325323
},
326324
}},
327-
IsDefault: false,
328325
},
329326
expectedCaNotCovered: 15,
330327
},
@@ -356,7 +353,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
356353
},
357354
},
358355
}},
359-
IsDefault: false,
360356
},
361357
expectedSecretsIssues: 16,
362358
},
@@ -388,7 +384,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
388384
},
389385
},
390386
}},
391-
IsDefault: false,
392387
},
393388
expectedSecretsIssues: 7,
394389
},
@@ -419,7 +414,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
419414
},
420415
},
421416
}},
422-
IsDefault: false,
423417
},
424418
expectedSastIssues: 4,
425419
},
@@ -451,7 +445,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
451445
},
452446
},
453447
}},
454-
IsDefault: false,
455448
},
456449
expectedSastIssues: 0,
457450
},
@@ -482,7 +475,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
482475
},
483476
},
484477
}},
485-
IsDefault: false,
486478
},
487479
expectedIacIssues: 9,
488480
},
@@ -514,7 +506,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
514506
},
515507
},
516508
}},
517-
IsDefault: false,
518509
},
519510
expectedIacIssues: 0,
520511
},
@@ -545,7 +536,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
545536
},
546537
},
547538
}},
548-
IsDefault: false,
549539
},
550540
expectedSastIssues: 4,
551541
expectedSecretsIssues: 16,
@@ -581,7 +571,6 @@ func TestAuditWithConfigProfile(t *testing.T) {
581571
},
582572
},
583573
}},
584-
IsDefault: false,
585574
},
586575
expectedSastIssues: 0,
587576
expectedSecretsIssues: 7,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/jfrog/jfrog-apps-config v1.0.1
1818
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251211075913-35ebcd308e93
1919
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251210085744-f8481d179ac5
20-
github.com/jfrog/jfrog-client-go v1.55.1-0.20251211124639-306f15dbcf29
20+
github.com/jfrog/jfrog-client-go v1.55.1-0.20251217080430-c92b763b7465
2121
github.com/magiconair/properties v1.8.10
2222
github.com/owenrumney/go-sarif/v3 v3.2.3
2323
github.com/package-url/packageurl-go v0.1.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251211075913-35ebcd308e93 h1:r
158158
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251211075913-35ebcd308e93/go.mod h1:7cCaRhXorlbyXZgiW5bplCExFxlnROaG21K12d8inpQ=
159159
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251210085744-f8481d179ac5 h1:GYE67ubwl+ZRw3CcXFUi49EwwQp6k+qS8sX0QuHDHO8=
160160
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251210085744-f8481d179ac5/go.mod h1:BMoGi2rG0udCCeaghqlNgiW3fTmT+TNnfTnBoWFYgcg=
161-
github.com/jfrog/jfrog-client-go v1.55.1-0.20251211124639-306f15dbcf29 h1:u+FMai2cImOJExJ1Ehe8JsrpAXmPyRaDXwM60wV3bPA=
162-
github.com/jfrog/jfrog-client-go v1.55.1-0.20251211124639-306f15dbcf29/go.mod h1:WQ5Y+oKYyHFAlCbHN925bWhnShTd2ruxZ6YTpb76fpU=
161+
github.com/jfrog/jfrog-client-go v1.55.1-0.20251217080430-c92b763b7465 h1:Ff3BlNPndrAfa1xFI/ORFzfWTxQxF0buWG61PEJwd3U=
162+
github.com/jfrog/jfrog-client-go v1.55.1-0.20251217080430-c92b763b7465/go.mod h1:WQ5Y+oKYyHFAlCbHN925bWhnShTd2ruxZ6YTpb76fpU=
163163
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
164164
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
165165
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=

sca/bom/buildinfo/technologies/common_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ func TestGetExcludePattern(t *testing.T) {
6262
},
6363
},
6464
},
65-
IsDefault: false,
66-
IsBasicProfile: false,
6765
},
6866
expected: "(^exclude1$)|(^exclude2$)|(^exclude3$)",
6967
},
Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,27 @@
11
{
22
"profile_name": "default-profile",
33
"general_config": {
4-
"releases_repo": "https://repo.example.com/releases",
5-
"analyzer_manager_version": "1.2.3",
6-
"report_analytics": true,
7-
"exclude_patterns": ["*.log*", "*.tmp*"],
8-
"results_output_dir": "/path/to/results",
9-
"allow_partial_results": false
4+
"scanners_download_path": "https://repo.example.com/releases",
5+
"general_exclude_patterns": ["*.log*", "*.tmp*"],
6+
"fail_upon_any_scanner_error": true
107
},
118
"frogbot_config": {
12-
"email_author": "[email protected]",
139
"aggregate_fixes": true,
14-
"avoid_previous_pr_comments_deletion": true,
15-
"avoid_extra_messages": true,
16-
"add_success_comment": true,
10+
"hide_success_banner_for_no_issues": false,
1711
"branch_name_template": "frogbot-${IMPACTED_PACKAGE}-${BRANCH_NAME_HASH}",
1812
"pr_title_template": "[🐸 Frogbot] Upgrade {IMPACTED_PACKAGE} to {FIX_VERSION}",
19-
"pr_comment_title": "Frogbot notes:",
2013
"commit_message_template": "Upgrade {IMPACTED_PACKAGE} to {FIX_VERSION}",
2114
"show_secrets_as_pr_comment": false,
22-
"skip_auto_fix": false,
23-
"include_all_repository_vulnerabilities": true
15+
"create_auto_fix_pr": true,
16+
"include_vulnerabilities_and_violations": false
2417
},
2518
"modules": [
2619
{
2720
"module_name": "default-module",
2821
"path_from_root": ".",
29-
"exclude_patterns": ["**/.git/**", "**/*test*/**", "**/*venv*/**", "**/*node_modules*/**", "**/target/**"],
3022
"scan_config": {
3123
"sca_scanner_config": {
3224
"enable_sca_scan": true,
33-
"technology": "Java",
34-
"package_managers_settings": {
35-
"gradle_settings": {
36-
"exclude_test_deps": false,
37-
"use_wrapper": true
38-
},
39-
"maven_settings": {
40-
"use_wrapper": true
41-
},
42-
"npm_settings": {
43-
"dep_type": "all",
44-
"pnpm_max_tree_depth": 9
45-
},
46-
"python_settings": {
47-
"requirements_file": "requirements.txt"
48-
}
49-
},
50-
"skip_auto_install": true,
5125
"exclude_patterns": ["**/build/**"]
5226
},
5327
"contextual_analysis_scanner_config": {
@@ -56,26 +30,20 @@
5630
},
5731
"sast_scanner_config": {
5832
"enable_sast_scan": true,
59-
"language": "Java",
60-
"include_patterns": ["*.go"],
6133
"exclude_patterns": ["**/_test.go/**"],
6234
"exclude_rules": ["xss-injection"]
6335
},
6436
"secrets_scanner_config": {
6537
"enable_secrets_scan": true,
6638
"validate_secrets": true,
67-
"include_patterns": ["*.go"],
68-
"exclude_patterns": ["**/_test.go/**"]
39+
"exclude_patterns": ["**/_test.go/**"],
40+
"enable_custom_secrets": true
6941
},
7042
"iac_scanner_config": {
7143
"enable_iac_scan": true,
72-
"include_patterns": ["*.tf"],
7344
"exclude_patterns": ["*.tfstate"]
7445
}
75-
},
76-
"deps_repo": "https://deps.example.com"
46+
}
7747
}
78-
],
79-
"is_default": true,
80-
"is_basic_profile": false
48+
]
8149
}

utils/xsc/configprofile_test.go

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package xsc
22

33
import (
4-
"encoding/json"
5-
"os"
64
"testing"
75

86
"github.com/jfrog/jfrog-cli-security/tests/validations"
@@ -44,15 +42,7 @@ func TestGetConfigProfileByName(t *testing.T) {
4442
}
4543
// Validate results
4644
assert.NoError(t, err)
47-
48-
profileFileContent, err := os.ReadFile("../../tests/testdata/other/configProfile/configProfileExample.json")
49-
assert.NoError(t, err)
50-
51-
var configProfileForComparison services.ConfigProfile
52-
err = json.Unmarshal(profileFileContent, &configProfileForComparison)
53-
assert.NoError(t, err)
54-
55-
assert.Equal(t, &configProfileForComparison, configProfile)
45+
assert.Equal(t, getComparisonConfigProfile(), configProfile)
5646
})
5747
}
5848
}
@@ -87,15 +77,59 @@ func TestGetConfigProfileByUrl(t *testing.T) {
8777
}
8878
// Validate results
8979
assert.NoError(t, err)
90-
91-
profileFileContent, err := os.ReadFile("../../tests/testdata/other/configProfile/configProfileExample.json")
92-
assert.NoError(t, err)
93-
94-
var configProfileForComparison services.ConfigProfile
95-
err = json.Unmarshal(profileFileContent, &configProfileForComparison)
96-
assert.NoError(t, err)
97-
98-
assert.Equal(t, &configProfileForComparison, configProfile)
80+
assert.Equal(t, getComparisonConfigProfile(), configProfile)
9981
})
10082
}
10183
}
84+
85+
func getComparisonConfigProfile() *services.ConfigProfile {
86+
return &services.ConfigProfile{
87+
ProfileName: "default-profile",
88+
GeneralConfig: services.GeneralConfig{
89+
ScannersDownloadPath: "https://repo.example.com/releases",
90+
GeneralExcludePatterns: []string{"*.log*", "*.tmp*"},
91+
FailUponAnyScannerError: true,
92+
},
93+
FrogbotConfig: services.FrogbotConfig{
94+
AggregateFixes: true,
95+
HideSuccessBannerForNoIssues: false,
96+
BranchNameTemplate: "frogbot-${IMPACTED_PACKAGE}-${BRANCH_NAME_HASH}",
97+
PrTitleTemplate: "[🐸 Frogbot] Upgrade {IMPACTED_PACKAGE} to {FIX_VERSION}",
98+
CommitMessageTemplate: "Upgrade {IMPACTED_PACKAGE} to {FIX_VERSION}",
99+
ShowSecretsAsPrComment: false,
100+
CreateAutoFixPr: true,
101+
IncludeVulnerabilitiesAndViolations: false,
102+
},
103+
Modules: []services.Module{
104+
{
105+
ModuleName: "default-module",
106+
PathFromRoot: ".",
107+
ScanConfig: services.ScanConfig{
108+
ScaScannerConfig: services.ScaScannerConfig{
109+
EnableScaScan: true,
110+
ExcludePatterns: []string{"**/build/**"},
111+
},
112+
ContextualAnalysisScannerConfig: services.CaScannerConfig{
113+
EnableCaScan: true,
114+
ExcludePatterns: []string{"**/docs/**"},
115+
},
116+
SastScannerConfig: services.SastScannerConfig{
117+
EnableSastScan: true,
118+
ExcludePatterns: []string{"**/_test.go/**"},
119+
ExcludeRules: []string{"xss-injection"},
120+
},
121+
SecretsScannerConfig: services.SecretsScannerConfig{
122+
EnableSecretsScan: true,
123+
ValidateSecrets: true,
124+
ExcludePatterns: []string{"**/_test.go/**"},
125+
EnableCustomSecrets: true,
126+
},
127+
IacScannerConfig: services.IacScannerConfig{
128+
EnableIacScan: true,
129+
ExcludePatterns: []string{"*.tfstate"},
130+
},
131+
},
132+
},
133+
},
134+
}
135+
}

0 commit comments

Comments
 (0)