Filter legacy TLS protocols without pinning TLS versions - #301
Open
jpantonow wants to merge 2 commits into
Open
Conversation
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.
What does this implement/fix?
buildcom.etesync.syncadapter.HttpClient$Builderapp/src/main/java/com/etesync/syncadapter/HttpClient.ktSSLContextSpecapeSummary
Observed dynamic-analysis failure
The dynamic-analysis run by
apereported (SSLContextSpec) while exercisingcom.etesync.syncadapter.HttpClient$Builder.build:Root cause
A source-level literal whitelist mismatch is confirmed: HttpClient.Builder.build creates an SSLContext with the generic algorithm literal "TLS", rather than either listed literal "TLSv1.2" or "TLSv1.3". This confirms the bounded detector predicate mismatch, but does not establish that legacy TLS is enabled or negotiated at runtime.
Correction strategy
Retain SSLContext("TLS") and begin with each provider-created socket's enabled-protocol set. Remove only explicit legacy SSL and TLSv1/TLSv1.0/TLSv1.1 names, retain recognized and unknown non-legacy future protocol names, never enable provider-disabled protocols, and fail closed if no acceptable protocol remains.
Coordinated changes
app/src/main/java/com/etesync/syncadapter/HttpClient.kt: Provides a top-level internal, non-reflective test seam and an internal delegating SSLSocketFactory. Each createSocket overload configures only the newly created socket, filtering its current provider-enabled protocol list in order. The helper removes all SSL-prefixed names and exactly TLSv1, TLSv1.0, and TLSv1.1, retains all other provider-enabled names, and throws SSLException before any enabledProtocols assignment when no acceptable protocol remains.; Retains the generic TLS SSLContext and its existing key-manager/trust-manager initialization, but installs the filtering wrapper as the socket factory. The same selected trustManager remains the second sslSocketFactory argument, and the existing hostnameVerifier wiring is unchanged.app/src/androidTest/java/com/etesync/syncadapter/HttpClientProtocolFilterTest.kt: Exercises the top-level internal filterEnabledTlsProtocols seam supplied by the coordinated HttpClient.kt edit. The first test verifies removal of SSL-prefixed names and TLSv1/TLSv1.0/TLSv1.1, preservation of TLSv1.2, TLSv1.3, and an unknown future TLSv1.4 name in provider order, and confirms that no absent provider protocol is introduced. The second test verifies that an all-legacy input fails with SSLException rather than yielding an empty or broadened enabled-protocol configuration.Verification included
Residual review requirements
The patch remains review-only until these assumptions are confirmed:
How was this tested?
:app:assembleDebugAndroidTest)Reviewer notes
Do not merge until these assumptions and blockers are resolved:
Additional context
I’m an undergraduate Computer Engineering student at the University of Brasília (UnB), and this contribution is part of a research project involving software security analysis.
I’m happy to adjust the implementation to better match the project’s architecture, coding conventions, or maintainers’ recommendations.