-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time_modified pagination can fail if modifications occur during traversal #972
Comments
brettp
added a commit
that referenced
this issue
Jan 12, 2023
…nexpect sort order and possible race condition
brettp
added a commit
that referenced
this issue
Jan 12, 2023
…nexpect sort order and possible race condition
jdaigneau5
added a commit
that referenced
this issue
Jan 12, 2023
Resolves #972 Sort /cve and /cve-id by time.created to mitigate unexpected order and possible race condition
Re-opening for further discussion |
1 task
Resolved by #1050 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The pagination implementation for the
GET /cve-id
andGET /cve
endpoints, in the time_modified case, can produce incomplete data if an item is modified during traversal across the multiple pages of results. For example, if the user selects a bounded date range such as time_modified.gt=date1 and time_modified.lt=date2, where date2 is earlier than the time that traversal started, it is still possible for an item to exist such that time_modified.lt=date2 was true for page=N but false for page=N+1. In other words, an item can move forward in time such that it is outside of the bounded interval.As a specific example, the production server was queried 20 times, starting at about 1800Z, for
GET /cve?time_modified.gt=2022-10-09T01:00:00.000Z&time_modified.lt=2022-12-21T16:44:00.000Z
. Each set of queries needed to traverse through 14 pages. The first three sets had"totalCount":6633
and the last seventeen had"totalCount":6632
. This occurred because CVE-2022-3691 has:In other words, it jumped out of the bounded range because of the modification at 18:12:09.217Z.
For most of the later sets of queries, the page layout was correct but different: specifically, CVE-2022-39957 moved from the top of page 9 to the bottom of page 8. However, for the third set of queries, CVE-2022-39957 was simply never found, although it was always in the bounded interval with no recent changes; it has:
This happened because, during the third set of queries, the traversal captured page 8 of the old page layout and page 9 of the new page layout, neither of which included CVE-2022-39957.
I have not investigated what fix options are feasible, but (untested) possibilities include:
The text was updated successfully, but these errors were encountered: