From 7b0ea23b40fc2fb880fa24e42f963cb893110525 Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Thu, 20 Feb 2020 16:08:51 +0000 Subject: [PATCH] Require the connection to NS to be encrypted (unless in engineering mode) --- .../plugins/general/nsclient/services/NSClientService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.java index e1c57cc7c2..4c5b9f36bb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.java @@ -274,7 +274,7 @@ public class NSClientService extends Service { } else if (!nsEnabled) { RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "disabled")); RxBus.INSTANCE.send(new EventNSClientStatus("Disabled")); - } else if (!nsURL.equals("")) { + } else if (!nsURL.equals("") && (MainApp.engineeringMode || nsURL.toLowerCase().startsWith("https://"))) { try { RxBus.INSTANCE.send(new EventNSClientStatus("Connecting ...")); IO.Options opt = new IO.Options(); @@ -295,6 +295,9 @@ public class NSClientService extends Service { RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "Wrong URL syntax")); RxBus.INSTANCE.send(new EventNSClientStatus("Wrong URL syntax")); } + } else if (nsURL.toLowerCase().startsWith("http://")) { + RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "NS URL not encrypted")); + RxBus.INSTANCE.send(new EventNSClientStatus("Not encrypted")); } else { RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "No NS URL specified")); RxBus.INSTANCE.send(new EventNSClientStatus("Not configured"));