Deduplicate CVE metadata
Opened by @fricklerhandwerk · Assignees: @adekoder
Solve & Merge Reward: Up to +216 XP & +60 Coins
+30 XP on PR open · +180 XP & +60 coins on merge · +6 star XP (122 stars)
Claim Status & GitHub Signal
Assigned on GitHub (@adekoder). Check recent comments before starting duplicate work.
Estimated from issue labels (good first issue, data, performance), Python context, and discussion depth. There are 1 GitHub comments to review for maintainer clarifications. Note: this is an estimate, not a guarantee.
What It's About
Deduplicate CVE metadata. We're creating supposedly small pieces of data indiscriminately: https://github.com/NixOS/nix-security-tracker/blob/aca950262fed92687e90b26ea32d8d7c2819024a/src/shared/fetchers.pyL46-L52 https://github.com/NixOS/nix-security-tracker/blob/aca950262fed92687e90b2
Why It Matters
Resolving #710 improves reliability and developer experience in NixOS/nix-security-tracker.
Expected Outcome
A focused pull request addressing #710 with relevant checks or tests verified locally.
Log in to compare this issue's requirements against your profile skills. Required concepts: Python, AppSec & Validation.
Progressive AI Hints
Hint #1 is always free and calibrated to your experience level. Extra hints unlock with coins without spoiling the full solution.
Skill-Gap Learning
Issue Description
We're creating supposedly small pieces of data indiscriminately:
This leads to a waste of some hundreds MB in storage for descriptions and (likely a bit less due to internal compression):
In [4]: duplicates = Description.objects.values('lang', 'value').annotate(count=Count('id'), value_length=Length('value')).filter(count__gt=1).order_by('-count')
In [5]: wasted_bytes = duplicates.aggregate(total=Sum((F('count') - 1) * F('value_length')))['total']
In [6]: wasted_bytes
Out[6]: 216105026
In [7]: wasted_bytes / 1024 / 1024
Out[7]: 206.09381294250488
In [8]: duplicates = Reference.objects.values('url', 'name').annotate(count=Count('id'), value_length=Length('url')).filter(count__gt=1).order_by('-count')
In [9]: wasted_bytes = duplicates.aggregate(total=Sum((F('count') - 1) * F('value_length')))['total']
In [10]: wasted_bytes / 1024 / 1024
Out[10]: 241.48347282409668
A bit worse, due to millions of such duplicates we have ~2GB of useless indexes:
nix-security-tracker=# SELECT pg_size_pretty(pg_total_relation_size('shared_description_media'));
pg_size_pretty
----------------
19 MB
(1 row)
nix-security-tracker=# SELECT pg_size_pretty(pg_total_relation_size('shared_description'));
pg_size_pretty
----------------
909 MB
(1 row)
nix-security-tracker=# SELECT pg_size_pretty(pg_total_relation_size('shared_reference'));
pg_size_pretty
----------------
648 MB
(1 row)
nix-security-tracker=# SELECT pg_size_pretty(pg_total_relation_size('shared_reference_tags'));
pg_size_pretty
----------------
1042 MB
(1 row)
Linked Pull Requests (0)
No linked or cross-referenced pull requests detected via GitHub timeline. Check comments below for informal claims before starting.
GitHub Comments (1)
@fricklerhandwerk if this is open to contributions, can I take a stab at it, considering the merged PR and what's left of the issue to be done?
Issue Troubleshooting Threads (0)
No troubleshooting threads opened for this issue yet. If you hit a test, build, or navigation blocker, post what you've tried so fellow contributors can help.
PR Verification & Rewards
Sign in and link GitHub to verify your PR against this issue and earn XP + coins.
Contribution Workflow
Track your local progress before opening a pull request on GitHub.
Repository Context
Top Repository Paths
CONTRIBUTING.md Excerpt
Contributing guide
This document is for anyone wanting to contribute to the implementation of the Nixpkgs security tracker.
Overview
Resources to help you get started:
- Quickstart guide: Set up a database, run the service locally.
- Manual data ingestion and matching: Ingest Nixpkgs metadata and CVEs into your local instance.
- Hacking guide: Common workflows for interacting with the development environment.
- Style guide: Tips for getting your change merged
- Architecture Overview: High-level system design and component interaction.
- Architecture Diagram: Visual representation of the system (Mermaid source).
- Design Documents: Detailed design specifications for individual features.
- CVE records: What the tracker stores for each CVE.
Directory structure
Application logic lives in the src/ directory.
From here, it follows standard Django patterns:
src/project/: global project configurationsrc/shared/: application with data models and business logicsrc/api: application for the REST APIsrc/webview: User specific models, user stories tests, and the Django view that serves the frontend.frontend: the Preact powered frontend that relies on the API
Service definitions are in nix/configuration.nix.
Other directories in this repository have additional README.md files with more specific information relevant to their sibling files.
Setting up credentials
The service connects to GitHub for certain operations:
- Managing permissions according to GitHub team membership in the configured organisation
- Publishing vulnerabilities as GitHub issues
This requires setting up GitHub credentials.
<details><summary>Create a Django secret key</summary>python3 -c 'import secrets; print(secrets.token_hex(100))' > .credentials/SECRET_KEY
</details>
<details><summary>Set up GitHub authentication</summary>
-
Create a new or select an existing GitHub organisation to associate with the Nixpkgs security tracker.
We're us
... (truncated)
Advisory PR Assistant
Helps structure your PR description or unpack reviewer feedback. Does not perform GitHub actions.