Skip to content

Commit

Permalink
Fix wrong scanned artifact count when there are multiple report for a…
Browse files Browse the repository at this point in the history
…n artifact

Signed-off-by: stonezdj <daojunz@vmware.com>
  • Loading branch information
stonezdj committed Jul 21, 2023
1 parent d4aa9b1 commit 5b24e59
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/pkg/securityhub/dao/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ order by s.critical_cnt desc, s.high_cnt desc, s.medium_cnt desc, s.low_cnt desc
limit 5`

// sql to query the scanned artifact count
scannedArtifactCountSQL = `select count(1)
from artifact a
left join scan_report s on a.digest = s.digest
where s.registration_uuid= ? and s.uuid is not null`
scannedArtifactCountSQL = `select count(1)
from artifact
where exists (select 1 from scan_report s where artifact.digest = artifact.digest and s.registration_uuid = ?) `

// sql to query the dangerous CVEs
dangerousCVESQL = `select vr.*
Expand Down

0 comments on commit 5b24e59

Please sign in to comment.