fix: harden cluster key rate limit cookie parsing (#4012)

Signed-off-by: EndlessSeeker <1766508902@qq.com>
This commit is contained in:
EndlessSeeker
2026-06-24 15:03:05 +08:00
committed by GitHub
parent 10498a2c86
commit 04389fd0c6
2 changed files with 41 additions and 2 deletions

View File

@@ -50,8 +50,8 @@ func ExtractCookieValueByKey(cookie string, key string) (value string) {
pairs := strings.Split(cookie, ";")
for _, pair := range pairs {
pair = strings.TrimSpace(pair)
kv := strings.Split(pair, "=")
if kv[0] == key {
kv := strings.SplitN(pair, "=", 2)
if len(kv) == 2 && kv[0] == key {
value = kv[1]
break
}