-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Simplified Gitlab Enumeration #4283
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
Simplified Gitlab Enumeration #4283
Conversation
I performed the following testing after making the changes:
When scanning, all three projects were correctly listed, confirming that the scan includes public, group-based, and standalone private repositories. If there's any other scenario you'd like me to test, please feel free to let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requesting changes pending the outcome of an internal conversation about flagging this
51b3bfc
to
162ccc8
Compare
e0b3ba6
to
20a6bce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small non-blocking request but otherwise this looks great! Thanks for doing it!
pkg/sources/gitlab/gitlab.go
Outdated
ctx.Logger().Info("starting projects enumeration", | ||
"list_options", listOpts, | ||
"all_available", *projectQueryOptions.Membership) | ||
gitlabGroupsEnumerated.WithLabelValues(s.name).Set(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind placing this metric reset next to the other one? I think it would make things a little clearer to the reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not necessary, as we're not enumerating groups in the simplified approach. I'll remove it. I must have overlooked this during the simplification process.
4329388
to
6743c17
Compare
// record the projectsWithNamespace for logging. | ||
var projectsWithNamespace []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is only for logging the count, then we can make the memory usage efficient with something like:
var totalProjects int
...
totalProjects++
...
"count", totalProjects
Description:
Currently, theGitLab source enumerates projects via a complicated, multi-stage system of user queries, group queries, and deduplication. This PR simplify the approach by using
list-all-projects
API Call.Checklist:
make test-community
)?make lint
this requires golangci-lint)?