Skip to content

Commit

Permalink
Cvss (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe authored Sep 18, 2024
1 parent 9f870af commit 9d306a0
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions extra-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,40 @@ CREATE OR REPLACE VIEW public.sourcepackagecve
dist_cpe.cpe_version AS gardenlinux_version,
deb_cve.debsec_vulnerable AS is_vulnerable,
all_cve.data ->> 'published'::text AS cve_published_date,
CASE
WHEN (data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'baseScore')::numeric IS NOT NULL THEN
(data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'baseScore')::numeric
WHEN (data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'baseScore')::numeric IS NOT NULL THEN
(data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'baseScore')::numeric
WHEN (data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'baseScore')::numeric IS NOT NULL THEN
(data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'baseScore')::numeric
WHEN (data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'baseScore')::numeric IS NOT NULL THEN
(data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'baseScore')::numeric
END AS base_score,
CASE
WHEN (data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'vectorString')::text IS NOT NULL THEN
(data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'vectorString')::text
WHEN (data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'vectorString')::text IS NOT NULL THEN
(data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'vectorString')::text
WHEN (data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'vectorString')::text IS NOT NULL THEN
(data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'vectorString')::text
WHEN (data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'vectorString')::text IS NOT NULL THEN
(data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'vectorString')::text
END AS vector_string,
(data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'baseScore')::numeric AS base_score_v40,
(data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'baseScore')::numeric AS base_score_v31,
(data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'baseScore')::numeric AS base_score_v30,
(data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'baseScore')::numeric AS base_score_v2,
(data->'metrics'->'cvssMetricV40'->0->'cvssData'->>'vectorString')::text AS vector_string_v40,
(data->'metrics'->'cvssMetricV31'->0->'cvssData'->>'vectorString')::text AS vector_string_v31,
(data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'vectorString')::text AS vector_string_v30
(data->'metrics'->'cvssMetricV30'->0->'cvssData'->>'vectorString')::text AS vector_string_v30,
(data->'metrics'->'cvssMetricV2'->0->'cvssData'->>'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
WHERE dist_cpe.cpe_product = 'gardenlinux'::text
ORDER BY all_cve.cve_id;
WHERE
dist_cpe.cpe_product = 'gardenlinux'::text AND
deb_cve.debsec_vulnerable = TRUE;

ALTER TABLE public.sourcepackagecve
OWNER TO glvd;
Expand Down

0 comments on commit 9d306a0

Please sign in to comment.