Skip to content

Reapply "bin/ci: Add GitLab basic token validation"

This reverts commit e39fed57.

One change from the original commit (cd8b5462):

  • in validate_gitlab_token(), raise ValueError was replaced with return False:
diff --git a/bin/ci/gitlab_common.py b/bin/ci/gitlab_common.py
index 41d9030717c3e16c60ab..54e0cc79207c5f370760 100644
--- a/bin/ci/gitlab_common.py
+++ b/bin/ci/gitlab_common.py
@@ -92,7 +92,7 @@ def validate_gitlab_token(token: str) -> bool:
     # Basic validation of the token suffix based on:
     # https://gitlab.com/gitlab-org/gitlab/-/blob/master/gems/gitlab-secret_detection/lib/gitleaks.toml
     if not re.match(r"(\w+-)?[0-9a-zA-Z_\-]{20,64}", token_suffix):
-        raise ValueError("The provided token does not match valid GitLab token format.")
+        return False
 
     for token_type, token_prefix in TOKEN_PREFIXES.items():
         if token.startswith(token_prefix):

Merge request reports