1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-03-24 01:05:07 +00:00

fix: improve wildcard matching by using go-urlpattern (#1332)

This commit is contained in:
Elias Schneider
2026-02-28 14:08:35 +01:00
committed by GitHub
parent d98db79d5e
commit 3a339e3319
5 changed files with 242 additions and 382 deletions

View File

@@ -1,9 +1,7 @@
package dto
import (
"net/url"
"regexp"
"strings"
"time"
"github.com/pocket-id/pocket-id/backend/internal/utils"
@@ -67,19 +65,6 @@ func ValidateClientID(clientID string) bool {
// ValidateCallbackURL validates callback URLs with support for wildcards
func ValidateCallbackURL(raw string) bool {
// Don't validate if it contains a wildcard
if strings.Contains(raw, "*") {
return true
}
u, err := url.Parse(raw)
if err != nil {
return false
}
if !u.IsAbs() {
return false
}
return true
err := utils.ValidateCallbackURLPattern(raw)
return err == nil
}