Repository navigation
fix(network): pin fixed hosts to system CAs and HTTPS - #840
Merged
Merged
Conversation
The base config trusts user-installed CAs and allows cleartext for every request, including API keys and downloads sent to fixed hosts. Custom AI endpoints are entered at runtime (Ollama, LM Studio, private CAs), so the base config stays open for them. Add a domain-config for the hosts the app contacts by itself (groq.com, googleapis.com, openai.com, huggingface.co, hf.co, github.com, githubusercontent.com, codeberg.org, google.com) that allows HTTPS only, with system CAs only. Debug builds keep user CAs. Suppress the two lint warnings for the base config with a reason.
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.
Summary
`network_security_config.xml` trusted user-installed CAs and allowed cleartext for all app traffic, including API keys and downloads sent to hosts the app contacts by itself. That config exists because custom AI endpoints are entered at runtime (Ollama, LM Studio, self-hosted servers, private CAs, see #175), so the base config has to stay open for them.
This adds a `domain-config` for the fixed hosts that allows HTTPS only and system CAs only:
`groq.com`, `googleapis.com`, `openai.com`, `huggingface.co`, `hf.co`, `github.com`, `githubusercontent.com`, `codeberg.org`, `google.com` (all with subdomains).
Behavior change
Users running HTTPS inspection with a user-installed CA (for example AdGuard) will see calls to the hosts above fail in release builds.
Verification (standard debug build, USB device)
With "Allow insecure connections" on, proofread against:
Not tested: rejection of a user CA on a pinned host (needs a CA installed on the device and a release build, debug builds trust user CAs).
`lintStandardDebug`: 0 errors, 195 warnings. Resource-only change, so CI does not trigger (path filter is `app/src/main/java**`).