Skip to content

fix(api): scope the CVE summary by subscription_id - #404

Open
arpitjain099 wants to merge 1 commit into
OWASP:devfrom
arpitjain099:fix/cve-summary-subscription-scope
Open

arpitjain099 wants to merge 1 commit into
OWASP:devfrom
arpitjain099:fix/cve-summary-subscription-scope

Conversation

@arpitjain099

Copy link
Copy Markdown

GET /api/score takes an optional ?subscription_id= and scopes its "latest completed scan" lookup to it. /api/score/cve-summary, ten lines below in the same file, never reads the query string, and get_cve_summary() has no parameter to take one. The dashboard draws both side by side, so on a shared database they can describe different subscriptions.

get_cve_summary() now takes the same argument get_score() and get_compliance_score() already take, and the scan lookup moves into its own query as in both siblings. Tests cover the SQL and the route; the suite goes 1537 to 1543 locally.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

@parthrohit22 parthrohit22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved: the CVE summary is now scoped to the same subscription as /api/score, the route validates malformed subscription IDs, and the tests cover the regression and fallback paths.

@parthrohit22 parthrohit22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix and for covering the regression so carefully. The CVE summary now follows the same subscription scoping contract as /api/score, and the route rejects malformed subscription IDs instead of silently falling back to an unscoped query. The tests cover the scoped path, the default fallback, and the invalid-input case, so I’m comfortable approving this change.

@ritiksah141 ritiksah141 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CI seems to be failing, so please fix that and would be good to go from my side.

@arpitjain099

Copy link
Copy Markdown
Author

Thanks for the review, Ritik. All three red checks come down to one dependency finding: pip-audit and Trivy both flag oauthlib 4.0.0 for CVE-2026-49272 (fixed in 4.0.1), and CI Summary just aggregates those two. That advisory was published on 2026-11-05, after dev and the other open PRs last ran green, so dev will show the same failure the moment its CI reruns. This PR changes only the score route, the finding model, and their tests, so it does not touch requirements.txt or any dependency. Since bumping the hash-pinned lockfile is its own change (the way #365 handled the last oauthlib bump), could I please open a separate fix(deps) PR for oauthlib 4.0.1, or leave it to Dependabot? Happy to do whichever you prefer.

This branch has not been deployed

No deployments
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.

3 participants