From 884b424acee63b3c8c2fda1d69ef0f1081af871f Mon Sep 17 00:00:00 2001 From: Jeremy Eder Date: Wed, 4 Feb 2026 16:24:53 -0500 Subject: [PATCH] fix: allow periods in GitLab token validation GitLab Personal Access Tokens can contain periods (.) in their format, particularly in newer token versions. The validation was rejecting these valid tokens by only allowing alphanumeric, hyphens, and underscores. Changes: - Updated validateGitLabInput() to allow period (.) character - Added test case with period-containing token - Removed period-containing token from invalid tokens test Fixes user issue where valid GitLab token was rejected with: "Invalid input: token contains invalid characters" Co-Authored-By: Claude Sonnet 4.5 --- components/backend/handlers/gitlab_auth.go | 4 ++-- components/backend/handlers/gitlab_auth_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/backend/handlers/gitlab_auth.go b/components/backend/handlers/gitlab_auth.go index 5c413ba58b..bb47a1f576 100644 --- a/components/backend/handlers/gitlab_auth.go +++ b/components/backend/handlers/gitlab_auth.go @@ -102,12 +102,12 @@ func validateGitLabInput(instanceURL, token string) error { } // Validate token contains only valid characters (alphanumeric and some special chars) - // GitLab tokens use: a-z, A-Z, 0-9, -, _ + // GitLab tokens use: a-z, A-Z, 0-9, -, _, . for _, char := range token { if (char < 'a' || char > 'z') && (char < 'A' || char > 'Z') && (char < '0' || char > '9') && - char != '-' && char != '_' { + char != '-' && char != '_' && char != '.' { return fmt.Errorf("token contains invalid characters") } } diff --git a/components/backend/handlers/gitlab_auth_test.go b/components/backend/handlers/gitlab_auth_test.go index e6c42cf62f..1cbe2bb587 100644 --- a/components/backend/handlers/gitlab_auth_test.go +++ b/components/backend/handlers/gitlab_auth_test.go @@ -103,6 +103,7 @@ var _ = Describe("GitLab Auth Handler", Label(test_constants.LabelUnit, test_con "token-with-dashes-456", // with dashes "UPPERCASE_TOKEN_789012", // uppercase, 20 chars "MixedCase-Token_1234567", // mixed case, 20 chars + "glpat-abc123xyz.01.def456ghi", // with periods (GitLab token format) } for _, token := range validTokens { @@ -195,7 +196,6 @@ var _ = Describe("GitLab Auth Handler", Label(test_constants.LabelUnit, test_con "token;with;semicolons", "token:with:colons", "token,with,commas", - "token.with.dots", "token?with?questions", "token!with!exclamations", }