feat(gitlab): verify self-hosted tokens in scanner#622
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a custom GitLab token detector that can verify GitLab tokens against a user-supplied/self-hosted GitLab instance URL, and wires that URL into GitLab scan commands so verification can be performed against non-gitlab.com targets.
Changes:
- Add
GitLabURLDetectorthat detects multiple GitLab token types and (optionally) verifies API-capable tokens against a configured GitLab base URL. - Integrate the custom detector into the scanner engine alongside default TruffleHog detectors.
- Propagate the configured GitLab URL from
gl scanandgluna scancommands into the detector, and tidy minor docs formatting.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/scanner/engine/engine.go | Runs the new GitLab URL-aware detector in the TruffleHog detection phase. |
| pkg/scanner/engine/engine_test.go | Adds engine-level tests asserting the custom detector is active and detects GitLab token formats. |
| pkg/scanner/detectors/gitlab_url_detector.go | Introduces the URL-aware GitLab token detector with optional self-hosted verification. |
| pkg/scanner/detectors/gitlab_url_detector_test.go | Adds unit tests for detection behavior and URL setter/getter helpers. |
| internal/cmd/gitlab/scan/scan.go | Sets the GitLab instance URL for self-hosted verification during authenticated scans. |
| internal/cmd/gitlab/scanpublic/scan_public.go | Sets the GitLab instance URL for self-hosted verification during unauthenticated/public scans. |
| docs/introduction/secrets_verification.md | Removes extra blank lines in the custom rules section. |
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.
No description provided.