You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<base-config> in Network Security Configuration for Android is not honoured & fatal crash when using IP addresses as <domain> #65841
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-configcleartextTrafficPermitted="true"/>
<domain-configcleartextTrafficPermitted="false">
<!-- List the domains for which you want ensure HTTPS traffic -->
<domain>secure.example.com</domain>
<domain>dev.example.com</domain>
</domain-config>
</network-security-config>
Expected results:
All the domains & IPs expect example.com & dev.example.com should be allowed to have http scheme.
Actual results: Insecure socket connections are disallowed by platform: for all domains & IPs
B) Fatal Crash when setting IP addresses as <domain>
Update network_security_config.xml as
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-configcleartextTrafficPermitted="false"/>
<domain-configcleartextTrafficPermitted="true">
<!-- List the domains for which you want opt out ensuring HTTPS traffic -->
<domain>10.0.2.2</domain>
<domain>insecure.example.com</domain>
</domain-config>
</network-security-config>
changed the title [-]Network Security Configuration in Android is not honouring <base-config> and fatal crash when using IP addresses as <domain>[/-][+]<base-config> in Network Security Configuration for Android is not honoured and fatal crash when using IP addresses as <domain>[/+]on Sep 15, 2020
changed the title [-]<base-config> in Network Security Configuration for Android is not honoured and fatal crash when using IP addresses as <domain>[/-][+]<base-config> in Network Security Configuration for Android is not honoured & fatal crash when using IP addresses as <domain>[/+]on Sep 15, 2020
Hi @sarbagyastha
Can you please provide your flutter doctor -v, your flutter run --verbose and a minimal complete reproducible code sample and clear steps in how to reproduce this issue?
Thank you
I don't think so. I'm part of the triage team and without knowing much about the engine I should be able to reproduce the issue from the steps provided by the author.
For example I'm not sure where to add network_security_config.xml in a Flutter project an where to do this:
Rejecting IP addresses was a deliberate decision. Android documentation does not ban IP addresses but does not explicitly permit them either. Android also has odd behavior where it is possible to include sub-domains of an IP address which does not make sense. iOS documentation specifically mentions not to use IP addresses:
Rejecting IP addresses was a deliberate decision. Android documentation does not ban IP addresses but does not explicitly permit them either. Android also has odd behavior where it is possible to include sub-domains of an IP address which does not make sense. iOS documentation specifically mentions not to use IP addresses
@mehmetf iOS has NSAllowsLocalNetworking to enable local IPs though. But how are we going to do the same in Android, if IP addresses are being rejected ?
Let's say I want to permit clear-text traffic only for selected local IPs but enforce https on all domain names. How can i achieve that ?
This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This issue is assigned to @mehmetf but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This issue was assigned to @mehmetf but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
Activity
sarbagyastha commentedon Sep 15, 2020
/cc @mehmetf
[-]Network Security Configuration in Android is not honouring <base-config> and fatal crash when using IP addresses as <domain>[/-][+]<base-config> in Network Security Configuration for Android is not honoured and fatal crash when using IP addresses as <domain>[/+][-]<base-config> in Network Security Configuration for Android is not honoured and fatal crash when using IP addresses as <domain>[/-][+]<base-config> in Network Security Configuration for Android is not honoured & fatal crash when using IP addresses as <domain>[/+]pedromassangocode commentedon Sep 15, 2020
Hi @sarbagyastha
Can you please provide your
flutter doctor -v, yourflutter run --verboseand a minimal complete reproducible code sample and clear steps in how to reproduce this issue?Thank you
sarbagyastha commentedon Sep 15, 2020
@pedromassango I guess the information provided above should be enough as the issue is not at my side, but at the engine itself.
pedromassangocode commentedon Sep 15, 2020
I don't think so. I'm part of the triage team and without knowing much about the engine I should be able to reproduce the issue from the steps provided by the author.
For example I'm not sure where to add
network_security_config.xmlin a Flutter project an where to do this:Please provide your
flutter run --verboseand a minimal complete reproducible code sample and clear steps in how to reproduce this issue?Thank you
sarbagyastha commentedon Sep 15, 2020
@pedromassangocode Here the link to the repo with reproducible example
The configuration xml can be found here.
Url can be set from here.
And here is the
flutter doctor -voutput:mehmetf commentedon Sep 15, 2020
<base-config>is not being handled today. That is an issue and we will fix it. For now, you can use https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic to set global policy.Rejecting IP addresses was a deliberate decision. Android documentation does not ban IP addresses but does not explicitly permit them either. Android also has odd behavior where it is possible to include sub-domains of an IP address which does not make sense. iOS documentation specifically mentions not to use IP addresses:
sarbagyastha commentedon Sep 15, 2020
@mehmetf iOS has
NSAllowsLocalNetworkingto enable local IPs though. But how are we going to do the same in Android, if IP addresses are being rejected ?Let's say I want to permit clear-text traffic only for selected local IPs but enforce https on all domain names. How can i achieve that ?
18 remaining items
flutter-triage-bot commentedon Jul 8, 2023
This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
flutter-triage-bot commentedon Nov 25, 2023
This issue is assigned to @mehmetf but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
flutter-triage-bot commentedon Feb 7, 2024
This issue was assigned to @mehmetf but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
aggeloskoutanis commentedon Mar 4, 2025
fix(android): honor <base-config> and allow IP addresses in NetworkSe…
fix(android): honor <base-config> and allow IP addresses in NetworkSe…