Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sort vulnerabilities from newest to oldest in API responses#2243

Open
ashwinraj8090 wants to merge 1 commit into
aboutcode-org:main from
ashwinraj8090:sort-order
Open

Sort vulnerabilities from newest to oldest in API responses #2243
ashwinraj8090 wants to merge 1 commit into
aboutcode-org:main from
ashwinraj8090:sort-order

Conversation

@ashwinraj8090

@ashwinraj8090 ashwinraj8090 commented Mar 29, 2026

Copy link
Copy Markdown

Hi @pombredanne,

I worked on this issue and implemented descending sorting for vulnerabilities so that newer entries appear first in the API responses.

Approach

Since there is no explicit timestamp field available, I used vulnerability_id as a proxy for ordering, assuming higher IDs correspond to more recent entries.

The sorting has been applied across relevant API querysets, including:

  • VulnerabilityViewSet
  • CPE-related queries
  • V2 API endpoints

For packages, I did not introduce sorting as there does not appear to be a clear field representing recency. Please let me know if a specific field should be used.

Please let me know if this approach aligns with the intended solution or if a different field or strategy should be preferred.

Fixes #1754

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

In UI and API, sort packages and vulnerabilities from newest to oldest.

1 participant

AltStyle によって変換されたページ (->オリジナル) /