[Android] Remote access: prevent closing websockets when last message is not authenticated

Nicolas Pomepuy git at videolan.org
Thu Nov 14 17:26:16 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Nov 14 10:32:11 2024 +0100| [06f9adebc68b60fd1dbe09a66c69d9633f47f76e] | committer: Nicolas Pomepuy

Remote access: prevent closing websockets when last message is not authenticated

> https://code.videolan.org/videolan/vlc-android/commit/06f9adebc68b60fd1dbe09a66c69d9633f47f76e
---

 .../videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
index a576a2931c..aa355b2912 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
@@ -71,12 +71,12 @@ object RemoteAccessWebSockets {
                     val gson = Gson()
                     val incomingMessage = gson.fromJson(message, WSIncomingMessage::class.java)
                     if (BuildConfig.DEBUG) Log.i(TAG, "Received: $message")
-                    if (!BuildConfig.VLC_REMOTE_ACCESS_DEBUG && !verifyWebsocketAuth(incomingMessage)) {
+                    if (!verifyWebsocketAuth(incomingMessage)) {
                         send(Frame.Text(Gson().toJson(RemoteAccessServer.WebSocketAuthorization("forbidden", initialMessage = message))))
-                        return at webSocket
+                    } else {
+                        val service = RemoteAccessServer.getInstance(context).service
+                        manageIncomingMessages(incomingMessage, settings, service, context)
                     }
-                    val service = RemoteAccessServer.getInstance(context).service
-                    manageIncomingMessages(incomingMessage, settings, service, context)
                 } catch (e: Exception) {
                     Log.e(TAG, e.message, e)
                 }



More information about the Android mailing list