Affected-by-advisories v2 page returns 500 for a purl with no matching package
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
Start in vulnerabilities/views.py at AffectedByAdvisoriesListView.get_context_data and trace its call to get_fixed_package_details(). Check how the template handles an empty mapping through the get_item filter, then run the relevant view tests. Done means a purl with no matching package renders successfully with zero results instead of returning HTTP 500.
Written by the indexing model from the issue text.
Description
Visiting the affected-by-advisories v2 page for a package that is not in the database returns a 500 instead of an empty result list.
Steps to reproduce
- Open
/affected-by-advisories/v2/pkg:pypi/[email protected](after the Altcha challenge). - The page returns HTTP 500.
What happens
AffectedByAdvisoriesListView.get_context_data looks the purl up with PackageV2.objects.for_purl(purl).first(), which returns None when there is no matching package, and passes it straight to get_fixed_package_details(). That helper dereferences package.affected_in_impacts, so it raises:
AttributeError: 'NoneType' object has no attribute 'affected_in_impacts'
(vulnerabilities/views.py:441)
Expected behaviour
The page should render with zero results, the same as any other purl with no affecting advisories. A mistyped or not-yet-imported package link should not 500.
Notes
- The same helper is also used by
PackageV2Details, but thereself.objectis neverNone(the detail view 404s first), so only this list view is affected. - The fix is a
Noneguard inget_fixed_package_details()returning an empty mapping, which the template already handles through theget_itemfilter.
- Dominant language
- Python
- Stars
- 719
- Forks
- 359
- Avg merge
- 11h 59m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aboutcode-org/vulnerablecode
-
Pipeline run pages return 500 for a schedule whose pipeline is not registeredPossibly taken @sanchit955 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aboutcode-org/vulnerablecode#2505 ·
Maintainers usually reply within 1 day
-
OSV v3 parser shares introduced/fixed commit patches across affected packagesPossibly taken @Celestial-0 claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aboutcode-org/vulnerablecode#2489 ·
Maintainers usually reply within 1 day
-
OSV parser drops all crates.io affected entries because the ecosystem mapping uses cargoPossibly taken @Ashutosh-Panda2004 claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aboutcode-org/vulnerablecode#2485 · 1 comment ·
Maintainers usually reply within 1 day
-
Docker Compose setup fails on wait-for-it host web:8000 and missing runtime .envPossibly taken @Anurag-S1ngh claimed this 25 days ago. Open
Difficulty 2/5 Half a day Newbie friendliness 77/100
aboutcode-org/vulnerablecode#2477 · 1 comment ·
Maintainers usually reply within 1 day
-
OVAL parser corrupts version bounds when the epoch is 10, 20 or the version contains "0:"Possibly taken @Ashutosh-Panda2004 claimed this 23 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aboutcode-org/vulnerablecode#2474 · 1 comment ·
Maintainers usually reply within 1 day
All issues in aboutcode-org/vulnerablecode
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mohanraj00/entelos#200 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
sweep
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
bketelsen/truenas-mcp#77 ·
Maintainers usually reply within 1 day
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskOpen
Difficulty 1/5 Under an hour Newbie friendliness 86/100
sandbox-quantum/switch#2163 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
openedx/xblock-lti-consumer#765 ·
Maintainers usually reply within 1 day