Repository navigation
Conversation
Signed-off-by: jpantonow <jpantonow@gmail.com>
Owner
|
skipping certificate checks is the whole point here. When that setting is off the default path should also be good already, no? |
Author
You're right — I re-checked: with the setting off, the connection already uses the platform socket factory and hostname verifier, and the trust-all context is only applied when the user opts in. The analysis flagged it because the context is built in the constructor regardless of the setting, but that isn't a problem in the default path. I'll close this; sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Affects
RESTMusicService.<init>inapp/src/main/java/github/paroj/dsub2000/service/RESTMusicService.java.I found that
RESTMusicServicebuilt an anonymous trust manager with empty certificate checks and passed it toSSLContext.init. It also installed a hostname verifier that accepted every hostname, which does not meet theSSLContextSpecusage rule requiring trust managers from aTrustManagerFactory.I replaced those components with trust managers initialized from the platform default trust store and the default hostname verifier. The existing HTTPS configuration path and public getters remain, but now return platform-validating components. If TLS-context initialization fails, the service retains the platform default socket factory and logs a warning.
I found this while running the app under RVSec, a runtime checker for how apps use the Java crypto and TLS APIs.
The project builds with this change (
:app:assembleFlossDebug).One thing to decide: with this change the "allow insecure connections" setting no longer skips certificate checks, so a server with a self-signed certificate will only connect if its certificate is installed on the device. If you'd rather keep that option working, I can limit the change to the default path. This follows up on #177.
I'm a Computer Engineering student at the University of Brasília (UnB), working on a research project on Android app analysis. Happy to adjust this to the project's conventions.