Skip to content

android: Trust user-supplied CAs, except on known servers #474

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

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:networkSecurityConfig="@xml/network_security_config"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
Expand Down
29 changes: 29 additions & 0 deletions android/app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- For reference on this file's semantics:
https://developer.android.com/training/articles/security-config#FileFormat -->
<base-config>
<!-- If the user has configured additional CAs on the device, trust those
too. This can be useful for an internal Zulip server in a corporate
or institutional environment, and was a recurring user request:
https://github.com/zulip/zulip-mobile/issues/3312
https://github.com/zulip/zulip-flutter/issues/461 -->
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
<domain-config>
<!-- But revert to the default, stricter behavior — trusting only the
system CA list — where we know we can, which means for domains where
we know a legitimate cert will always come from a widely-trusted CA.
Specifically, we know this is the case for Zulip Cloud and other
domains operated by the core Zulip developers at Kandra Labs. -->
<domain includeSubdomains="true">zulipchat.com</domain>
<domain includeSubdomains="true">zulip.com</domain>
<domain includeSubdomains="true">zulip.org</domain>
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</domain-config>
</network-security-config>