Skip to content

Commit

Permalink
Add distro information to cvedetails view
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe authored Sep 24, 2024
1 parent 4997b6d commit 5496814
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extra-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ ALTER TABLE public.sourcepackage

CREATE OR REPLACE VIEW public.cvedetails
AS
SELECT all_cve.cve_id,
SELECT all_cve.cve_id AS cve_id,
all_cve.data -> 'vulnStatus'::text AS vulnstatus,
all_cve.data -> 'published'::text AS published,
array_agg(dist_cpe.cpe_product) AS distro,
array_agg(dist_cpe.cpe_version) AS distro_version,
array_agg(deb_cve.debsec_vulnerable) AS is_vulnerable,
array_agg(deb_cve.deb_source) AS source_package_name,
array_agg(deb_cve.deb_version::text) AS source_package_version,
((all_cve.data -> 'descriptions'::text) -> 0) -> 'value'::text AS description,
(((((all_cve.data -> 'metrics'::text) -> 'cvssMetricV40'::text) -> 0) -> 'cvssData'::text) ->> 'baseScore'::text)::numeric AS base_score_v40,
(((((all_cve.data -> 'metrics'::text) -> 'cvssMetricV31'::text) -> 0) -> 'cvssData'::text) ->> 'baseScore'::text)::numeric AS base_score_v31,
Expand All @@ -83,6 +88,8 @@ CREATE OR REPLACE VIEW public.cvedetails
((((all_cve.data -> 'metrics'::text) -> 'cvssMetricV30'::text) -> 0) -> 'cvssData'::text) ->> 'vectorString'::text AS vector_string_v30,
((((all_cve.data -> 'metrics'::text) -> 'cvssMetricV2'::text) -> 0) -> 'cvssData'::text) ->> 'vectorString'::text AS vector_string_v2
FROM all_cve
JOIN deb_cve USING (cve_id)
JOIN dist_cpe ON deb_cve.dist_id = dist_cpe.id
GROUP BY all_cve.cve_id;

ALTER TABLE public.cvedetails
Expand Down

0 comments on commit 5496814

Please sign in to comment.