mirror of
https://github.com/MetaCubeX/Clash.Meta.git
synced 2025-04-20 01:00:56 +00:00
Fix: API auth bypass
This commit is contained in:
parent
d622a93645
commit
d97ee63d0e
1 changed files with 3 additions and 3 deletions
|
@ -110,9 +110,9 @@ func authentication(next http.Handler) http.Handler {
|
|||
header := r.Header.Get("Authorization")
|
||||
text := strings.SplitN(header, " ", 2)
|
||||
|
||||
hasUnvalidHeader := text[0] != "Bearer"
|
||||
hasUnvalidSecret := len(text) == 2 && text[1] != serverSecret
|
||||
if hasUnvalidHeader || hasUnvalidSecret {
|
||||
hasInvalidHeader := text[0] != "Bearer"
|
||||
hasInvalidSecret := len(text) != 2 || text[1] != serverSecret
|
||||
if hasInvalidHeader || hasInvalidSecret {
|
||||
render.Status(r, http.StatusUnauthorized)
|
||||
render.JSON(w, r, ErrUnauthorized)
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue