Skip to content

Commit 55b5c70

Browse files
revert of the error logs and syft update
1 parent ed0a3c6 commit 55b5c70

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ require (
5454
github.com/BobuSumisu/aho-corasick v1.0.3 // indirect
5555
github.com/BurntSushi/toml v1.5.0 // indirect
5656
github.com/Checkmarx/containers-images-extractor v1.0.22
57-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.23 // indirect
57+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.24 // indirect
5858
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
5959
github.com/DataDog/zstd v1.5.6 // indirect
6060
github.com/Masterminds/goutils v1.1.1 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2
6767
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
6868
github.com/Checkmarx/containers-images-extractor v1.0.22 h1:kJZgwk28LwJZ7Xky+kzwL+JSZOlpwrGsZQhhz4L2t6s=
6969
github.com/Checkmarx/containers-images-extractor v1.0.22/go.mod h1:HyzVb8TtTDf56hGlSakalPXtzjJ6VhTYe9fmAcOS+V8=
70-
github.com/Checkmarx/containers-resolver v1.0.31 h1:Xd4D9rvGxNXc0STHZdIWtQC4SkrD65MLpU+S6H9tb/0=
71-
github.com/Checkmarx/containers-resolver v1.0.31/go.mod h1:hQ5lw0dCc+va4jm47TpeVqRzU71/SpoE+T3e69vCZwI=
72-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.23 h1:qP4OBlCVF6BbOO0gzcoOzAtfdx7+M1kU3OsY2xBvy8E=
73-
github.com/Checkmarx/containers-syft-packages-extractor v1.0.23/go.mod h1:OPGYISPnKtVFl2mZrClErv83ZLjUPKjdQQsXLmx++oY=
70+
github.com/Checkmarx/containers-resolver v1.0.32 h1:clCWHZ2hCgBvEudLkmelxuTsS30XS0U+Wbhr7dKVJbs=
71+
github.com/Checkmarx/containers-resolver v1.0.32/go.mod h1:qW1Na7dekGfJNf3fm6tnVTzHbw/FJj7nSBnPYc4YTvI=
72+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.24 h1:+BxJgYGD6olWFaQ6B+a1JHMJHYjbRokhT1/j1N/CnuE=
73+
github.com/Checkmarx/containers-syft-packages-extractor v1.0.24/go.mod h1:OPGYISPnKtVFl2mZrClErv83ZLjUPKjdQQsXLmx++oY=
7474
github.com/Checkmarx/containers-types v1.0.9 h1:LbHDj9LZ0x3f28wDx398WC19sw0U0EfEewHMLStBwvs=
7575
github.com/Checkmarx/containers-types v1.0.9/go.mod h1:KR0w8XCosq3+6jRCfQrH7i//Nj2u11qaUJM62CREFZA=
7676
github.com/Checkmarx/gen-ai-prompts v0.0.0-20240807143411-708ceec12b63 h1:SCuTcE+CFvgjbIxUNL8rsdB2sAhfuNx85HvxImKta3g=

internal/commands/scan.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,7 +3780,7 @@ func validatePrefixedContainerImage(containerImage, prefix string) error {
37803780
imageRef = strings.Trim(imageRef, "'\"")
37813781

37823782
if imageRef == "" {
3783-
return errors.Errorf("%s: image does not have a tag", containerImagesFlagError)
3783+
return errors.Errorf("Invalid value for --container-images flag. After prefix '%s', the image reference cannot be empty", prefix)
37843784
}
37853785

37863786
// Delegate to specific validators based on prefix type
@@ -3862,15 +3862,15 @@ func validateRegistryPrefix(imageRef string) error {
38623862
// Basic validation - should not be empty and should not be obviously just a registry URL
38633863
if strings.HasSuffix(imageRef, ".com") || strings.HasSuffix(imageRef, ".io") ||
38643864
strings.HasSuffix(imageRef, ".org") || strings.HasSuffix(imageRef, ".net") {
3865-
return errors.Errorf("%s: image does not have a tag", containerImagesFlagError)
3865+
return errors.Errorf("Invalid value for --container-images flag. Registry format must specify a single image, not just a registry URL. Use format: registry:<registry-url>/<image>:<tag> or registry:<image>:<tag>")
38663866
}
38673867

38683868
// Check for registry:host:port format (just registry URL with port)
38693869
if strings.Contains(imageRef, ":") {
38703870
parts := strings.Split(imageRef, ":")
38713871
if len(parts) == minImagePartsWithTag && len(parts[portPartIndex]) <= maxPortLength && !strings.Contains(imageRef, "/") {
38723872
// This looks like registry:port format without image
3873-
return errors.Errorf("%s: image does not have a tag", containerImagesFlagError)
3873+
return errors.Errorf("Invalid value for --container-images flag. Registry format must specify a single image, not just a registry URL. Use format: registry:<registry-url>/<image>:<tag>")
38743874
}
38753875
}
38763876

@@ -3886,7 +3886,7 @@ func validateDaemonPrefix(imageRef, prefix string) error {
38863886

38873887
imageParts := strings.Split(imageRef, ":")
38883888
if len(imageParts) < minImagePartsWithTag || imageParts[imageNameIndex] == "" || imageParts[imageTagIndex] == "" {
3889-
return errors.Errorf("%s: image does not have a tag", containerImagesFlagError)
3889+
return errors.Errorf("Invalid value for --container-images flag. Prefix '%s' expects format <image-name>:<image-tag>", prefix)
38903890
}
38913891
return nil
38923892
}

internal/commands/scan_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,12 +2717,12 @@ func TestValidateContainerImageFormat_Comprehensive(t *testing.T) {
27172717
{
27182718
name: "Invalid docker prefix - missing tag",
27192719
containerImage: "docker:nginx",
2720-
expectedError: "image does not have a tag",
2720+
expectedError: "Prefix 'docker:' expects format <image-name>:<image-tag>",
27212721
},
27222722
{
27232723
name: "Invalid docker prefix - empty",
27242724
containerImage: "docker:",
2725-
expectedError: "image does not have a tag",
2725+
expectedError: "After prefix 'docker:', the image reference cannot be empty",
27262726
},
27272727

27282728
// ==================== Podman Daemon Tests ====================
@@ -2734,7 +2734,7 @@ func TestValidateContainerImageFormat_Comprehensive(t *testing.T) {
27342734
{
27352735
name: "Invalid podman prefix - missing tag",
27362736
containerImage: "podman:alpine",
2737-
expectedError: "image does not have a tag",
2737+
expectedError: "Prefix 'podman:' expects format <image-name>:<image-tag>",
27382738
},
27392739

27402740
// ==================== Containerd Daemon Tests ====================
@@ -2746,7 +2746,7 @@ func TestValidateContainerImageFormat_Comprehensive(t *testing.T) {
27462746
{
27472747
name: "Invalid containerd prefix - missing tag",
27482748
containerImage: "containerd:nginx",
2749-
expectedError: "image does not have a tag",
2749+
expectedError: "Prefix 'containerd:' expects format <image-name>:<image-tag>",
27502750
},
27512751

27522752
// ==================== Registry Tests ====================
@@ -2763,7 +2763,7 @@ func TestValidateContainerImageFormat_Comprehensive(t *testing.T) {
27632763
{
27642764
name: "Invalid registry - just URL without image",
27652765
containerImage: "registry:myregistry.com",
2766-
expectedError: "image does not have a tag",
2766+
expectedError: "Registry format must specify a single image, not just a registry URL",
27672767
},
27682768

27692769
// ==================== OCI-Dir Tests ====================

0 commit comments

Comments
 (0)