From 4ae4514628bc9d53fa9ae46e23b370238108b847 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm Date: Tue, 10 Sep 2024 16:52:55 +0200 Subject: [PATCH] create view sourcepackagecve --- .github/workflows/ingest-snapshot.yaml | 8 ++++++-- extra-schema.sql | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 extra-schema.sql diff --git a/.github/workflows/ingest-snapshot.yaml b/.github/workflows/ingest-snapshot.yaml index d4490d0..c171307 100644 --- a/.github/workflows/ingest-snapshot.yaml +++ b/.github/workflows/ingest-snapshot.yaml @@ -35,10 +35,14 @@ jobs: - name: Ingest Data run: /usr/local/src/ingest-postgres.sh - - name: Dump Database Snapshot - run: | + - run: | echo "$PGHOST:$PGPORT:$PGDATABASE:$PGUSER:$PGPASSWORD" > ~/.pgpass chmod 0600 ~/.pgpass + + - run: psql glvd -f extra-schema.sql + + - name: Dump Database Snapshot + run: | pg_dump -h postgres -p 5432 -U glvd glvd > glvd.sql - uses: actions/upload-artifact@v4 diff --git a/extra-schema.sql b/extra-schema.sql new file mode 100644 index 0000000..229abbf --- /dev/null +++ b/extra-schema.sql @@ -0,0 +1,22 @@ +-- View: public.sourcepackagecve + +-- DROP VIEW public.sourcepackagecve; + +CREATE OR REPLACE VIEW public.sourcepackagecve + AS + SELECT ((all_cve.cve_id || deb_cve.deb_source) || deb_cve.deb_version::text) || dist_cpe.cpe_version AS my_id, + all_cve.cve_id, + deb_cve.deb_source AS source_package_name, + deb_cve.deb_version AS source_package_version, + dist_cpe.cpe_version AS gardenlinux_version, + deb_cve.debsec_vulnerable AS is_vulnerable, + all_cve.data ->> 'published'::text AS cve_published_date + 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; + +ALTER TABLE public.sourcepackagecve + OWNER TO glvd; +