|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""Harden a prepared NuvioMobile Android device-test workspace. |
| 2 | +"""Harden a prepared NuvioMobile Android device-test workspace for test execution only. |
3 | 3 |
|
4 | | -The native lab preparation intentionally modifies a pinned upstream checkout. |
5 | | -This helper keeps infrastructure-only Android requirements in one place: |
6 | | -- resolve duplicate libc++_shared.so packaging in instrumentation APKs; |
7 | | -- disable Sentry auto-init in the test process so no DSN is required; |
8 | | -- enable host-served local_candidate HTTP only for the instrumentation APK. |
9 | | -
|
10 | | -It is idempotent and tolerant of whitespace changes in the prepared Gradle block. |
| 4 | +This helper may resolve build/test-process requirements (duplicate libc++ packaging and |
| 5 | +Sentry auto-init) but it must never relax playback/network policy. The human UX reader |
| 6 | +lab inherits the accepted Nuvio application's production transport conditions exactly. |
11 | 7 | """ |
12 | 8 | from __future__ import annotations |
13 | 9 |
|
14 | 10 | import argparse |
15 | 11 | import re |
16 | 12 | from pathlib import Path |
17 | 13 |
|
18 | | -from configure_native_android_lab_transport import configure_manifest |
| 14 | +from configure_native_android_lab_transport import validate_manifest |
19 | 15 |
|
20 | 16 |
|
21 | 17 | def harden(repo: Path) -> None: |
@@ -62,14 +58,16 @@ def harden(repo: Path) -> None: |
62 | 58 | ''', |
63 | 59 | encoding="utf-8", |
64 | 60 | ) |
65 | | - configure_manifest(test_manifest) |
| 61 | + validate_manifest(test_manifest) |
66 | 62 |
|
67 | 63 | final = build.read_text(encoding="utf-8") |
68 | 64 | if final.count(packaging_line) != 1: |
69 | 65 | raise SystemExit( |
70 | 66 | f"unexpected libc++ shared packaging rule count={final.count(packaging_line)}" |
71 | 67 | ) |
72 | | - print("NuvioMobile device-test hardening applied") |
| 68 | + if "usesCleartextTraffic" in test_manifest.read_text(encoding="utf-8"): |
| 69 | + raise SystemExit("device-test hardening must not relax Android cleartext policy") |
| 70 | + print("NuvioMobile device-test build hardening applied; playback network policy unchanged") |
73 | 71 |
|
74 | 72 |
|
75 | 73 | def main() -> int: |
|
0 commit comments