diff --git a/executor/show.go b/executor/show.go index d5c4b0a8d916d..03f694fc504e1 100644 --- a/executor/show.go +++ b/executor/show.go @@ -2023,10 +2023,8 @@ func (e *ShowExec) fetchShowSessionStates(ctx context.Context) error { var token *sessionstates.SessionToken // In testing, user may be nil. if user := e.ctx.GetSessionVars().User; user != nil { - // The token may be leaked without secure transport, so we enforce secure transport (TLS or Unix Socket). - if !e.ctx.GetSessionVars().ConnectionInfo.IsSecureTransport() { - return sessionstates.ErrCannotMigrateSession.GenWithStackByArgs("the token must be queried with secure transport") - } + // The token may be leaked without secure transport, but the cloud can ensure security in some situations, + // so we don't enforce secure connections. if token, err = sessionstates.CreateSessionToken(user.Username); err != nil { return err } diff --git a/server/conn_test.go b/server/conn_test.go index 3c6edcf30bba7..862c0acbda0fa 100644 --- a/server/conn_test.go +++ b/server/conn_test.go @@ -1442,8 +1442,7 @@ func TestAuthTokenPlugin(t *testing.T) { tk1 := testkit.NewTestKitWithSession(t, store, tc.Session) tc.Session.GetSessionVars().ConnectionInfo = cc.connectInfo() tk1.Session().Auth(&auth.UserIdentity{Username: "auth_session_token", Hostname: "localhost"}, nil, nil) - err = tk1.QueryToErr("show session_states") - require.ErrorContains(t, err, "secure transport") + tk1.MustQuery("show session_states") // create a token with TLS cc.tlsConn = &tls.Conn{}