danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.39k stars 2.43k forks source link

SSL Checker allowedfingerprint accepting only string #4788

Open sajid-robo opened 3 weeks ago

sajid-robo commented 3 weeks ago

I'm submitting a ... (check one with "x")

Current behaviour: Currently the SSLChecker plugin is accepting allowedFingerprints as a string

Expected behaviour: As per the Plugin Native implementation it will accept JSONArray. I will paste the below code for your reference. Please refer the highlighted code section below

Steps to reproduce: Please refer the highlighted line

Related code: public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException { if (ACTION_CHECKEVENT.equals(action)) { cordova.getThreadPool().execute(new Runnable() { public void run() { try { final String serverURL = args.getString(0); **final JSONArray allowedFingerprints = args.getJSONArray(2);_** final String serverCertFingerprint = getFingerprint(serverURL); for (int j=0; j<allowedFingerprints.length(); j++) { if (allowedFingerprints.get(j).toString().equalsIgnoreCase(serverCertFingerprint)) { callbackContext.success("CONNECTION_SECURE"); return; } } callbackContext.error("CONNECTION_NOT_SECURE"); } catch (Exception e) { callbackContext.error("CONNECTION_FAILED"); //callbackContext.error("CONNECTION_FAILED. Details: " + e.getMessage()); } } }); return true; } else { callbackContext.error("sslCertificateChecker." + action + " is not a supported function. Did you mean '" + ACTION_CHECK_EVENT + "'?"); return false; } }

Other information: https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin/blob/master/src/android/nl/xservices/plugins/SSLCertificateChecker.java

maniya108 commented 3 weeks ago

Hi, I am faced the same issue. Kindly assist the above issue. Thanks in advance

maniya108 commented 2 weeks ago

Hi @danielsogl kindly help us to resolve the above issue