cordova-plugin-wkwebview-engine icon indicating copy to clipboard operation
cordova-plugin-wkwebview-engine copied to clipboard

(ios) Add pref to accept untrusted certificates

Open Ju-NXH opened this issue 4 years ago • 3 comments

Platforms affected

iOS

Motivation and Context

This change adds the ability to accept untrusted certificates (self-signed certificates for instance) thanks to a new preference in the config.xml file. It was needed because our development team test our mobile app along with a server instance hosted on their workstation, and this local instance uses self-signed certificates.

Description

With this feature, you don't need to do anything on the device to be able to access web resources hosted on a server that uses self-signed certificates. To make a device accept or reject untrusted certificates, a new preference needs to be defined in the config.xml file (see README). Then, the corresponding Objective-C code controlled by the preference intercepts the HTTPS request right when iOS evaluates the certificate and dynamically adds an exception so that all certificates get accepted.

Testing

This feature was tested with our mobile app. Setting the AllowUntrustedCerts preference to true for our debug builds allows us to access HTTPS resources hosted on a web server that uses self-signed certificates, setting it to false prevents us from doing so.

Checklist

I have no prior Objective-C experience so I could use some help in case new tests are needed.

  • [x] I've run the tests to see all existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [x] I've updated the documentation if necessary

Ju-NXH avatar Dec 23 '20 17:12 Ju-NXH

Hi, would there be someone available to review this PR? @erisu @timbru31 @breautek

Ju-NXH avatar Jan 06 '21 22:01 Ju-NXH

Hi, would there be someone available to review this PR? @erisu @timbru31 @breautek

Thank you for this PR, however I'm not sure if this will ever actually be released.

Pending an official vote -- this plugin is going to be deprecated. Apple enforces WKWebView now, so it is implemented in the core platform as of cordova-ios@6; making this plugin obsolete moving forward.

Something like this might be better to be implemented in the core cordova-ios package.

breautek avatar Jan 17 '21 22:01 breautek

Makes sense, thank you @breautek. I created this PR because we're still using [email protected] along with this plugin for now. I'll try to port this feature to cordova-ios@6 when we'll upgrade our app to use it, and I'll create another PR for cordova-ios then.

Ju-NXH avatar Jan 18 '21 15:01 Ju-NXH

We are archiving this repository following Apache Cordova's Deprecation Policy. We will not continue to work on this repository. Therefore all issues and pull requests are being closed. Thanks for your contribution.

jcesarmobile avatar Jan 08 '23 23:01 jcesarmobile