mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-03-02 04:42:02 +00:00
refactor: limit to only alphanumeric characters and hyphens
This commit is contained in:
@@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"regexp"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/steveiliop56/tinyauth/internal/utils"
|
"github.com/steveiliop56/tinyauth/internal/utils"
|
||||||
@@ -26,9 +26,10 @@ func createOidcClientCmd() *cli.Command {
|
|||||||
|
|
||||||
clientName := args[0]
|
clientName := args[0]
|
||||||
|
|
||||||
// prevent client name from using periods or underscores in order to prevent breaking flags or env vars
|
match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName)
|
||||||
if strings.Contains(clientName, "_") || strings.Contains(clientName, ".") {
|
|
||||||
tlog.App.Fatal().Msg("Client name cannot contain underscores or periods")
|
if !match || err != nil {
|
||||||
|
tlog.App.Fatal().Msg("Client name can only contain alphanumeric characters and hyphens")
|
||||||
}
|
}
|
||||||
|
|
||||||
uuid := uuid.New()
|
uuid := uuid.New()
|
||||||
|
|||||||
Reference in New Issue
Block a user