Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-292 android: SSL errors handling in Android #293

Merged
merged 2 commits into from
May 8, 2020

Conversation

nicolashenry
Copy link
Contributor

Platforms affected

Android

What does this PR do?

Fix #292

What testing has been done on this change?

I tested on my company website which currently have a chaining certificate issue (it should be fixed soon).
Maybe it should be done on all platforms but our certificate issue only occurs on Android (iOS does not care about this problem).

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) SSL errors handling in Android", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

@janpio
Copy link
Member

janpio commented Sep 4, 2018

Ok I see this adds some handling of the error. What happens with the message then?

@nicolashenry
Copy link
Contributor Author

Before the change, the events came like this :

{type: "loadstart", url: "https://ourdomain.com/"}
{type: "loadstop", url: "https://ourdomain.com/"}

After :

{type: "loadstart", url: "https://ourdomain.com/"}
{type: "loaderror", url: "https://ourdomain.com/", code: 0, sslerror: 3, message: "The certificate authority is not trusted"}
{type: "loadstop", url: "https://ourdomain.com/"}

The handler.cancel(); is just here to ensure that the connection will not be processed (the default behaviour is to cancel it anyway so the 'super' call is probably already doing it).

I am not sure about what should the loaderror should have as message, I just copied description from the constants here : https://developer.android.com/reference/android/net/http/SslError

@janpio
Copy link
Member

janpio commented Sep 5, 2018

Ah ok, so the PR makes sure the error is not just swallowed but bubbles up to the web app and can be handled there?

@nicolashenry
Copy link
Contributor Author

Yes, exactly.

@nicolashenry
Copy link
Contributor Author

I don't know why travis build is failing, the tests seem ok when I run them myself :

screenshot_20180917-125026_hellocordova

@janpio
Copy link
Member

janpio commented Sep 17, 2018

Very possible this is unrelated, someone will look into this (either by fixing the flaky tests in general or by giving your PR the thumbs-up anyway) in the future. I am not sure enough to do so myself, so we'll have to wait for another maintainer.

@nicolashenry
Copy link
Contributor Author

nicolashenry commented Oct 25, 2018

@janpio I noticed that onReceivedError is not called on http error with Android SDK >= 23 (so loaderror is never triggered for errors which are not ssl error) because onReceivedHttpError should be used instead. Should I create another issue/PR for that?

@janpio
Copy link
Member

janpio commented Oct 30, 2018

Yes please @nicolashenry - sounds not directly related, so another PR would make it much easier to review. Thanks!

@mtsibulski
Copy link

I would really like to see this merged please. I am trying to upload an app to Google and they sent me an email about a SSL Error Handler vulnerability and a deadline to fix it. Here is a help center article they provided: https://support.google.com/faqs/answer/7071387
There's a chance that Google may be warning or rejecting more apps going forward :/

@breautek
Copy link
Contributor

breautek commented May 6, 2020

I would really like to see this merged please. I am trying to upload an app to Google and they sent me an email about a SSL Error Handler vulnerability and a deadline to fix it. Here is a help center article they provided: https://support.google.com/faqs/answer/7071387
There's a chance that Google may be warning or rejecting more apps going forward :/

Thanks for bringing attention to this issue. I'll review/test this tonight.

@janpio I know it's been awhile since you approved this PR. Do you think you're approval still stands?

Copy link

@jclarkAtTillster jclarkAtTillster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to getting this update in.

@timbru31
Copy link
Member

timbru31 commented May 6, 2020

We've had this bug, too, due to a mis-configured Apache webserver - so the PR definitely solves an issue. 👍

@breautek for retesting: Have a webserver with an invalid/incomplete chain.

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I do think we should remove the deprecated constant that @timbru31 pointed out.

@nicolashenry
Copy link
Contributor Author

I removed the deprecated constant 👍

@breautek breautek requested a review from timbru31 May 7, 2020 16:20
@timbru31 timbru31 merged commit 8aaae5b into apache:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSL errors handling in Android
6 participants