Use MIXED_CONTENT_COMPATIBILITY_MODE in WebView setup#450
Open
jim-daf wants to merge 1 commit into
Open
Conversation
Six WebView setups in TMessagesProj called
setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW)
across:
- ArticleViewer (Instant View renderer)
- PaymentFormActivity (2 occurrences -- payment form + 3DS step)
- WebviewActivity (link preview WebView)
- Components/EmbedBottomSheet (iframe embeds)
- Components/PhotoViewerWebView (YouTube and similar embeds)
ALWAYS_ALLOW lets an https page in the WebView load every kind of
http sub-resource, including remote scripts. The WebSettings
javadoc treats it as the strictly less-safe choice. For
PaymentFormActivity the WebView renders payment-provider HTML and
the 3DS challenge, both of which should refuse http sub-resources
over an https origin on principle.
Replace with COMPATIBILITY_MODE, which keeps passive sub-resources
(images, fonts) loading on https pages while blocking active mixed
content like remote scripts. This is how Chrome treats mixed content
in the address bar and is the right default for the four embed and
preview surfaces. The change is a single-token swap per call site
and does not touch any other WebView setting.
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.
Closes #449.
Six WebView setups in
TMessagesProjcallsetMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW):ArticleViewer.java(Instant View renderer)PaymentFormActivity.java(2 occurrences: payment form + 3DS step)WebviewActivity.java(in-app link WebView)Components/EmbedBottomSheet.java(iframe embeds)Components/PhotoViewerWebView.java(YouTube and similar embeds)MIXED_CONTENT_ALWAYS_ALLOWlets an https page in the WebView load every kind of http sub-resource, including remote scripts. TheWebSettingsjavadoc treats it as the strictly less safe choice.PaymentFormActivityis the most exposed of the six. Its WebView renders the payment provider HTML and the 3DS challenge, both of which should refuse http sub-resources over an https origin on principle.Change
Replace
MIXED_CONTENT_ALWAYS_ALLOWwithMIXED_CONTENT_COMPATIBILITY_MODEon all six call sites.COMPATIBILITY_MODEkeeps passive sub-resources (images, fonts) loading on https pages while blocking active mixed content like remote scripts. This matches how Chrome treats mixed content in the address bar.The change is a single-token swap per call site and does not touch any other WebView setting. Embedded media that legitimately references http images on https pages continues to render.