Skip to content

Commit

Permalink
Wrong artifact scanned count
Browse files Browse the repository at this point in the history
 fixes #19197

Signed-off-by: stonezdj <daojunz@vmware.com>
  • Loading branch information
stonezdj committed Aug 16, 2023
1 parent 661c762 commit 31d0309
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/pkg/securityhub/dao/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ WHERE EXISTS (SELECT 1
AND s.registration_uuid = ?)
-- exclude artifact accessory
AND NOT EXISTS (SELECT 1 FROM artifact_accessory acc WHERE acc.artifact_id = a.id)
-- exclude artifact without tag and part of the image index
AND EXISTS (SELECT 1
FROM tag
WHERE tag.artifact_id = id
OR (NOT EXISTS (SELECT 1 FROM artifact_reference ref WHERE ref.child_id = a.id)))
-- include image index which is scanned
OR EXISTS (SELECT 1
-- not a child without tag
AND NOT EXISTS (SELECT 1 FROM artifact_reference WHERE child_id = a.id AND NOT EXISTS (SELECT 1 FROM tag WHERE artifact_id = a.id))
-- include image index which is scanned
OR EXISTS (SELECT 1
FROM scan_report s,
artifact_reference ref
WHERE s.digest = ref.child_digest
Expand Down

0 comments on commit 31d0309

Please sign in to comment.