Define new NetworkSecurityConfig for localhost
Some default settings for network security config such as cleartextTrafficPermitted make no sense for localhost connections. Define a default localhost NetworkSecurityConfig which is only applied if the application does not already define a NetworkSecurityConfig for localhost. An hostname is considered to be localhost if either: - The hostname is "localhost" or "ip6-localhost"; or - InetAddress.isLoopbackAddress() returns true Because of the size of the address space for what is considered localhost, instead of adding entries to the existing Set returned by getPerDomainConfigs(), a new method is added to ConfigSource: getLocalhostConfig(). Bug: 398997783 Test: atest CtsNetSecConfigLocalhostCleartextTestCases Test: atest CtsNetSecConfigLocalhostCleartextWithNscTestCases Test: atest CtsNetSecConfigLocalhostTlsTestCases Flag: com.android.org.conscrypt.net.flags.network_security_config_localhost Change-Id: I608ff46ea5c976976a1b466f39be69cedea3a00c
Loading
Please register or sign in to comment