mobileguard 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mobileguard-1.0.0/LICENSE +172 -0
- mobileguard-1.0.0/PKG-INFO +384 -0
- mobileguard-1.0.0/README.md +346 -0
- mobileguard-1.0.0/mobileguard/__init__.py +52 -0
- mobileguard-1.0.0/mobileguard/audit.py +297 -0
- mobileguard-1.0.0/mobileguard/cli.py +826 -0
- mobileguard-1.0.0/mobileguard/contract.py +122 -0
- mobileguard-1.0.0/mobileguard/detectors/__init__.py +21 -0
- mobileguard-1.0.0/mobileguard/detectors/dart.py +270 -0
- mobileguard-1.0.0/mobileguard/detectors/javascript.py +292 -0
- mobileguard-1.0.0/mobileguard/detectors/kotlin.py +289 -0
- mobileguard-1.0.0/mobileguard/detectors/swift.py +357 -0
- mobileguard-1.0.0/mobileguard/llm.py +217 -0
- mobileguard-1.0.0/mobileguard/models.py +142 -0
- mobileguard-1.0.0/mobileguard/rules/__init__.py +34 -0
- mobileguard-1.0.0/mobileguard/rules/app_store.py +82 -0
- mobileguard-1.0.0/mobileguard/rules/eu_ai_act.py +72 -0
- mobileguard-1.0.0/mobileguard/rules/google_play.py +83 -0
- mobileguard-1.0.0/mobileguard/rules/owasp_mobile.py +89 -0
- mobileguard-1.0.0/mobileguard/scanner.py +242 -0
- mobileguard-1.0.0/mobileguard/tier.py +234 -0
- mobileguard-1.0.0/mobileguard.egg-info/PKG-INFO +384 -0
- mobileguard-1.0.0/mobileguard.egg-info/SOURCES.txt +33 -0
- mobileguard-1.0.0/mobileguard.egg-info/dependency_links.txt +1 -0
- mobileguard-1.0.0/mobileguard.egg-info/entry_points.txt +2 -0
- mobileguard-1.0.0/mobileguard.egg-info/requires.txt +13 -0
- mobileguard-1.0.0/mobileguard.egg-info/top_level.txt +1 -0
- mobileguard-1.0.0/pyproject.toml +105 -0
- mobileguard-1.0.0/setup.cfg +4 -0
- mobileguard-1.0.0/tests/test_audit.py +194 -0
- mobileguard-1.0.0/tests/test_cli.py +370 -0
- mobileguard-1.0.0/tests/test_contract.py +50 -0
- mobileguard-1.0.0/tests/test_rules.py +224 -0
- mobileguard-1.0.0/tests/test_scanner.py +206 -0
- mobileguard-1.0.0/tests/test_tier.py +223 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
+
or written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
55
|
+
improving the Work, but excluding communication that is conspicuously
|
|
56
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
57
|
+
Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combination of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a cross-claim
|
|
80
|
+
or counterclaim in a lawsuit) alleging that the Work or any patent
|
|
81
|
+
claim(s) embodied in the Work constitute direct or contributory patent
|
|
82
|
+
infringement, then any patent licenses granted to You under this License
|
|
83
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
84
|
+
|
|
85
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
86
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
87
|
+
modifications, and in Source or Object form, provided that You
|
|
88
|
+
meet the following conditions:
|
|
89
|
+
|
|
90
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
91
|
+
Works a copy of this License; and
|
|
92
|
+
|
|
93
|
+
(b) You must cause any modified files to carry prominent notices
|
|
94
|
+
stating that You changed the files; and
|
|
95
|
+
|
|
96
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
97
|
+
that You distribute, all copyright, patent, trademark, and
|
|
98
|
+
attribution notices from the Source form of the Work,
|
|
99
|
+
excluding those notices that do not pertain to any part of
|
|
100
|
+
the Derivative Works; and
|
|
101
|
+
|
|
102
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
103
|
+
distribution, You must include a readable copy of the
|
|
104
|
+
attribution notices contained within such NOTICE file, in
|
|
105
|
+
at least one of the following places: within a NOTICE text
|
|
106
|
+
file distributed as part of the Derivative Works; within
|
|
107
|
+
the Source form or documentation, if provided along with the
|
|
108
|
+
Derivative Works; or, within a display generated by the
|
|
109
|
+
Derivative Works, if and wherever such third-party notices
|
|
110
|
+
normally appear. The contents of the NOTICE file are for
|
|
111
|
+
informational purposes only and do not modify the License.
|
|
112
|
+
You may add Your own attribution notices within Derivative
|
|
113
|
+
Works that You distribute, alongside or in addition to the
|
|
114
|
+
NOTICE text from the Work, provided that such additional
|
|
115
|
+
attribution notices cannot be construed as modifying the License.
|
|
116
|
+
|
|
117
|
+
You may add Your own license statement for Your modifications and
|
|
118
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
119
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
120
|
+
Derivative Works, as separate terms and conditions for such
|
|
121
|
+
Derivative Works.
|
|
122
|
+
|
|
123
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
124
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
125
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
126
|
+
this License, without any additional terms or conditions.
|
|
127
|
+
|
|
128
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
129
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
130
|
+
except as required for reasonable and customary use in describing the
|
|
131
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
132
|
+
|
|
133
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
134
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
135
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
136
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
137
|
+
implied, including, without limitation, any warranties or conditions
|
|
138
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
139
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
140
|
+
appropriateness of using or reproducing the Work and assume any
|
|
141
|
+
risks associated with Your exercise of permissions under this License.
|
|
142
|
+
|
|
143
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
144
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
145
|
+
unless required by applicable law (such as deliberate and grossly
|
|
146
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
147
|
+
liable to You for damages, including any direct, indirect, special,
|
|
148
|
+
incidental, or exemplary damages of any character arising as a result
|
|
149
|
+
of this License or out of the use or inability to use the Work.
|
|
150
|
+
|
|
151
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
152
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
153
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
154
|
+
or other liability obligations and/or rights consistent with this
|
|
155
|
+
License. However, in accepting such obligations, You may offer only
|
|
156
|
+
conditions consistent with this License.
|
|
157
|
+
|
|
158
|
+
END OF TERMS AND CONDITIONS
|
|
159
|
+
|
|
160
|
+
Copyright 2026 Jaspreet Singh
|
|
161
|
+
|
|
162
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
163
|
+
you may not use this file except in compliance with the License.
|
|
164
|
+
You may obtain a copy of the License at
|
|
165
|
+
|
|
166
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
167
|
+
|
|
168
|
+
Unless required by applicable law or agreed to in writing, software
|
|
169
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
170
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
171
|
+
See the License for the specific language governing permissions and
|
|
172
|
+
limitations under the License.
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mobileguard
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI governance for consumer mobile platforms — prevents App Store and Google Play rejections caused by AI-generated code
|
|
5
|
+
Author-email: Jaspreet Singh <jaspreet.sjsu@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/jsingh6/mobileguard
|
|
8
|
+
Project-URL: Paper, https://arxiv.org/abs/XXXX.XXXXX
|
|
9
|
+
Project-URL: Documentation, https://github.com/jsingh6/mobileguard#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/jsingh6/mobileguard/issues
|
|
11
|
+
Keywords: mobile,governance,ai,app-store,google-play,swift,kotlin,flutter,react-native,eu-ai-act,owasp
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: anthropic>=0.40.0
|
|
26
|
+
Requires-Dist: click>=8.1.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: rich>=13.0.0
|
|
29
|
+
Requires-Dist: pathspec>=0.12.0
|
|
30
|
+
Requires-Dist: tomli>=2.0.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.3.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
|
36
|
+
Requires-Dist: bandit>=1.7.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# MobileGuard
|
|
40
|
+
|
|
41
|
+
> AI governance for consumer mobile platforms.
|
|
42
|
+
> Prevents App Store and Google Play rejections caused by AI-generated code.
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/mobileguard/)
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
[](https://arxiv.org/abs/XXXX.XXXXX)
|
|
47
|
+
[](https://github.com/jsingh6/mobileguard/actions/workflows/ci.yml)
|
|
48
|
+
|
|
49
|
+
## The Problem
|
|
50
|
+
|
|
51
|
+
AI coding agents (Claude Code, GitHub Copilot, Cursor, Codex) generate mobile code
|
|
52
|
+
with zero awareness of mobile governance constraints:
|
|
53
|
+
|
|
54
|
+
- **Apple App Store Guideline 5.1.2(i)** — AI data disclosure and consent (Nov 2025)
|
|
55
|
+
- **Google Play AI Policy** — data safety declarations for AI features
|
|
56
|
+
- **EU AI Act Article 50** — transparency obligations (enforcement: Aug 2, 2026)
|
|
57
|
+
- **Binary immutability** — no hotfix without 1–3 day App Store review
|
|
58
|
+
- **Ambient AI boundaries** — Siri App Intents, Android AppFunctions permission scopes
|
|
59
|
+
|
|
60
|
+
72% of AI-generated mobile apps leak secrets. 45% introduce OWASP vulnerabilities.
|
|
61
|
+
20 documented incidents exposed tens of millions of users between Jan 2025–Feb 2026.
|
|
62
|
+
MobileGuard catches these violations before they reach the store.
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install mobileguard
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Requires Python 3.11+. The `scan` command works offline with no API key.
|
|
71
|
+
The `contract` command requires an Anthropic API key.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Scan your project for governance violations
|
|
77
|
+
mobileguard scan ./MyApp
|
|
78
|
+
|
|
79
|
+
# Generate an EU AI Act compliance report
|
|
80
|
+
mobileguard audit ./MyApp --app-name "My App" --version "2.0.0"
|
|
81
|
+
|
|
82
|
+
# Create a quality contract
|
|
83
|
+
mobileguard init --platform ios --bundle-id com.example.myapp
|
|
84
|
+
|
|
85
|
+
# Evaluate AI-generated code against the contract (requires ANTHROPIC_API_KEY)
|
|
86
|
+
mobileguard contract ./GeneratedFeature.swift --stage code-generation --agent claude-code
|
|
87
|
+
|
|
88
|
+
# Check an AI agent's current autonomy tier
|
|
89
|
+
mobileguard tier my-agent-01
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Supported Platforms
|
|
93
|
+
|
|
94
|
+
| Platform | Language | Detector |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| iOS | Swift | Full |
|
|
97
|
+
| Android | Kotlin | Full |
|
|
98
|
+
| Flutter | Dart | Full |
|
|
99
|
+
| React Native | JavaScript / TypeScript | Full |
|
|
100
|
+
|
|
101
|
+
## Rule Sets
|
|
102
|
+
|
|
103
|
+
| Rule Set | Rules | Enforces |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `app-store` | AS-001 to AS-005 | Apple Guideline 5.1.2(i), 4.1(c) |
|
|
106
|
+
| `google-play` | GP-001 to GP-005 | Google Play AI Policy, Data Safety |
|
|
107
|
+
| `eu-ai-act` | EU-001 to EU-004 | EU AI Act Article 50, 12, 14 |
|
|
108
|
+
| `owasp` | OW-001 to OW-005 | OWASP Mobile AI Top 10 |
|
|
109
|
+
|
|
110
|
+
### App Store Rules (Apple)
|
|
111
|
+
|
|
112
|
+
| ID | Severity | Description |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| AS-001 | CRITICAL | Third-party AI data sharing without 5.1.2(i) disclosure |
|
|
115
|
+
| AS-002 | ERROR | Hardcoded AI API key in source code |
|
|
116
|
+
| AS-003 | ERROR | App Intent exposes sensitive scope without authorization |
|
|
117
|
+
| AS-004 | WARNING | Generic AI-generated privacy description in Info.plist |
|
|
118
|
+
| AS-005 | WARNING | Missing NSPrivacyCollectedDataTypes for AI data collection |
|
|
119
|
+
|
|
120
|
+
### Google Play Rules (Android)
|
|
121
|
+
|
|
122
|
+
| ID | Severity | Description |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| GP-001 | CRITICAL | AI data transmission without DATA_SAFETY declaration |
|
|
125
|
+
| GP-002 | ERROR | Hardcoded AI API key in Kotlin source or Gradle |
|
|
126
|
+
| GP-003 | ERROR | AppFunction exposes sensitive permissions without declaration |
|
|
127
|
+
| GP-004 | WARNING | Ambient AI feature missing biometric/consent flow |
|
|
128
|
+
| GP-005 | WARNING | Missing `<queries>` manifest declaration for AI packages |
|
|
129
|
+
|
|
130
|
+
### EU AI Act Rules
|
|
131
|
+
|
|
132
|
+
| ID | Severity | Description |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| EU-001 | CRITICAL | AI system interacts with users without transparency disclosure (Art. 50) |
|
|
135
|
+
| EU-002 | ERROR | Automated AI decision modifies user data without human oversight (Art. 14) |
|
|
136
|
+
| EU-003 | WARNING | No logging or audit trail for AI decisions (Art. 12) |
|
|
137
|
+
| EU-004 | WARNING | AI feature has no user opt-out mechanism at runtime (Art. 50(2)) |
|
|
138
|
+
|
|
139
|
+
### OWASP Mobile AI Rules
|
|
140
|
+
|
|
141
|
+
| ID | Severity | Description |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| OW-001 | CRITICAL | Prompt injection — user input interpolated into system prompt |
|
|
144
|
+
| OW-002 | ERROR | AI output rendered in WebView without HTML sanitization |
|
|
145
|
+
| OW-003 | ERROR | Sensitive PII passed to external AI API without masking |
|
|
146
|
+
| OW-004 | WARNING | AI response cached to device storage without encryption |
|
|
147
|
+
| OW-005 | WARNING | No rate limiting on AI API calls (denial-of-wallet risk) |
|
|
148
|
+
|
|
149
|
+
## CLI Reference
|
|
150
|
+
|
|
151
|
+
### `mobileguard scan`
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Usage: mobileguard scan [OPTIONS] PATH
|
|
155
|
+
|
|
156
|
+
Scan a mobile codebase for governance violations.
|
|
157
|
+
|
|
158
|
+
Options:
|
|
159
|
+
--platform [ios|android|flutter|react-native|auto] default: auto
|
|
160
|
+
--rules TEXT Comma-separated: app-store,google-play,eu-ai-act,owasp
|
|
161
|
+
--severity [critical|error|warning|info] default: warning
|
|
162
|
+
--format [table|json|sarif|markdown] default: table
|
|
163
|
+
--output PATH Write report to file
|
|
164
|
+
--fail-on [critical|error|warning] Exit 1 if violations found
|
|
165
|
+
--llm Use Claude API for semantic analysis (pattern-only by default)
|
|
166
|
+
--api-key TEXT Anthropic API key (default: ANTHROPIC_API_KEY env var)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### `mobileguard contract`
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
Usage: mobileguard contract [OPTIONS] PATH
|
|
173
|
+
|
|
174
|
+
Evaluate AI-generated code against a quality contract (PDQC pillar).
|
|
175
|
+
|
|
176
|
+
Options:
|
|
177
|
+
--contract PATH Path to mobileguard.json [default: ./mobileguard.json]
|
|
178
|
+
--stage [code-generation|test-generation|code-review] default: code-generation
|
|
179
|
+
--agent TEXT AI agent identifier
|
|
180
|
+
--platform [ios|android|flutter|react-native]
|
|
181
|
+
--api-key TEXT Anthropic API key (required)
|
|
182
|
+
--fail-fast Exit 1 if pipeline should halt
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### `mobileguard audit`
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Usage: mobileguard audit [OPTIONS] PATH
|
|
189
|
+
|
|
190
|
+
Generate a compliance report (EU AI Act, App Store, Google Play).
|
|
191
|
+
|
|
192
|
+
Options:
|
|
193
|
+
--format [markdown|json|html] default: markdown
|
|
194
|
+
--output PATH default: mobileguard-audit-report.md
|
|
195
|
+
--platform [ios|android|flutter|react-native|all]
|
|
196
|
+
--app-name TEXT
|
|
197
|
+
--version TEXT
|
|
198
|
+
--include-evidence Include code snippets as evidence
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
> **PDF export:** Coming in v1.1. For now, convert the HTML output using your
|
|
202
|
+
> browser's print-to-PDF (Chrome: File → Print → Save as PDF).
|
|
203
|
+
|
|
204
|
+
### `mobileguard tier`
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Usage: mobileguard tier [OPTIONS] AGENT_ID
|
|
208
|
+
|
|
209
|
+
Show the current TAC-M autonomy tier for an AI agent.
|
|
210
|
+
|
|
211
|
+
Options:
|
|
212
|
+
--history PATH Audit log directory [default: .mobileguard/audit/]
|
|
213
|
+
--contract PATH mobileguard.json (optional)
|
|
214
|
+
--cfsr FLOAT Current crash-free session rate (e.g. 0.997)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### `mobileguard init`
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
Usage: mobileguard init [OPTIONS]
|
|
221
|
+
|
|
222
|
+
Create a mobileguard.json quality contract.
|
|
223
|
+
|
|
224
|
+
Options:
|
|
225
|
+
--platform [ios|android|flutter|react-native] (required)
|
|
226
|
+
--bundle-id TEXT App bundle identifier
|
|
227
|
+
--app-name TEXT App display name
|
|
228
|
+
--strict Stricter thresholds (recommended for finance/health apps)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Exit Codes
|
|
232
|
+
|
|
233
|
+
| Code | Meaning |
|
|
234
|
+
|---|---|
|
|
235
|
+
| 0 | Pass — no violations at or above threshold |
|
|
236
|
+
| 1 | Fail — violations found |
|
|
237
|
+
| 2 | Error — bad path, missing API key, or configuration problem |
|
|
238
|
+
|
|
239
|
+
## CI/CD Integration
|
|
240
|
+
|
|
241
|
+
### GitHub Actions
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
# .github/workflows/mobileguard.yml
|
|
245
|
+
name: MobileGuard
|
|
246
|
+
|
|
247
|
+
on: [push, pull_request]
|
|
248
|
+
|
|
249
|
+
jobs:
|
|
250
|
+
scan:
|
|
251
|
+
runs-on: ubuntu-latest
|
|
252
|
+
permissions:
|
|
253
|
+
security-events: write
|
|
254
|
+
|
|
255
|
+
steps:
|
|
256
|
+
- uses: actions/checkout@v4
|
|
257
|
+
- run: pip install mobileguard
|
|
258
|
+
- name: Scan
|
|
259
|
+
run: |
|
|
260
|
+
mobileguard scan . \
|
|
261
|
+
--format sarif \
|
|
262
|
+
--output mobileguard.sarif \
|
|
263
|
+
--fail-on critical
|
|
264
|
+
- name: Upload SARIF
|
|
265
|
+
if: always()
|
|
266
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
267
|
+
with:
|
|
268
|
+
sarif_file: mobileguard.sarif
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
See [`examples/github_actions.yml`](examples/github_actions.yml) for the full workflow.
|
|
272
|
+
|
|
273
|
+
### Fastlane
|
|
274
|
+
|
|
275
|
+
```ruby
|
|
276
|
+
# Fastfile
|
|
277
|
+
lane :governance_check do
|
|
278
|
+
sh "mobileguard scan . --platform ios --fail-on critical"
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
before_all do
|
|
282
|
+
governance_check
|
|
283
|
+
end
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Xcode Cloud
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
#!/bin/bash
|
|
290
|
+
# ci_post_clone.sh
|
|
291
|
+
pip install mobileguard
|
|
292
|
+
mobileguard scan $CI_PRIMARY_REPOSITORY_PATH \
|
|
293
|
+
--platform ios \
|
|
294
|
+
--fail-on critical \
|
|
295
|
+
--format sarif \
|
|
296
|
+
--output mobileguard.sarif
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Quality Contract (`mobileguard.json`)
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"version": "1.0",
|
|
304
|
+
"platform": "ios",
|
|
305
|
+
"bundle_id": "com.example.myapp",
|
|
306
|
+
"app_name": "My App",
|
|
307
|
+
"thresholds": {
|
|
308
|
+
"min_score": 0.80,
|
|
309
|
+
"max_critical_violations": 0,
|
|
310
|
+
"max_error_violations": 2,
|
|
311
|
+
"min_regression_coverage": 0.80,
|
|
312
|
+
"min_crash_free_session_rate": 0.997
|
|
313
|
+
},
|
|
314
|
+
"stages": {
|
|
315
|
+
"code-generation": { "min_score": 0.70, "halt_on_critical": true },
|
|
316
|
+
"test-generation": { "min_score": 0.75, "halt_on_critical": true },
|
|
317
|
+
"code-review": { "min_score": 0.85, "halt_on_critical": true }
|
|
318
|
+
},
|
|
319
|
+
"rules": {
|
|
320
|
+
"enabled": ["app-store", "google-play", "eu-ai-act", "owasp"],
|
|
321
|
+
"disabled": []
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Generate with: `mobileguard init --platform ios --bundle-id com.example.myapp`
|
|
327
|
+
|
|
328
|
+
## TAC-M Autonomy Tiers
|
|
329
|
+
|
|
330
|
+
| Tier | Label | Clean Cycles Required | Max Deployment Reach |
|
|
331
|
+
|---|---|---|---|
|
|
332
|
+
| L1 | Autocomplete only | 0 | 0% |
|
|
333
|
+
| L2 | Draft for review | 1 | 100% (human-reviewed) |
|
|
334
|
+
| L3 | Conditional autonomous | 5 | 10% |
|
|
335
|
+
| L4 | Supervised deployment | 10 | 50% |
|
|
336
|
+
| L5 | Full autonomous | 20 | 100% |
|
|
337
|
+
|
|
338
|
+
Check an agent's tier: `mobileguard tier my-agent-01 --cfsr 0.997`
|
|
339
|
+
|
|
340
|
+
## Privacy
|
|
341
|
+
|
|
342
|
+
MobileGuard does not collect telemetry, send analytics, or phone home.
|
|
343
|
+
All analysis is performed locally. The only outbound network calls are to
|
|
344
|
+
the Anthropic API when `--llm` is passed to `scan`, or when running `contract`.
|
|
345
|
+
API responses are never logged.
|
|
346
|
+
|
|
347
|
+
## The Research
|
|
348
|
+
|
|
349
|
+
MobileGuard is the reference implementation of:
|
|
350
|
+
|
|
351
|
+
> **"MobileGuard: A Stack-Agnostic Governance Framework for Agentic AI
|
|
352
|
+
> Across Consumer Mobile Delivery Platforms"**
|
|
353
|
+
> Jaspreet Singh · [arXiv:XXXX.XXXXX](https://arxiv.org/abs/XXXX.XXXXX) · 2026
|
|
354
|
+
|
|
355
|
+
### Four Governance Pillars
|
|
356
|
+
|
|
357
|
+
| Pillar | Command | Problem Addressed |
|
|
358
|
+
|---|---|---|
|
|
359
|
+
| **PDQC** — Pre-Deployment Quality Contracting | `mobileguard contract` | Binary immutability (no hotfix without store review) |
|
|
360
|
+
| **TAC-M** — Tiered Autonomy Calibration | `mobileguard tier` | Consumer-scale blast radius of AI agents |
|
|
361
|
+
| **PGSG** — Platform Gatekeeper Simulation | `mobileguard scan` | Dual-gatekeeper non-determinism (App Store + Play Store) |
|
|
362
|
+
| **AABE** — Ambient Agent Boundary Enforcement | `mobileguard scan` | Siri App Intents, Android AppFunctions permission scopes |
|
|
363
|
+
|
|
364
|
+
## Citation
|
|
365
|
+
|
|
366
|
+
```bibtex
|
|
367
|
+
@article{singh2026mobileguard,
|
|
368
|
+
title = {{MobileGuard}: A Stack-Agnostic Governance Framework for Agentic {AI}
|
|
369
|
+
Across Consumer Mobile Delivery Platforms},
|
|
370
|
+
author = {Singh, Jaspreet},
|
|
371
|
+
journal = {arXiv preprint arXiv:XXXX.XXXXX},
|
|
372
|
+
year = {2026},
|
|
373
|
+
url = {https://arxiv.org/abs/XXXX.XXXXX}
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## Contributing
|
|
378
|
+
|
|
379
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Every contribution must be traceable to
|
|
380
|
+
one of the four governance pillars. Rule IDs are stable and cannot be renumbered.
|
|
381
|
+
|
|
382
|
+
## License
|
|
383
|
+
|
|
384
|
+
[Apache 2.0](LICENSE) © 2026 Jaspreet Singh
|