diff --git a/ee/lib/gitlab/ci/reports/security/locations/container_scanning.rb b/ee/lib/gitlab/ci/reports/security/locations/container_scanning.rb
index 2efca10f2f2ed2fc0c0565280bb172d9054ee9d6..04ec7161459ae5980676320f77276318dca86ae0 100644
--- a/ee/lib/gitlab/ci/reports/security/locations/container_scanning.rb
+++ b/ee/lib/gitlab/ci/reports/security/locations/container_scanning.rb
@@ -51,13 +51,9 @@ def prepare_image_name
             end
 
             def version_semver_like?(version)
-              hash_like = /\A[0-9a-f]{32,128}\z/i
+              hash_like = /\A[0-9a-f]{8,128}\z/i
 
-              if Gem::Version.correct?(version)
-                !hash_like.match?(version)
-              else
-                false
-              end
+              Gem::Version.correct?(version) && !hash_like.match?(version)
             end
           end
         end
diff --git a/ee/spec/lib/gitlab/ci/reports/security/locations/container_scanning_spec.rb b/ee/spec/lib/gitlab/ci/reports/security/locations/container_scanning_spec.rb
index 9e844756156742db631c4c16acfcb3a91f58505f..7172ef6beb56fdb0516e3313de6fd0ca860b3074 100644
--- a/ee/spec/lib/gitlab/ci/reports/security/locations/container_scanning_spec.rb
+++ b/ee/spec/lib/gitlab/ci/reports/security/locations/container_scanning_spec.rb
@@ -41,6 +41,12 @@
           false,
           'registry.gitlab.com/group/project/tmp:glibc'
         ],
+        [
+          'registry.gitlab.com/group/project/tmp:38960416',
+          nil,
+          false,
+          'registry.gitlab.com/group/project/tmp:glibc'
+        ],
         [
           'registry.gitlab.com/group/project/feature:5b1a4a921d7a50c3757aae3f7df2221878775af4',
           'registry.gitlab.com/group/project/master:ec301f43f14a2b477806875e49cfc4d3fa0d22c3',