Skip to content

Commit 1df6b83

Browse files
Merge branch 'main' into bug/alex-fix-sca-configurations
2 parents 9b56043 + f2b3f70 commit 1df6b83

21 files changed

Lines changed: 230 additions & 217 deletions

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
run: go build -o ./bin/cx ./cmd
4646
- name: Install gocovmerge
4747
run: go install github.com/wadey/gocovmerge@latest
48+
- name: Install pre-commit
49+
run: |
50+
pip install pre-commit
51+
pre-commit install
4852
- name: Go Integration test
4953
shell: bash
5054
env:

.github/workflows/issue_automation.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@ name: Issue automation
22

33
on:
44
issues:
5-
types: [opened]
5+
types: [opened, closed]
66

77
jobs:
88
notify_jira:
9+
if: github.event.action == 'opened'
910
name: Notify Jira
1011
uses: Checkmarx/plugins-release-workflow/.github/workflows/jira_notify.yml@main
1112
with:
1213
title: ${{ github.event.issue.title }}
1314
body: ${{ github.event.issue.body }}
1415
html_url: ${{ github.event.issue.html_url }}
1516
repo: ${{ github.event.repository.full_name }}
16-
secrets: inherit
17+
secrets: inherit
18+
19+
close_jira:
20+
if: github.event.action == 'closed'
21+
name: Close Jira
22+
uses: Checkmarx/plugins-release-workflow/.github/workflows/jira_close.yml@main
23+
with:
24+
issue_number: ${{ github.event.issue.number }}
25+
repo: ${{ github.event.repository.full_name }}
26+
secrets: inherit

.github/workflows/jira_notify.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/manual-integration-test.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func main() {
8585
scaRealTimeWrapper := wrappers.NewHTTPScaRealTimeWrapper()
8686
chatWrapper := wrappers.NewChatWrapper()
8787
featureFlagsWrapper := wrappers.NewFeatureFlagsHTTPWrapper(featureFlagsPath)
88-
policyWrapper := wrappers.NewHTTPPolicyWrapper(policyEvaluationPath)
88+
policyWrapper := wrappers.NewHTTPPolicyWrapper(policyEvaluationPath, featureFlagsWrapper)
8989
sastMetadataWrapper := wrappers.NewSastIncrementalHTTPWrapper(sastMetadataPath)
9090
accessManagementWrapper := wrappers.NewAccessManagementHTTPWrapper(accessManagementPath)
9191
byorWrapper := wrappers.NewByorHTTPWrapper(byorPath)

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/Checkmarx/containers-resolver v1.0.6-0.20250130184119-42af4015f216
77
github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63
88
github.com/Checkmarx/gen-ai-wrapper v1.0.2
9-
github.com/Checkmarx/secret-detection v0.0.3-0.20250227154803-c62fe8ce1523
9+
github.com/Checkmarx/secret-detection v0.0.3-0.20250327150305-31c2c3be9edf
1010
github.com/MakeNowJust/heredoc v1.0.0
1111
github.com/bouk/monkey v1.0.0
1212
github.com/gofrs/flock v0.12.1
@@ -28,6 +28,7 @@ require (
2828
golang.org/x/text v0.22.0
2929
google.golang.org/grpc v1.67.3
3030
google.golang.org/protobuf v1.36.3
31+
gopkg.in/yaml.v2 v2.4.0
3132
gopkg.in/yaml.v3 v3.0.1
3233
gotest.tools v2.2.0+incompatible
3334
)
@@ -82,7 +83,7 @@ require (
8283
github.com/chai2010/gettext-go v1.0.3 // indirect
8384
github.com/charmbracelet/lipgloss v1.0.0 // indirect
8485
github.com/charmbracelet/x/ansi v0.4.5 // indirect
85-
github.com/checkmarx/2ms v1.4.1-0.20250227102300-e162a8629579 // indirect
86+
github.com/checkmarx/2ms v1.4.1-0.20250327145719-b78804cb08c7 // indirect
8687
github.com/cloudflare/circl v1.3.8 // indirect
8788
github.com/containerd/cgroups/v3 v3.0.3 // indirect
8889
github.com/containerd/containerd v1.7.24 // indirect
@@ -285,7 +286,6 @@ require (
285286
gopkg.in/inf.v0 v0.9.1 // indirect
286287
gopkg.in/ini.v1 v1.67.0 // indirect
287288
gopkg.in/warnings.v0 v0.1.2 // indirect
288-
gopkg.in/yaml.v2 v2.4.0 // indirect
289289
helm.sh/helm/v3 v3.17.0 // indirect
290290
k8s.io/api v0.32.0 // indirect
291291
k8s.io/apiextensions-apiserver v0.32.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63 h1:SCuTcE
7575
github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63/go.mod h1:MI6lfLerXU+5eTV/EPTDavgnV3owz3GPT4g/msZBWPo=
7676
github.com/Checkmarx/gen-ai-wrapper v1.0.2 h1:T6X40+4hYnwfDsvkjWs9VIcE6s1O+8DUu0+sDdCY3GI=
7777
github.com/Checkmarx/gen-ai-wrapper v1.0.2/go.mod h1:xwRLefezwNNnRGu1EjGS6wNiR9FVV/eP9D+oXwLViVM=
78-
github.com/Checkmarx/secret-detection v0.0.3-0.20250227154803-c62fe8ce1523 h1:F2aOPKbcCZPZBxfsJ1c7pNK0rjA8P9wPxBZ48YnZuw0=
79-
github.com/Checkmarx/secret-detection v0.0.3-0.20250227154803-c62fe8ce1523/go.mod h1:lLVCf7AT8v2LV+up7yIcj8aValbOSIJ+f453015/1P4=
78+
github.com/Checkmarx/secret-detection v0.0.3-0.20250327150305-31c2c3be9edf h1:lKiogedU3WzWBc/xI6Xj1BhX2Gp1QBJj8C+czY7CcaE=
79+
github.com/Checkmarx/secret-detection v0.0.3-0.20250327150305-31c2c3be9edf/go.mod h1:mtAHOm1mHGh7MVu6JdYUyitANsLcHNLUTBIh9pTERNI=
8080
github.com/CycloneDX/cyclonedx-go v0.9.2 h1:688QHn2X/5nRezKe2ueIVCt+NRqf7fl3AVQk+vaFcIo=
8181
github.com/CycloneDX/cyclonedx-go v0.9.2/go.mod h1:vcK6pKgO1WanCdd61qx4bFnSsDJQ6SbM2ZuMIgq86Jg=
8282
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
@@ -216,8 +216,8 @@ github.com/charmbracelet/x/ansi v0.4.5 h1:LqK4vwBNaXw2AyGIICa5/29Sbdq58GbGdFngSe
216216
github.com/charmbracelet/x/ansi v0.4.5/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
217217
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
218218
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
219-
github.com/checkmarx/2ms v1.4.1-0.20250227102300-e162a8629579 h1:zfbP8DzU00h1bm7PhTBNQglr47qXV+5PdUY6+iJkvRI=
220-
github.com/checkmarx/2ms v1.4.1-0.20250227102300-e162a8629579/go.mod h1:Bnd2YSh8LQSc4fHAFN0BKz8LYThB6qHg3Wn/+H+WZ4I=
219+
github.com/checkmarx/2ms v1.4.1-0.20250327145719-b78804cb08c7 h1:COsC3skOJeJaSoCPuhLZ0byRGKm+ZHlyw5qm9ydlab0=
220+
github.com/checkmarx/2ms v1.4.1-0.20250327145719-b78804cb08c7/go.mod h1:Bnd2YSh8LQSc4fHAFN0BKz8LYThB6qHg3Wn/+H+WZ4I=
221221
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
222222
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
223223
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=

internal/commands/policymanagement/policy.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,11 @@ func isPolicyEvaluated(
110110
log.Println("Policy status: ", policyResponseModel.Status)
111111
return false, nil, nil
112112
}
113-
}
114-
// Case the policy is evaluated or None
115-
logger.PrintIfVerbose("Policy evaluation finished with status: " + policyResponseModel.Status)
116-
if policyResponseModel.Status == completedPolicy || policyResponseModel.Status == nonePolicy {
117-
logger.PrintIfVerbose("Policy status: " + policyResponseModel.Status)
118-
return true, policyResponseModel, nil
113+
logger.PrintIfVerbose("Policy evaluation finished with status: " + policyResponseModel.Status)
114+
if policyResponseModel.Status == completedPolicy || policyResponseModel.Status == nonePolicy {
115+
logger.PrintIfVerbose("Policy status: " + policyResponseModel.Status)
116+
return true, policyResponseModel, nil
117+
}
119118
}
120119
return true, nil, nil
121120
}

internal/commands/pre_commit.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func PreCommitCommand(jwtWrapper wrappers.JWTWrapper) *cobra.Command {
5151
`,
5252
),
5353
}
54+
preCommitCmd.PersistentFlags().Bool("global", false, "Install the hook globally for all repositories")
5455

5556
preCommitCmd.AddCommand(secretsInstallGitHookCommand(jwtWrapper))
5657
preCommitCmd.AddCommand(secretsUninstallGitHookCommand(jwtWrapper))
@@ -89,7 +90,8 @@ func secretsInstallGitHookCommand(jwtWrapper wrappers.JWTWrapper) *cobra.Command
8990
return validateLicense(jwtWrapper)
9091
},
9192
RunE: func(cmd *cobra.Command, args []string) error {
92-
return precommit.Install()
93+
global, _ := cmd.Flags().GetBool("global")
94+
return precommit.Install(global)
9395
},
9496
}
9597

@@ -106,11 +108,9 @@ func secretsUninstallGitHookCommand(jwtWrapper wrappers.JWTWrapper) *cobra.Comma
106108
$ cx hooks pre-commit secrets-uninstall-git-hook
107109
`,
108110
),
109-
PreRunE: func(cmd *cobra.Command, args []string) error {
110-
return validateLicense(jwtWrapper)
111-
},
112111
RunE: func(cmd *cobra.Command, args []string) error {
113-
return precommit.Uninstall()
112+
global, _ := cmd.Flags().GetBool("global")
113+
return precommit.Uninstall(global)
114114
},
115115
}
116116

@@ -131,7 +131,8 @@ func secretsUpdateGitHookCommand(jwtWrapper wrappers.JWTWrapper) *cobra.Command
131131
return validateLicense(jwtWrapper)
132132
},
133133
RunE: func(cmd *cobra.Command, args []string) error {
134-
return precommit.Update()
134+
global, _ := cmd.Flags().GetBool("global")
135+
return precommit.Update(global)
135136
},
136137
}
137138

internal/commands/predicates_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,3 @@ func TestDetermineSystemOrCustomState(t *testing.T) {
338338
})
339339
}
340340
}
341-

0 commit comments

Comments
 (0)