fix: use policy engine in oauth whitelist check (#904)

This commit is contained in:
Stavros
2026-05-26 00:07:46 +03:00
committed by GitHub
parent c3461131f5
commit 0a3e7bf265
7 changed files with 48 additions and 20 deletions
+6 -1
View File
@@ -3,6 +3,7 @@ package utils
import (
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"net"
"regexp"
@@ -11,6 +12,10 @@ import (
"github.com/google/uuid"
)
var (
ErrFilterEmpty = errors.New("filter is empty")
)
func GetSecret(conf string, file string) string {
if conf == "" && file == "" {
return ""
@@ -78,7 +83,7 @@ func CheckIPFilter(filter string, ip string) (bool, error) {
func CheckFilter(filter string, input string) (bool, error) {
if len(strings.TrimSpace(filter)) == 0 {
return false, fmt.Errorf("filter is empty")
return false, ErrFilterEmpty
}
if strings.HasPrefix(filter, "/") && strings.HasSuffix(filter, "/") {