fix: convert severity from negligible to none before saving to db (#15791)

Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
He Weiwei 2021-10-14 16:02:38 +08:00 committed by GitHub
parent 2679b2427b
commit b390112f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -6,3 +6,6 @@ ALTER TABLE replication_policy ADD COLUMN IF NOT EXISTS speed_kb int;
/* add version fields for lock free quota */
ALTER TABLE quota ADD COLUMN IF NOT EXISTS version bigint DEFAULT 0;
ALTER TABLE quota_usage ADD COLUMN IF NOT EXISTS version bigint DEFAULT 0;
/* convert Negligible to None for the severity of the vulnerability record */
UPDATE vulnerability_record SET severity='None' WHERE severity='Negligible';

View File

@ -104,6 +104,7 @@ func (c *nativeToRelationalSchemaConverter) toSchema(ctx context.Context, report
var cveIDs []interface{}
for _, v := range vulnReport.Vulnerabilities {
v.Severity = vuln.ParseSeverityVersion3(v.Severity.String())
cveIDs = append(cveIDs, v.ID)
}