Skip to content

Conversation

@mustansir14
Copy link
Contributor

@mustansir14 mustansir14 commented Nov 20, 2025

Description:

This PR resolves #4551 by introducing a V3 detector for Gitlab. Newly generated Gitlab PATs have a different format than what we are looking for in v1 and v2.

Thanks to @trufflesteeeve, we found Gitlab's merged PR that introduced this change. The regex is now made flexible to match what they have.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@mustansir14 mustansir14 requested a review from a team November 20, 2025 14:11
@mustansir14 mustansir14 requested a review from a team as a code owner November 20, 2025 14:11
@shahzadhaider1
Copy link
Contributor

Great work, @mustansir14. Let's add the v3 to engine defaults as well.

@mustansir14 mustansir14 requested a review from a team as a code owner November 20, 2025 14:45

var (
defaultClient = common.SaneHttpClient()
keyPat = regexp.MustCompile(`\b(glpat-[a-zA-Z0-9\-=_]{27,300}.[0-9a-z]{2}.[a-z0-9]{9})\b`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: It's probably worth adding a comment and a link to the gitlab commit that sets the regex, just so anyone curious about it can more easily pull up that info.

Though, it's also included as a part of the PR, so the information is available, which is great! A comment would just make it easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Added.

Copy link
Contributor

@shahzadhaider1 shahzadhaider1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitLab Personal Access Token Syntax Change

5 participants