Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmd/tinyauth/create_oidc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

@LukasSkywalker LukasSkywalker Sep 13, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the regex match method as well: MatchString(pattern string, s string) only returns an error if the pattern parsing failed. With MustCompile() and MatchString(s string), this check is moved to compile time.


u := uuid.New()
Expand Down Expand Up @@ -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,
Expand Down