Skip to content

feat: improve sql schema#192

Merged
jdstrand merged 7 commits intomainfrom
jdstrand/improve-sql-schema
Mar 25, 2026
Merged

feat: improve sql schema#192
jdstrand merged 7 commits intomainfrom
jdstrand/improve-sql-schema

Conversation

@jdstrand
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SQLite schema used by cve-query to normalize previously inlined CVE/package metadata into dedicated tables, and extends the query tool/test suite accordingly.

Changes:

  • Normalize CVE fields into new tables (references, bugs, discovered-by, GHAS alerts, OCI scan reports, pkg patches/tags/priorities/close-dates).
  • Add insert helpers for the new tables and batch DB population via commit=False + a final commit().
  • Harden execute_query() by enforcing read-only queries via SQLite authorizer, and expand/adjust tests for the new schema and data sources.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
cvelib/sql.py Adds new normalized tables + insert helpers, batches commits during DB build, and restricts execute_query() to read-only via set_authorizer().
tests/test_sql.py Updates expectations for the new schema, adds coverage for new insert helpers, and extends CLI tests to cover GHAS/scan data ingestion and read-only query enforcement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cvelib/sql.py
Comment thread tests/test_sql.py Outdated
Comment thread cvelib/sql.py
Comment thread cvelib/sql.py
Comment thread cvelib/sql.py
Comment thread cvelib/sql.py
@jdstrand jdstrand force-pushed the jdstrand/improve-sql-schema branch 4 times, most recently from bc7b243 to 820aea7 Compare March 24, 2026 22:03
@jdstrand jdstrand requested a review from Copilot March 24, 2026 22:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cvelib/sql.py Outdated
Comment thread cvelib/scan.py
Comment thread tests/test_sql.py
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_scan.py Outdated
Comment thread tests/test_github.py Outdated
Comment thread cvelib/scan.py Outdated
Comment thread cvelib/github.py
Comment thread cvelib/cve.py Outdated
Comment thread cvelib/sql.py
Comment thread tests/test_sql.py
Comment thread tests/test_sql.py
@jdstrand jdstrand force-pushed the jdstrand/improve-sql-schema branch from a2a2c5e to ee9f97b Compare March 25, 2026 10:49
@jdstrand jdstrand force-pushed the jdstrand/improve-sql-schema branch from ee9f97b to 2088186 Compare March 25, 2026 10:54
@jdstrand jdstrand merged commit 62bfff0 into main Mar 25, 2026
8 checks passed
@jdstrand jdstrand deleted the jdstrand/improve-sql-schema branch March 25, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants