mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-30 17:58:14 +00:00 
			
		
		
		
	Use constant time compare for bootstrap tokens
Signed-off-by: Joe Beda <joe.github@bedafamily.com>
This commit is contained in:
		| @@ -20,6 +20,7 @@ Package bootstrap provides a token authenticator for TLS bootstrap secrets. | ||||
| package bootstrap | ||||
|  | ||||
| import ( | ||||
| 	"crypto/subtle" | ||||
| 	"fmt" | ||||
| 	"regexp" | ||||
| 	"time" | ||||
| @@ -95,7 +96,7 @@ func (t *TokenAuthenticator) AuthenticateToken(token string) (user.Info, bool, e | ||||
| 	} | ||||
|  | ||||
| 	ts := getSecretString(secret, bootstrapapi.BootstrapTokenSecretKey) | ||||
| 	if ts != tokenSecret { | ||||
| 	if subtle.ConstantTimeCompare([]byte(ts), []byte(tokenSecret)) != 1 { | ||||
| 		return nil, false, nil | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Joe Beda
					Joe Beda