Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan of Android network_security_config fails with multiple domain-configs #87

Open
olaf-a opened this issue Jun 25, 2024 · 3 comments
Open

Comments

@olaf-a
Copy link

olaf-a commented Jun 25, 2024

If the network_security_config file contains multiple domain-config blocks, the scan fails in the function clear_text_traffic_permitted

network_security_config.xml:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="false"/>

    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">domainA</domain>
    </domain-config>

    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">domainB</domain>
    </domain-config>

The scan fails with exception:

 * Error: 'list' object has no attribute 'get'  Traceback (most recent call last):
  File "mobsfenv/lib/python3.12/site-packages/mobsfscan/mobsfscan.py", line 110, in scan
    result['xml_checks'] = manifest.scan_manifest(
                           ^^^^^^^^^^^^^^^^^^^^^^^
  File "mobsfenv/lib/python3.12/site-packages/mobsfscan/manifest.py", line 77, in scan_manifest
    findings = do_checks(
               ^^^^^^^^^^
  File "mobsfenv/lib/python3.12/site-packages/mobsfscan/manifest.py", line 149, in do_checks
    nsc.network_security_checks(p)
  File "mobsfenv/lib/python3.12/site-packages/mobsfscan/manifest.py", line 284, in network_security_checks
    self.clear_text_traffic_permitted(domain_conf, typ)
  File "mobsfenv/lib/python3.12/site-packages/mobsfscan/manifest.py", line 228, in clear_text_traffic_permitted
    ctt = conf.get('@cleartextTrafficPermitted')

@olaf-a
Copy link
Author

olaf-a commented Jun 25, 2024

@ajinabraham
Copy link
Member

ajinabraham commented Jun 26, 2024

Can you share a valid sample network config file that replicates this issue?

@olaf-a
Copy link
Author

olaf-a commented Jun 27, 2024

The shared config is valid according to the linked documentation. A real config might have some extra stuff, but this is a minimal valid config that breaks the scanning.

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

No branches or pull requests

2 participants