Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ea744e3
added debug for import and added consistent file ordering for insert …
Hubtrick-Git Apr 8, 2026
f1833af
first sketch with semingly correct resuls and mediocore performance
Hubtrick-Git Apr 12, 2026
8c4cf50
first working version with full index creation
Hubtrick-Git Apr 13, 2026
7ae474e
added different import logic for different work loads
Hubtrick-Git Apr 13, 2026
8fd1b59
optimized concurrency pattern for faster data fetching
Hubtrick-Git Apr 14, 2026
c0fcb73
fixed some error formatting issues
Hubtrick-Git Apr 14, 2026
f04c0f7
applied some experimental perofrmance improvements before refactoring…
Hubtrick-Git Apr 14, 2026
3d42d0b
drop unecessary affected component attributes and refactor code accor…
Hubtrick-Git Apr 15, 2026
0e45512
drop unecessary affected component attributes and refactor code accor…
Hubtrick-Git Apr 15, 2026
d3c0f15
accident commit before; now fixed bug in affected components copy sta…
Hubtrick-Git Apr 15, 2026
1c7a958
added migrations for database
Hubtrick-Git Apr 15, 2026
e52c77d
fixed bug for incremental import
Hubtrick-Git Apr 15, 2026
60b09f7
refactored cve table to also include a smaller id column, changed the…
Hubtrick-Git Apr 17, 2026
93d15b4
improved readibility and code flow
Hubtrick-Git Apr 17, 2026
df83dc4
implemented update insert for cves and dedup insert for cve_relations…
Hubtrick-Git Apr 17, 2026
f7b44c6
cleaned up osv_service further
Hubtrick-Git Apr 20, 2026
e97c262
added test case for checking index and constraint rebuilding integrit…
Hubtrick-Git Apr 20, 2026
928ba5c
fix linter and test cases
Hubtrick-Git Apr 21, 2026
55985ef
fixes more tests and linter issues
Hubtrick-Git Apr 21, 2026
7fa2777
fixed defer rollback bug, optimized csv loop processing, optimized an…
Hubtrick-Git Apr 22, 2026
c6a9913
restructured code using better seperation of work; added sequential c…
Hubtrick-Git Apr 22, 2026
5661a3b
reworked command structure and removed obsolete ones
Hubtrick-Git Apr 22, 2026
f14b330
added minor improvements regarding the efficiency and correctness of …
Hubtrick-Git Apr 23, 2026
02f5c29
first sketch for export logic;calculates checksum after import and mi…
Hubtrick-Git Apr 28, 2026
1ee90ff
save before resetting untracked changes
Hubtrick-Git Apr 28, 2026
ba87f5e
first verskion of export with zip containing all files
Hubtrick-Git Apr 28, 2026
9a19d5b
updated vulndb workflow and matched export logic
Hubtrick-Git Apr 28, 2026
235a7b9
updated vulndb workflow and matched export logic
Hubtrick-Git Apr 28, 2026
608766e
changed workflow to not interfer with current vulndb registry
Hubtrick-Git Apr 28, 2026
63e7cf5
removed input parameter in workflow
Hubtrick-Git Apr 28, 2026
9101d79
readd manual workflow dispatch
Hubtrick-Git Apr 28, 2026
a1380b2
overhauled export logic and vulndb workflow
Hubtrick-Git Apr 28, 2026
fcab1be
first working export and import on fresh database
Hubtrick-Git Apr 28, 2026
f22dfae
Merge branch 'main' into fix-difff-vulndb-import
timbastin Apr 28, 2026
112d0a3
Merge branch 'main' into fix-difff-vulndb-import
timbastin Apr 28, 2026
4b25668
implements gob encoding, including zst compression
timbastin Apr 28, 2026
b7322b4
writing gob files
timbastin Apr 29, 2026
4fcd0d9
cleaned up export; now exporting osv vulns and diff vulns slices
Hubtrick-Git Apr 29, 2026
01db537
fixed file name mismatch in github workflow
Hubtrick-Git Apr 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 17 additions & 49 deletions .github/workflows/vulndb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: VulnDB Workflow

on:
workflow_dispatch:
inputs:
run_generate_snapshot:
description: "Run generate snapshot job"
required: false
default: "false"
schedule:
- cron: "0 */6 * * *" # every hour

Expand Down Expand Up @@ -56,39 +51,11 @@ jobs:
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 - https://github.com/actions/setup-go/releases/tag/v5.5.0
with:
go-version: "1.25"
- name: Build the database (this takes some time)
run: |
# will fetch the latest build database from ghcr.io
go run ./cmd/devguard-cli/main.go vulndb sync

- name: Dump the PostgreSQL database
if: ${{ github.event.inputs.run_generate_snapshot == 'true' }}
# skip:checkov:CKV_SECRET_6
run: |
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM affected_components) TO STDOUT WITH DELIMITER ',' CSV HEADER" > affected_components.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM cve_affected_component) TO STDOUT WITH DELIMITER ',' CSV HEADER" > cve_affected_component.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM cves) TO STDOUT WITH DELIMITER ',' CSV HEADER" > cves.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM cwes) TO STDOUT WITH DELIMITER ',' CSV HEADER" > cwes.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM exploits) TO STDOUT WITH DELIMITER ',' CSV HEADER" > exploits.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM malicious_packages) TO STDOUT WITH DELIMITER ',' CSV HEADER" > malicious_packages.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM malicious_affected_components) TO STDOUT WITH DELIMITER ',' CSV HEADER" > malicious_affected_components.csv
# PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM weaknesses) TO STDOUT WITH DELIMITER ',' CSV HEADER" > weaknesses.csv
PGPASSWORD=${{env.POSTGRES_PASSWORD}} psql -h localhost -U devguard devguard -c "COPY (SELECT * FROM cve_relationships) TO STDOUT WITH DELIMITER ',' CSV HEADER" > cve_relationships.csv
- name: Export the diff csv files (this does not take some time)
if: ${{ github.event.inputs.run_generate_snapshot == 'false' || github.event.inputs.run_generate_snapshot == '' }}
run: |
# writes the difference from the db before and after the sync into csv files
go run ./cmd/devguard-cli/main.go vulndb export

- name: install zip
run: sudo apt-get install zip

- name: Zip the CSV files
if: ${{ github.event.inputs.run_generate_snapshot == 'true' }}
run: zip vulndb.zip affected_components.csv cve_affected_component.csv cves.csv cwes.csv exploits.csv malicious_packages.csv malicious_affected_components.csv cve_relationships.csv
- name: Zip the CSV files
if: ${{ github.event.inputs.run_generate_snapshot == 'false' || github.event.inputs.run_generate_snapshot == '' }}
run: zip -r vulndb.zip diffs-tmp
- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
with:
Expand All @@ -97,10 +64,14 @@ jobs:
- name: Write signing key to disk
run: echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > cosign.key

- name: Sign the database zip file
- name: Sign each database file
env:
COSIGN_PASSWORD: ""
run: cosign import-key-pair --key cosign.key && cosign sign-blob --yes --key import-cosign.key vulndb.zip > vulndb.zip.sig
run: |
cosign import-key-pair --key cosign.key
cosign sign-blob --yes --key import-cosign.key diffOSVVulns.gob.zst > diffOSVVulns.gob.zst.sig
cosign sign-blob --yes --key import-cosign.key allOSVVulns.gob.zst > allOSVVulns.gob.zst.sig
cosign sign-blob --yes --key import-cosign.key integrity_checks.json > integrity_checks.json.sig
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
Expand All @@ -113,20 +84,17 @@ jobs:
- name: set the date
run: echo "date="${{env.DATE}} >> "$GITHUB_ENV"

- name: Push the database ZIP file to GitHub Container Registry (vulndb/v1)
if: ${{ github.event.inputs.run_generate_snapshot == 'false' || github.event.inputs.run_generate_snapshot == '' }}
run: |
oras push ghcr.io/l3montree-dev/devguard/vulndb/v1:$date vulndb.zip

- name: Push the database ZIP file to GitHub Container Registry (snapshot)
if: ${{ github.event.inputs.run_generate_snapshot == 'true' }}
run: |
oras push ghcr.io/l3montree-dev/devguard/vulndb/v1:$date-snapshot vulndb.zip
- name: Push the signatures to the GitHub Container Registry
if: ${{ github.event.inputs.run_generate_snapshot == 'false' || github.event.inputs.run_generate_snapshot == '' }}
- name: Push the database files to GitHub Container Registry (snapshot)
run: |
oras push ghcr.io/l3montree-dev/devguard/vulndb/v1:$date.sig vulndb.zip.sig
oras push ghcr.io/l3montree-dev/devguard/vulndb/osv-mirror:$date \
allOSVVulns.gob.zst \
diffOSVVulns.gob.zst \
integrity_checks.json
oras tag ghcr.io/l3montree-dev/devguard/vulndb/osv-mirror:$date latest
- name: Push the signatures to the GitHub Container Registry (snapshot)
if: ${{ github.event.inputs.run_generate_snapshot == 'true' }}
run: |
oras push ghcr.io/l3montree-dev/devguard/vulndb/v1:$date-snapshot.sig vulndb.zip.sig
oras push ghcr.io/l3montree-dev/devguard/vulndb/osv-mirror:$date.sig \
allOSVVulns.gob.zst.sig \
diffOSVVulns.gob.zst.sig \
integrity_checks.json.sig
oras tag ghcr.io/l3montree-dev/devguard/vulndb/osv-mirror:$date.sig latest.sig
44 changes: 34 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
"program": "${workspaceRoot}/cmd/devguard/main.go",
"args": [],
},
{
"name": "Launch DepTreeWalk",
"type": "go",
"request": "launch",
"cwd": "${workspaceRoot}",
"mode": "auto",
"program": "${workspaceRoot}/cmd/devguard-cli/test",
"args": [
],
},
{
"name": "Launch DepTreeWalk",
"type": "go",
"request": "launch",
"cwd": "${workspaceRoot}",
"mode": "auto",
"program": "${workspaceRoot}/cmd/devguard-cli/test",
"args": [
],
},
{
"name": "Launch Policy eval",
"type": "go",
Expand Down Expand Up @@ -105,6 +105,30 @@
"epss"
]
},
{
"name": "VulnDB Import",
"type": "go",
"request": "launch",
"cwd": "${workspaceRoot}",
"mode": "auto",
"program": "${workspaceRoot}/cmd/devguard-cli/main.go",
"args": [
"vulndb",
"import"
]
},
{
"name": "VulnDB ImportRC",
"type": "go",
"request": "launch",
"cwd": "${workspaceRoot}",
"mode": "auto",
"program": "${workspaceRoot}/cmd/devguard-cli/main.go",
"args": [
"vulndb",
"importRC"
]
},
{
"name": "Scanner attestations",
"type": "go",
Expand Down
3 changes: 1 addition & 2 deletions cmd/devguard-cli/commands/vulndb.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ func NewVulndbCommand() *cobra.Command {

vulndbCmd.AddCommand(newSyncCommand())
vulndbCmd.AddCommand(newImportCommand())
vulndbCmd.AddCommand(newExportIncrementalCommand())
vulndbCmd.AddCommand(newExportCommand())
vulndbCmd.AddCommand(newAliasMappingCommand())
vulndbCmd.AddCommand(newCleanupCommand())
return &vulndbCmd
}

Expand Down
55 changes: 0 additions & 55 deletions cmd/devguard-cli/commands/vulndb_cleanup.go

This file was deleted.

63 changes: 0 additions & 63 deletions cmd/devguard-cli/commands/vulndb_export.go

This file was deleted.

Loading
Loading