bin/package-operations: does not handle GitLab API pagination
The GitLab REST API utilizes pagination (as explained here). The default number of results is 20 per page.
When a project has a very large number of tags (as is the case with the Samba project) it is possible that the tag being searched for is not among the first page of results.
For instance, querying the API for the Samba project tags (using the URL https://salsa.debian.org/api/v4/projects/lts-team%2Fpackages%2Fsamba/repository/tags) a full set of 20 tags is returned. However, when searching for the recent tag 2:4.9.5+dfsg-5+deb10u4
, the search fails to find the tag:
$ ./bin/package-operations --advisory dla --since=2023-09-12 --till=2023-09-12 --check-dla-git-tag
Found 3 DLA advisories
Found 9 CVEs
Cannot get git tag for dla-3563-1, fix: ('buster', 'samba', '2:4.9.5+dfsg-5+deb10u4'). Author: Lee Garrett <lgarrett@rocketjump.eu>. VCSs: https://salsa.debian.org/lts-team/packages/samba.git
But a query for the specific tag successfully returns the tag (e.g., when using this URL https://salsa.debian.org/api/v4/projects/lts-team%2Fpackages%2Fsamba/repository/tags/debian%2F2%254.9.5+dfsg-5+deb10u4).
At first glance, the solution seems to be either:
- handle pagination by following through to subsequent pages until a match is found or all results are exhausted
OR
- rather than querying the
repository/tags
API endpoint generally, construct a query for each specific tag which we are trying to match
Note that other solutions are possible and these are simply two suggestion which seem likely to provide working solutions.
Please discuss possible designs/approaches via this issue and propose implementation changes via MR in the project.