Skip to content
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

Bug: Gitlab Target Manager does not paginate results in fetchFileList #230

Open
1 task done
niklastreml opened this issue Dec 9, 2024 · 0 comments
Open
1 task done
Assignees
Labels
area/target-manager Issues/PRs related to the TargetManager bug Something isn't working

Comments

@niklastreml
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When fetching the registered targets from gitlab, we never paginate the api. This means we're just taking the default page_size of 20 and ignore all other targets that might exist.

Expected Behavior

Sparrow should find all targets, regardless of how many there might be.

This shouldn't be a crazy difficult thing to fix. We just need to add a few query parameters to the url, and look at the Link header in the response. If we get the header, just call the url in the header to get the next page. Do this until the header is not returned again and we're happy. This is all described in the gitlab documentation.

Steps To Reproduce

  1. Create a gitlab repo with more than 20 targets
  2. Configure the target manager to scan that repo
  3. Observe how only some (20 to be exact) of the targets are actually found
  4. Profit?

Relevant logs and/or screenshots, environment information, etc.

No response

Who can address the issue?

Any Dev

Anything else?

Insert fix here

https://docs.gitlab.com/ee/api/rest/index.html#keyset-based-pagination
https://docs.gitlab.com/ee/api/repositories.html#list-repository-tree:~:text=with%20keyset%20pagination.-,pagination,-string

@niklastreml niklastreml added bug Something isn't working area/target-manager Issues/PRs related to the TargetManager labels Dec 9, 2024
@y-eight y-eight mentioned this issue Dec 11, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/target-manager Issues/PRs related to the TargetManager bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants