Skip to content

Use unsecure HTTP clients for debug builds #2885

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

Closed
wants to merge 2 commits into from

Conversation

maskaravivek
Copy link
Member

Description (required)

Fixes #2875

Beta build was working fine for me on API 24 but wasn't working on API 28.

What changes did you make and why?

The issue was related to SSL certificates of beta server not being recognized by Android. To fix it I have used unsecure HTTP clients for debug builds. Release builds will continue to work as it is. Just for debug builds, all certificates would be trusted and all hosts would be marked as verified.

Read up more here:

https://developer.android.com/training/articles/security-ssl#java

@dbrant It would be great if you could take a quick look and suggest if there's a cleaner way to do it?

Tests performed (required)

Tested betaDebug on API 28. Earlier none of the API calls were working but now everything works fine.

@codecov-io
Copy link

Codecov Report

Merging #2885 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2885      +/-   ##
=========================================
- Coverage    3.42%    3.4%   -0.02%     
=========================================
  Files         246     248       +2     
  Lines       12197   12261      +64     
  Branches     1072    1079       +7     
=========================================
  Hits          418     418              
- Misses      11748   11812      +64     
  Partials       31      31
Impacted Files Coverage Δ
.../java/fr/free/nrw/commons/di/NetworkingModule.java 0% <0%> (ø) ⬆️
...w/commons/mwapi/UnsecureKeyStoresTrustManager.java 0% <0%> (ø)
.../commons/mwapi/UnsecureApacheSSLSocketFactory.java 0% <0%> (ø)
...rw/commons/mwapi/ApacheHttpClientMediaWikiApi.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84637c5...faf26a8. Read the comment docs.

@dbrant
Copy link
Collaborator

dbrant commented Apr 17, 2019

I think a better solution would be to contact the Beta Cluster maintainers and fix the SSL certificates at the source. https://phabricator.wikimedia.org/T221171

Would you be able to pinpoint when exactly this started happening?

@misaochan
Copy link
Member

misaochan commented Apr 17, 2019

Would you be able to pinpoint when exactly this started happening?

Our first report was 1 week ago. Given that GSoC applicants have been very active during this period, I think it is safe to use that as an approximation.

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

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

Solves the issue for me.

@dbrant
Copy link
Collaborator

dbrant commented Apr 17, 2019

This should now be fixed on the Beta cluster. Please try again and let us know (on the phab ticket) if the issue has gone away.

@madhurgupta10
Copy link
Collaborator

@dbrant I tested the betaDebug latest master and it so working fine.

@maskaravivek
Copy link
Member Author

Thanks for testing the app @madhurgupta10. Closing the PR as the issue has been fixed at the source. Thank you @dbrant for your help. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network Error while Logging In
6 participants