Skip to content

Commit e501c5d

Browse files
committed
Consider OS distro during vulnerability matching
* Where possible, enriches an affected package's PURL with `distro` qualifier inferred from the package's `ecosystem`. e.g. `ecosystem=Debian:7` becomes `distro=debian-11`, `ecosystem=Ubuntu:20.04:LTS` becomes `distro=ubuntu-20.04` etc. * During vulnerability analysis, if both component and matching criteria have a PURL `distro` qualifier, ensures they match. Matching can handle codename <-> version comparisons, e.g. for Ubuntu `focal` would match `20.04` and vice versa. * Generally improves performance of OSV mirroring by using fewer transactions and disabling ORM features that caused expensive unnecessary queries. Currently Alpine, Debian, and Ubuntu distribution matching is implemented. These seem to work for SBOMs generated with Trivy and Syft. The codename <-> version mapping is currently hardcoded for Debian and Ubuntu. There is a fallback mechanism that will handle exact matches, such that when Debian publishes a hypothetical "foo" release, we can still match components with vulnerabilities if both `distro` qualifiers are exactly "foo". Debian and Ubuntu provide CSV which we could regularly fetch at runtime, but this involves more work to coordinate. Fixes #1374 Fixes #5776 Fixes #4445 Fixes #4725 Signed-off-by: nscuro <[email protected]>
1 parent 985fbb0 commit e501c5d

14 files changed

Lines changed: 1382 additions & 256 deletions

dev/docker-compose.postgres.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ services:
2828

2929
postgres:
3030
image: postgres:14-alpine
31+
command: >-
32+
-c 'shared_preload_libraries=pg_stat_statements'
33+
-c 'pg_stat_statements.track=all'
34+
-c 'pg_stat_statements.max=10000'
35+
-c 'track_activity_query_size=2048'
3136
environment:
3237
POSTGRES_DB: "dtrack"
3338
POSTGRES_USER: "dtrack"
@@ -43,5 +48,16 @@ services:
4348
- "postgres-data:/var/lib/postgresql/data"
4449
restart: unless-stopped
4550

51+
pghero:
52+
image: ankane/pghero
53+
depends_on:
54+
postgres:
55+
condition: service_healthy
56+
environment:
57+
DATABASE_URL: "postgres://dtrack:dtrack@postgres:5432/dtrack"
58+
ports:
59+
- "127.0.0.1:8432:8080"
60+
restart: unless-stopped
61+
4662
volumes:
4763
postgres-data: { }

0 commit comments

Comments
 (0)