blob: bc3f946bdea0497e26546edfab9b522fa572fd55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-- search CVEs
-- FIXME: should this be moved to cve/search
SELECT COALESCE(json_group_array(json_object(
'cve_id', b.cve_id,
'nvd_id', c.nvd_id,
'description', e.value,
'v3_base_score', f.v3_base_score / 10.0,
'v3_severity', g.name,
'rank', a.min_rank
)), '[]')
FROM (
SELECT cve_id,
MIN(rank) AS min_rank
FROM cve_fts_all
WHERE cve_fts_all MATCH :q
GROUP BY cve_id
) a
JOIN cves b
ON (b.cve_id = a.cve_id)
JOIN cve_nvd_ids c
ON (c.cve_id = b.cve_id)
JOIN cve_descriptions d
ON (d.cve_id = b.cve_id)
JOIN descriptions e
ON (e.desc_id = d.desc_id)
JOIN item_cvss_v3_impacts f
ON (f.item_id = b.item_id)
JOIN severities g
ON (g.severity_id = f.v3_severity_id)
WHERE e.lang LIKE 'en%'
ORDER BY a.min_rank;
|