From 49e28de27d827cbbf8cb0a30ddf794f7d0d2a021 Mon Sep 17 00:00:00 2001 From: LukasSkywalker Date: Sun, 13 Sep 2026 22:00:37 +0200 Subject: [PATCH] fix: only allow alphanumeric OIDC client names to keep environment variables valid --- cmd/tinyauth/create_oidc_client.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/tinyauth/create_oidc_client.go b/cmd/tinyauth/create_oidc_client.go index 2ab4f084..8ff8b640 100644 --- a/cmd/tinyauth/create_oidc_client.go +++ b/cmd/tinyauth/create_oidc_client.go @@ -26,10 +26,9 @@ func createOidcClientCmd() *cli.Command { clientName := args[0] - match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName) - - if !match || err != nil { - return errors.New("client name can only contain alphanumeric characters and hyphens") + // Only alphanumeric since the name will be turned into environment variable names + if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(clientName) { + return errors.New("client name can only contain alphanumeric characters") } u := uuid.New() @@ -89,7 +88,7 @@ func createOidcClientCmd() *cli.Command { // yaml config fmt.Fprintf(&buf, "YAML config:\n\n") - err = renderYamlToBuf(&buf, &model.OIDCConfig{ + err := renderYamlToBuf(&buf, &model.OIDCConfig{ Clients: map[string]model.OIDCClientConfig{ lclientName: { ClientID: clientId,