From 3531adfbb5584bc48f38780651031ce0d1276bd4 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 26 Feb 2026 16:55:01 +0200 Subject: [PATCH] refactor: limit to only alphanumeric characters and hyphens --- cmd/tinyauth/create_oidc_client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/tinyauth/create_oidc_client.go b/cmd/tinyauth/create_oidc_client.go index 989d41b..0786d7a 100644 --- a/cmd/tinyauth/create_oidc_client.go +++ b/cmd/tinyauth/create_oidc_client.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "strings" + "regexp" "github.com/google/uuid" "github.com/steveiliop56/tinyauth/internal/utils" @@ -26,9 +26,10 @@ func createOidcClientCmd() *cli.Command { clientName := args[0] - // prevent client name from using periods or underscores in order to prevent breaking flags or env vars - if strings.Contains(clientName, "_") || strings.Contains(clientName, ".") { - tlog.App.Fatal().Msg("Client name cannot contain underscores or periods") + match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName) + + if !match || err != nil { + tlog.App.Fatal().Msg("Client name can only contain alphanumeric characters and hyphens") } uuid := uuid.New()