mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-24 00:21:29 +01:00
Fix wrong scanned artifact count when there are multiple report for an artifact (#18975)
Signed-off-by: stonezdj <daojunz@vmware.com>
This commit is contained in:
parent
d7ff8bf55e
commit
d92aca9d39
@ -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 = s.digest and s.registration_uuid = ?) `
|
||||
|
||||
// sql to query the dangerous CVEs
|
||||
dangerousCVESQL = `select vr.*
|
||||
|
@ -68,6 +68,7 @@ func (suite *SecurityDaoTestSuite) TearDownTest() {
|
||||
`delete from scan_report where uuid = 'uuid'`,
|
||||
`delete from artifact where digest = 'digest1001'`,
|
||||
`delete from scanner_registration where uuid='ruuid'`,
|
||||
`delete from scanner_registration where uuid='uuid2'`,
|
||||
`delete from vulnerability_record where cve_id='2023-4567-12345'`,
|
||||
`delete from report_vulnerability_record where report_uuid='ruuid'`,
|
||||
`delete from vulnerability_record where registration_uuid ='uuid2'`,
|
||||
|
Loading…
Reference in New Issue
Block a user