Draft: Update GitLab PAT detection regex
Update GitLab PAT detection regex and introduce tests
This new regex courtesy @chill104 uses positive lookaheads to looks for GitLab PATs that have:
- at least two lowercase characters
- at least two uppercase characters
- at least two non alphanumeric characters (i.e.
[^\sa-zA-Z\"]
) - and are twenty characters in length
See https://regex101.com/r/H86FYL/1 for an illustration of what this regex will capture.
The previous tests used synthetic PATs that weren't reflective of observed patterns in generated PATs. Until gitlab-org/gitlab#335991 (comment 639062468) and https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/13902 are implemented, this may be the best technique available to identify GitLab PATs in as many contexts as possible.
Edited by Jamie Reid