Use constant time comparison for WHIP tokens.
Thanks to Vinayak Mishra.
This commit is contained in:
+1
-1
@@ -295,7 +295,7 @@ func whipResourceHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if t := c.Token(); t != "" {
|
if t := c.Token(); t != "" {
|
||||||
token := parseBearerToken(r.Header.Get("Authorization"))
|
token := parseBearerToken(r.Header.Get("Authorization"))
|
||||||
if token != t {
|
if !group.ConstantTimeCompare(t, token) {
|
||||||
http.Error(w, "Forbidden", http.StatusForbidden)
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user