mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
acl: use constant time comparing to check token (#6943)
This commit is contained in:
parent
f03153f571
commit
7d0f72c60a
@ -2,6 +2,8 @@ package token
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"crypto/subtle"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TokenSource bool
|
type TokenSource bool
|
||||||
@ -166,5 +168,5 @@ func (t *Store) IsAgentMasterToken(token string) bool {
|
|||||||
t.l.RLock()
|
t.l.RLock()
|
||||||
defer t.l.RUnlock()
|
defer t.l.RUnlock()
|
||||||
|
|
||||||
return (token != "") && (token == t.agentMasterToken)
|
return (token != "") && (subtle.ConstantTimeCompare([]byte(token), []byte(t.agentMasterToken)) == 1)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user