Skip to content

Commit 69bb212

Browse files
Merge pull request #1157 from Checkmarx/containers-cli-1.10
Bump containers cli to 1.0.10 (AST-96696)
2 parents 958e7ce + faf16c2 commit 69bb212

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/checkmarx/ast-cli
33
go 1.24.2
44

55
require (
6-
github.com/Checkmarx/containers-resolver v1.0.9
6+
github.com/Checkmarx/containers-resolver v1.0.10
77
github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63
88
github.com/Checkmarx/gen-ai-wrapper v1.0.2
99
github.com/Checkmarx/manifest-parser v0.0.6
@@ -34,15 +34,14 @@ require (
3434
)
3535

3636
require (
37-
helm.sh/helm/v3 v3.17.3 // indirect
3837
dario.cat/mergo v1.0.1 // indirect
3938
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
4039
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20240914100643-eb91380d8434 // indirect
4140
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
4241
github.com/BobuSumisu/aho-corasick v1.0.3 // indirect
4342
github.com/BurntSushi/toml v1.5.0 // indirect
4443
github.com/Checkmarx/containers-images-extractor v1.0.7 // indirect
45-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.9 // indirect
44+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.10 // indirect
4645
github.com/Checkmarx/containers-types v1.0.3 // indirect
4746
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
4847
github.com/DataDog/zstd v1.5.6 // indirect
@@ -69,7 +68,7 @@ require (
6968
github.com/anchore/packageurl-go v0.1.1-0.20250220190351-d62adb6e1115 // indirect
7069
github.com/anchore/stereoscope v0.1.0 // indirect
7170
github.com/anchore/syft v1.21.0 // indirect
72-
github.com/andybalholm/brotli v1.1.1 // indirect
71+
github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3 // indirect
7372
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
7473
github.com/aquasecurity/go-pep440-version v0.0.1 // indirect
7574
github.com/aquasecurity/go-version v0.0.1 // indirect
@@ -157,7 +156,7 @@ require (
157156
github.com/google/licensecheck v0.3.1 // indirect
158157
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
159158
github.com/gorilla/mux v1.8.1 // indirect
160-
github.com/gorilla/websocket v1.5.3 // indirect
159+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
161160
github.com/gosuri/uitable v0.0.4 // indirect
162161
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
163162
github.com/h2non/filetype v1.1.3 // indirect
@@ -290,6 +289,7 @@ require (
290289
gopkg.in/inf.v0 v0.9.1 // indirect
291290
gopkg.in/warnings.v0 v0.1.2 // indirect
292291
gopkg.in/yaml.v2 v2.4.0 // indirect
292+
helm.sh/helm/v3 v3.17.3 // indirect
293293
k8s.io/api v0.32.3 // indirect
294294
k8s.io/apiextensions-apiserver v0.32.3 // indirect
295295
k8s.io/apimachinery v0.32.3 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2
6565
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
6666
github.com/Checkmarx/containers-images-extractor v1.0.7 h1:lLgaDFFqz1jksN3/d/6sLXO0C0ODbt9xExbt44YMEOg=
6767
github.com/Checkmarx/containers-images-extractor v1.0.7/go.mod h1:ZtOqhzlErPr2QL9xGjMmxwGvzXUwi+G5BBeOfdY62Ug=
68-
github.com/Checkmarx/containers-resolver v1.0.9 h1:YuIpHS/5I8nf0HoEtD+Hw0PenrkS5rWcyiuCnlgL0GM=
69-
github.com/Checkmarx/containers-resolver v1.0.9/go.mod h1:7H1kGpc6EQ9mndAYdYKnDrBOWiC4Ej31NKBp+IIarEE=
70-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.9 h1:KFqwtkdMjT2uzJIuBSGUSOOGMSm/UZl0oXec3Mf3nh4=
71-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.9/go.mod h1:F9FFBVNmogF0wR9SVI0wRU9dZ9Ux3IZtZl3T24sQ/8E=
68+
github.com/Checkmarx/containers-resolver v1.0.10 h1:bIGh1piWrQgMCZcLoqqfTujnej+vbUYw/o72v47gQBY=
69+
github.com/Checkmarx/containers-resolver v1.0.10/go.mod h1:1D4p32HhczoJuja3F2brYfg676JxSb5+PPqKZKgzkjw=
70+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.10 h1:35n22bjH2Tx5+B8vcqIHogHeEWOQrT2lUf4uaIjoENw=
71+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.10/go.mod h1:F9FFBVNmogF0wR9SVI0wRU9dZ9Ux3IZtZl3T24sQ/8E=
7272
github.com/Checkmarx/containers-types v1.0.3 h1:srk+RQnyPXyFKmVHA6P9SQZAtjczyndZ1aa0CWF/6/0=
7373
github.com/Checkmarx/containers-types v1.0.3/go.mod h1:F13rfevriqYHR+0ahk3W9H8uLK0Msbts012f1pIxJb0=
7474
github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63 h1:SCuTcE+CFvgjbIxUNL8rsdB2sAhfuNx85HvxImKta3g=
@@ -146,8 +146,8 @@ github.com/anchore/stereoscope v0.1.0/go.mod h1:3vasimie0IJOXvMbMpjwvwIHBDA1+192
146146
github.com/anchore/syft v1.21.0 h1:JHmYOnEbCJsElROCCfg+3oIODw1LQLfXGkIrmXNZYsI=
147147
github.com/anchore/syft v1.21.0/go.mod h1:8i8Yp/MiSOdqID0+6eiwE9bOJWM7fEBYitINZyr2G6s=
148148
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
149-
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
150-
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
149+
github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3 h1:8PmGpDEZl9yDpcdEr6Odf23feCxK3LNUNMxjXg41pZQ=
150+
github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
151151
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
152152
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
153153
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
@@ -543,8 +543,8 @@ github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkM
543543
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
544544
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
545545
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
546-
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
547-
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
546+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
547+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
548548
github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY=
549549
github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo=
550550
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=

internal/commands/scan.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,8 +2855,11 @@ func validateCreateScanFlags(cmd *cobra.Command) error {
28552855
}
28562856

28572857
func validateContainerImageFormat(containerImage string) error {
2858-
imageParts := strings.Split(containerImage, ":")
2859-
if len(imageParts) != 2 || imageParts[0] == "" || imageParts[1] == "" {
2858+
pattern := regexp.MustCompile(`^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*:[\w][\w.-]{0,127}$`)
2859+
2860+
matched := pattern.MatchString(containerImage)
2861+
2862+
if !matched {
28602863
return errors.Errorf("Invalid value for --container-images flag. The value must be in the format <image-name>:<image-tag>")
28612864
}
28622865
return nil

internal/commands/scan_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,16 @@ func TestValidateContainerImageFormat(t *testing.T) {
15931593
containerImage: "nginx:latest",
15941594
expectedError: nil,
15951595
},
1596+
{
1597+
name: "Valid container image format",
1598+
containerImage: "service.test.whatever.image:8443/service/registries:custom-value",
1599+
expectedError: nil,
1600+
},
1601+
{
1602+
name: "Valid container image format",
1603+
containerImage: "nginx",
1604+
expectedError: errors.Errorf("Invalid value for --container-images flag. The value must be in the format <image-name>:<image-tag>"),
1605+
},
15961606
{
15971607
name: "Missing image name",
15981608
containerImage: ":latest",

0 commit comments

Comments
 (0)