Align GitLab token regexes with TruffleHog and add source provenance#566
Merged
Align GitLab token regexes with TruffleHog and add source provenance#566
Conversation
…f TruffleHog verification TruffleHog verifies GitLab tokens against gitlab.com only, which suppresses findings for self-hosted GitLab instances. These built-in regex rules ensure all GitLab token types (glpat, gldt, glrt, glptt, glcbt, gloas, glsoat, glft, glimt, glffct, glagent, GR1348941) are always detected by the pattern-based scanner with high confidence. Fixes: glpat detection issue Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [issue_title] Update glpat detection to support self-hosted GitLab
Add built-in regex rules for GitLab token detection
Mar 18, 2026
- Split glpat rule into v2 and v3 matching TruffleHog's exact regexes - Add source URL comments above each regex (TruffleHog source or GitLab source) - Align character class to [a-zA-Z0-9\-=_] matching TruffleHog's charset - Add glrtr- (Runner Registration Token) which was missing - Rename glrt- from "Runner Registration Token" to "Runner Authentication Token" - Rename GR1348941 from "Runner Authentication Token (Legacy)" to "Runner Token (Legacy)" Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
Add built-in regex rules for GitLab token detection
Add built-in regex rules for GitLab token types aligned with TruffleHog patterns
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Pipeleek’s built-in scanner rules with regex-based detectors for multiple GitLab token formats so tokens are still detected even when TruffleHog verification suppresses unverified GitLab findings (notably for self-hosted GitLab instances).
Changes:
- Added built-in regex rules for a range of GitLab token types (PAT v2/v3, runner tokens, deploy/build tokens, etc.).
- Updated existing rules tests to account for the new built-in rules and added assertions that the new rules exist and are marked
highconfidence. - Added an engine-level test intended to validate detection behavior when TruffleHog verification is enabled.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/scanner/rules/rules.go | Appends new built-in GitLab token regex rules to the secrets patterns list. |
| pkg/scanner/rules/rules_test.go | Updates rule-count expectations and adds a test ensuring all GitLab token rules exist with high confidence. |
| pkg/scanner/engine/engine_test.go | Adds a detection test for GitLab tokens while TruffleHog verification is enabled. |
Update the GitLab Personal Access Token v3 regex to match the exact pattern from TruffleHog's gitlab_v3.go detector, including \b word boundaries and capture group. Pin the source URL to the specific commit. Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
Add built-in regex rules for GitLab token types aligned with TruffleHog patterns
Align GitLab token regexes with TruffleHog and add source provenance
Mar 18, 2026
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.
Custom pipeleek GitLab token regexes diverged from TruffleHog's patterns and lacked source attribution. This aligns them and documents each regex's origin.
Changes
\bword boundaries, pinned to commitafd5336:glpat-rule into separate v2/v3 rules matching TruffleHog's detector versioning ({20,22}vs{27,300}with routable token suffix)[a-zA-Z0-9\-=_]across all token rules (added=)glrtr-: Runner Registration Token prefix was missing (REGISTRATION_RUNNER_TOKEN_PREFIX)glrt-→ "Runner Authentication Token" (not "Registration"),GR1348941→ "Runner Token (Legacy)"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-build2004454262/b001/engine.test /tmp/go-build2004454262/b001/engine.test -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.count=1 -test.run=GitLab 742219/b094/vet.-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet -p github.com/truff-atomic 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
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.