Skip to content

fix(security): disable cleartext HTTP traffic by default#4813

Open
IvanBila wants to merge 1 commit into
dhis2:mainfrom
IvanBila:fix/disable-cleartext-traffic
Open

fix(security): disable cleartext HTTP traffic by default#4813
IvanBila wants to merge 1 commit into
dhis2:mainfrom
IvanBila:fix/disable-cleartext-traffic

Conversation

@IvanBila
Copy link
Copy Markdown

@IvanBila IvanBila commented Apr 20, 2026

Summary

Replaces android:usesCleartextTraffic="true" in AndroidManifest.xml with a Network Security Config that blocks cleartext HTTP by default. Adds app/src/main/res/xml/network_security_config.xml with cleartextTrafficPermitted="false" and system trust anchors.

Why

The app handles PHI/PII. The explicit usesCleartextTraffic="true" was overriding Android 9+'s secure default, exposing credentials and patient data to MITM attacks on any http:// DHIS2 instance.

Behavior change

  • HTTPS: unchanged
  • HTTP: blocked with java.io.IOException: Cleartext HTTP traffic to <host> not permitted
  • Need HTTP for a specific host? Add a per-host <domain-config cleartextTrafficPermitted="true"> — ideally via a debug manifest override, not globally.

Test plan

  • dhis2Debug against HTTPS server — login + sync work
  • dhis2Release, dhis2PlayServicesRelease, dhis2TrainingRelease build and install
  • HTTP instance is rejected (not transmitted in clear)
  • CI passes — any regression was relying on cleartext

@IvanBila IvanBila force-pushed the fix/disable-cleartext-traffic branch from 509662f to 07fa9d3 Compare April 20, 2026 12:19
Replaces the global android:usesCleartextTraffic="true" with a
network security config that denies cleartext by default. The app
handles PHI/PII and the previous manifest setting exposed credentials
and patient data to on-path attackers (rogue Wi-Fi, corporate proxies)
on any HTTP DHIS2 deployment.
@IvanBila IvanBila force-pushed the fix/disable-cleartext-traffic branch from 07fa9d3 to f7c964a Compare April 20, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant