Refactor GitLab access levels to log human-readable names#567
Merged
Conversation
…numbers Add AccessLevelName helper function in pkg/gitlab/util that maps gitlab.AccessLevelValue to human-readable names using the official GitLab SDK constants. Update all log statements in enum and renovate privesc packages to use Str() with the helper instead of Int()/Any() with raw numeric values. Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor GitLab access levels in logs for readability
Refactor GitLab access levels to log human-readable names
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves GitLab-related log readability by replacing raw numeric access level values with human-readable names, making output easier to interpret during enumeration and exploit workflows.
Changes:
- Added a
util.AccessLevelName(gitlab.AccessLevelValue) stringhelper with an unknown fallback. - Updated GitLab enum and renovate privesc logging to emit access levels as strings instead of integers/
Any(). - Added table-driven tests covering known access levels plus an unknown fallback.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/gitlab/util/util.go | Introduces AccessLevelName helper to map GitLab SDK access-level constants to readable names. |
| pkg/gitlab/util/util_test.go | Adds unit tests for known access levels and unknown fallback behavior. |
| pkg/gitlab/enum/enum.go | Updates token association logs to output access levels as readable strings. |
| pkg/gitlab/renovate/privesc/privesc.go | Updates privesc logs to output readable access level names across checks and fatal messages. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitLab access levels were logged as raw integers (e.g.,
accessLevel=30). This replaces them with human-readable names (e.g.,accessLevel=Developer).Changes
pkg/gitlab/util/util.go: AddedAccessLevelName(gitlab.AccessLevelValue) stringhelper mapping SDK constants to names (No access,Guest,Developer,Maintainer, etc.), withUnknown (N)fallbackpkg/gitlab/enum/enum.go: ConvertedInt()log calls toStr()withAccessLevelName()for group and project access levelspkg/gitlab/renovate/privesc/privesc.go: ConvertedAny()log calls toStr()withAccessLevelName()across all 6 access level log sitespkg/gitlab/util/util_test.go: Table-driven tests for all 9 known levels + unknown fallbackExample
Before:
After:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
gitlab.com/tmp/go-build1208580892/b2280/engine.test /tmp/go-build1208580892/b2280/engine.test -test.testlogfile=/tmp/go-build1208580892/b2280/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 8580892/b2017/_p-errorsas t ux-amd64/pkg/tool/linux_amd64/vet -errorsas ssSecurity/pipel-o t ux-amd64/pkg/too-trimpath -ato�� -bool t ux-amd64/pkg/tool/linux_amd64/compile -errorsas -ifaceassert t ux-amd64/pkg/too-buildtags(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.