diff --git a/server/handlers.go b/server/handlers.go index 4cfe6b84..f39db575 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -2,6 +2,7 @@ package server import ( "crypto/sha256" + "crypto/subtle" "encoding/base64" "encoding/json" "fmt" @@ -678,7 +679,8 @@ func (s *Server) withClientFromStorage(w http.ResponseWriter, r *http.Request, h } return } - if client.Secret != clientSecret { + + if subtle.ConstantTimeCompare([]byte(client.Secret), []byte(clientSecret)) != 1 { if clientSecret == "" { s.logger.Infof("missing client_secret on token request for client: %s", client.ID) } else { diff --git a/server/server.go b/server/server.go index 167dfb9a..84c3a82f 100644 --- a/server/server.go +++ b/server/server.go @@ -204,6 +204,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy) if c.Storage == nil { return nil, errors.New("server: storage cannot be nil") } + if len(c.SupportedResponseTypes) == 0 { c.SupportedResponseTypes = []string{responseTypeCode} }