summaryrefslogtreecommitdiff
path: root/app/src/insecure/java/se
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-02-11 13:25:24 +0100
committerFup Duck <fupduck@sacknagel.com>2018-02-11 13:28:43 +0100
commitca82cdf77ee4d30b820a1f936315c6c5be78359d (patch)
tree90f031e4b2603a8254d178317942e808adba6099 /app/src/insecure/java/se
parentdf4bf064a8c9310ed887d80bf6cd6328d1363f49 (diff)
8827 - discussion
* validate urls before changing anything in Provider.define() * save private key and vpn cert after login/signup
Diffstat (limited to 'app/src/insecure/java/se')
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
index d57dfe6d..1c5247c0 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
@@ -52,10 +52,12 @@ import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY;
import static se.leap.bitmaskclient.Constants.PROVIDER_KEY;
import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING;
+import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON;
import static se.leap.bitmaskclient.ProviderAPI.ERRORS;
import static se.leap.bitmaskclient.R.string.certificate_error;
import static se.leap.bitmaskclient.R.string.malformed_url;
import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert;
+import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_details;
/**
* Created by cyberta on 04.01.18.
@@ -145,7 +147,11 @@ public class ProviderApiManager extends ProviderApiManagerBase {
try {
JSONObject providerJson = new JSONObject(providerDotJsonString);
- provider.define(providerJson);
+ if (provider.define(providerJson)) {
+ result.putBoolean(BROADCAST_RESULT_KEY, true);
+ } else {
+ return setErrorResult(result, warning_corrupted_provider_details, ERROR_CORRUPTED_PROVIDER_JSON.toString());
+ }
result.putBoolean(BROADCAST_RESULT_KEY, true);
} catch (JSONException e) {