Address some review feedback
This commit is contained in:
1 parent
296639e484
commit
8e71caa2e3
5 files changed
+7
-5
No files matched your search
@@ -5,6 +5,7 @@ package worker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/subtle"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -169,7 +170,7 @@ func (w *Worker) handleProxy(listenerCfg *listenerutil.ListenerConfig, sessionMa
|
||||
}
|
||||
|
||||
if sess.GetTofuToken() != "" {
|
||||
if sess.GetTofuToken() != handshake.GetTofuToken() {
|
||||
if subtle.ConstantTimeCompare([]byte(sess.GetTofuToken()), []byte(handshake.GetTofuToken())) != 1 {
|
||||
event.WriteError(ctx, op, stderrors.New("WARNING: mismatched tofu token"), event.WithInfo("session_id", sessionId))
|
||||
if err = conn.Close(websocket.StatusPolicyViolation, "tofu token not allowed"); err != nil {
|
||||
event.WriteError(ctx, op, err, event.WithInfoMsg("error closing client connection"))
|
||||
|
||||
Reference in new issue
Block a user