← All articlesMobile applications

A Test CA for Android Debugging Only: Setup and Release Checks

A test certificate authority (CA) helps you test HTTPS connections in your own test environment. The developer’s task is to enable that trust in the debug build and verify that it has not carried over into the release. Seeing android:debuggable=false in a source file is not enough: you need to check the trust configuration, the final manifest, and the behavior of the built application. Below are a configuration and editorially proposed checks for a fictional project. They provide a verifiable release criterion for specific artifacts, rather than a general guarantee of application security.

Where the Trust Boundary Lies

Consider a fictional application called ‘Sample Catalog’ and the team’s own HTTPS test environment. The server returns only synthetic records, such as a sample with the identifier sample-17. For debugging, the team issues a server certificate from its own test CA. The requirement is simple: the debug build must accept this chain, and the release build must reject it, provided the release has no other source of trust for this CA.

The boundary here is the set of certificate authorities permitted to authenticate the server for the application. We are specifically checking trust in the test CA. Server availability or receiving any HTTP response does not, by itself, prove that the settings meet the release criterion.

Place the Test CA in debug-overrides

The application manifest must reference the Network Security Configuration XML file. In the documented example, this is the android:networkSecurityConfig attribute on the application element, with the value @xml/network_security_config. Check that the reference points to the configuration you intend to use.

Within the configuration, place the test CA in trust-anchors nested inside debug-overrides. The certificates element must reference a prepared raw resource, such as @raw/debug_cas. Certificates in this resource must use DER or PEM format; PEM must not contain extraneous data, including comments.

Proposed editorial check: trace every trust source used by the release and ensure that the same test CA has not also been added to base-config, domain-config, or another source. If it is independently available to the release, placing it correctly inside debug-overrides is insufficient.

What android:debuggable Controls

When android:debuggable=false, the debug-overrides section is ignored entirely. The documentation therefore requires this flag to be set to false for release. However, ignoring one section does not automatically mean the CA is untrusted throughout the configuration: the outcome also depends on the other trust sources.

Debug trust anchors are added to the other configurations. There is also a significant limitation when interpreting results: certificate pinning is not performed when the server chain uses one of these debug trust anchors. If the application uses pinning, a successful debug connection through the test CA does not confirm that pinning works in the release. Record the CA trust check and the pinning check as separate results.

Check the Merged Manifest

Gradle merges manifests into a single manifest included in the application. Build settings in build.gradle override the corresponding attributes in the merged manifest. Checking only the source AndroidManifest.xml therefore does not complete the task.

For the selected debug and release variants, open Merged Manifest in Android Studio: this view shows the merge result and information about the contributing manifests. As part of the proposed editorial check, record the final android:networkSecurityConfig reference and android:debuggable value. For the comparison described here, the expected values are true for debug and false for release. Save these values alongside the identifiers of the built artifacts so that subsequent results relate to specific builds.

Compare Builds in Your Own HTTPS Test Environment

The next step is an original editorial test, rather than an official Android procedure. Configure your own server with a certificate valid for the test hostname and issued by your test CA. First verify that the release should not trust this CA through other sources. Use fictional data only.

Send the same request from both verified builds through the application’s normal network path. Expected result: debug successfully retrieves the intended synthetic record sample-17, while release rejects the connection because certificate trust validation fails. Record the reason for rejection: an unavailable server or an arbitrary network error does not confirm that the CA is untrusted.

A read operation is sufficient for this example. Check the expected response content, rather than just the HTTP status code. If your own scenario involves modifying data, separately verify the resulting state in the test environment: a successful response alone does not prove that the change was accepted or rejected.

Add a Positive Control and a Release Criterion

The second proposed editorial check uses the same test environment you own, with a valid certificate and chain supported by the normal trust configuration of both builds. Expect a successful request and the intended synthetic response from both debug and release. This control lets you compare the release rejection in the previous test with a working normal connection.

Consider the release criterion met only when all results are present: the final release settings have been checked, the test CA is accepted in debug and rejected in release specifically because it is untrusted, and the positive control passes in both builds. The conclusion applies to the tested artifacts and network path. It is not a statistical assessment of the security of the entire application.

What to Fix First

If results differ from expectations, first correct the release’s final android:debuggable value and the reference to the intended configuration. Then remove additional sources of trust in the test CA from the release, and check the resource location and format. After making corrections, repeat the comparison and positive control with new artifacts and retain the results.

You can request a free CheckMyApp audit for your website or the web component of your product. The Android checks described here remain a separate task for the release team: an audit of the web component does not verify the certificate trust settings of a mobile build.

Sources and documentation

  1. Network security configuration
  2. Merge multiple manifest files
  3. android:debuggable
CheckMyApp

Check your application’s security.

Enter your web application address and email. Get a free preliminary report and choose the depth of analysis.

Check for free