Skip to content
Snippets Groups Projects
Commit 06f9adeb authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

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

parent 6cabd964
No related branches found
No related tags found
1 merge request!2027Websockets
Pipeline #535262 passed with stages
in 21 minutes and 5 seconds
......@@ -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@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)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment