Skip to content

Add support for GitLab routable tokens #1655

@nwittstruck

Description

@nwittstruck

Is your feature request related to a problem? Please describe.
GitLab is currently working on routable tokens, which have a new specification.

Routable tokens change the format to:

<prefix><base64-payload>.<base64-payload-length><crc32>

GitLab uses the following regex to identify the tokens:

regex = '''\bglpat-[0-9a-zA-Z_-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}\b'''
examples = [
  "glpat-bzox79Of-KE9FD2LjoXXF4CvyxA.0r03gxo7s",
  "glpat-YzozdzVlMTEyNjRzZ3NmCmc6M3c1ZTExMjY0c2dzZgpoOjN3NWUxMTI2NHNnc2YKajozdzVlMTEyNjRzZ3NmCms6M3c1ZTExMjY0c2dzZgpsOjN3NWUxMTI2NHNnc2YKbTozdzVlMTEyNjRzZ3NmCm86M3c1ZTExMjY0c2dzZgpwOjN3NWUxMTI2NHNnc2YKdTozdzVlMTEyNjRzZ3NmPcvif4caKLQwleVqBR5hp3vDX9WAKZKrT318xMVLFzdtP-OZciT7mCO-NDPZnozuj2_LP-aLYwRfzxHkPrxDbBlB.8c1f6ihl5"
]

Describe the solution you'd like
I'd like to add GitLab Personal Access Tokens (routable).

Additional context
For the example tokens, e.g. I'd expect:

Finding:     glpat-bzox79Of-KE9FD2LjoXXF4CvyxA.0r03gxo7s
Secret:      glpat-bzox79Of-KE9FD2LjoXXF4CvyxA.0r03gxo7s
RuleID:      gitlab-pat-routable
Entropy:     4.879526

Finding:     glpat-bzox79Of-KE9FD2LjoXXF4CvyxA.0r03gxo7s
Secret:      glpat-bzox79Of-KE9FD2LjoXX
RuleID:      gitlab-pat
Entropy:     4.392747

I'll add a PR for this soon.

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions