Skip to content

Feature request: Add an option to include a generic Network Security Configuration file to the output APK #1622

Description

@raulsiles

It would be very useful to have a setting to (optionally) include a generic Network Security Configuration file available in Android 7.x (Nougat) no any new APK that is rebuild through apktool (specially with a target SDK version of Android 7.x, or API level 24).

The new feature should allow adding a permissive default network_security_config.xml file that allows intercepting all HTTPS traffic generated by the app accepting both system and user imported CAs, or even allow adding a custom XML file provided by the user.

See: https://developer.android.com/training/articles/security-config.html

Suggested default file for: res/xml/network_security_config.xml

<network-security-config>  
      <base-config>  
            <trust-anchors>  
                <!-- Trust system preinstalled CAs -->  
                <certificates src="system" />  
                <!-- Add trust for user imported CAs -->  
                <certificates src="user" />  
           </trust-anchors>  
      </base-config>  
 </network-security-config>

The suggested option would be similar to the current "apktool build -d" option, that sets the "android:debuggable" to "true" in the AndroidManifest.xml file.

The new suggested option could be:

usage: apktool [-q|--quiet OR -v|--verbose] b[uild] [options] <app_path>
...
 -n,--net-sec-conf    Adds a generic Network Security Configuration file in the output APK
...

The addition of a new Network Security Configuration file requires adding the new "res/xml/network_security_config.xml" to the app APK, as well as referencing it from the AndroidManifest.xml file:

<application ...
android:networkSecurityConfig="@xml/network_security_config">

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions