DevWeave logoDevWeave
CommunitiesDiscoverHelp ForumFeaturesWhy DevWeaveAI & Verification
Log inGet started
Back to Issue Discovery
NixOS/nix-security-tracker #710openPythonCybersecurity

Deduplicate CVE metadata

Opened by @fricklerhandwerk · Assignees: @adekoder

View on GitHub
good first issuedataperformance

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)

122 GitHub Stars

Claim Status & GitHub Signal

Assigned on GitHub (@adekoder). Check recent comments before starting duplicate work.

AI Issue Assessment · Grounded Analyzer
7.2 / 10 · 7–8 · Advanced

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.

Skill Match Breakdown

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.

Log in to receive your free level-adapted Hint #1 grounded in this repository's files.

Skill-Gap Learning

Gap-Targeted
Learn Code in Python

Core Python syntax, functions, control flow, and debugging basics.

Addresses skill gap: Python

Learn Cryptography in Python

Hashing, encryption primitives, and secure verification workflows.

Addresses skill gap: AppSec & Validation

Hands-On CodeCrafters Practice
Skill-Gap Challenge
Build your own Shell
Python

Parse commands, manage PATH lookups, pipes, and process execution.

Practice skill gap: Python

Build your own HTTP Server
Python

Handle raw TCP connections, HTTP parsing, headers, and concurrent routes.

Practice skill gap: Python

Issue Description

We're creating supposedly small pieces of data indiscriminately:

https://github.com/NixOS/nix-security-tracker/blob/aca950262fed92687e90b26ea32d8d7c2819024a/src/shared/fetchers.py#L46-L52

https://github.com/NixOS/nix-security-tracker/blob/aca950262fed92687e90b26ea32d8d7c2819024a/src/shared/fetchers.py#L63-L71

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)

@sidd190
View comment →

@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?

Peer Help Forum · NixOS/nix-security-tracker #710

Issue Troubleshooting Threads (0)

Ask Peers for Help

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.

Sign In

Contribution Workflow

Track your local progress before opening a pull request on GitHub.

Repository Context

Top Repository Paths

[dir] .github
[dir] .github/codeql
.github/codeql/codeql-config.yaml
.github/dependabot.yml
[dir] .github/workflows
.github/workflows/actionlint.yaml
.github/workflows/builds.yaml
.github/workflows/bump.yaml
.github/workflows/codeql.yaml
.github/workflows/deployments.yaml
.github/workflows/zizmor.yaml
.gitignore
CONTRIBUTING.md
LICENSE
README.md
[dir] contrib
contrib/README.md
contrib/grafana-dashboard.json
default.nix
[dir] docs
docs/README.md
docs/architecture.mermaid
docs/cve_records.md
docs/data_ingestion_and_matching.md

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 configuration
  • src/shared/: application with data models and business logic
  • src/api: application for the REST API
  • src/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>
  1. 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.