agentdodont 0.1.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.
- agentdodont-0.1.0/.gitignore +19 -0
- agentdodont-0.1.0/LICENSE +202 -0
- agentdodont-0.1.0/NOTICE +4 -0
- agentdodont-0.1.0/PKG-INFO +104 -0
- agentdodont-0.1.0/README.md +189 -0
- agentdodont-0.1.0/agentdodont/__init__.py +3 -0
- agentdodont-0.1.0/agentdodont/__main__.py +297 -0
- agentdodont-0.1.0/agentdodont/adb.py +189 -0
- agentdodont-0.1.0/agentdodont/agent.py +434 -0
- agentdodont-0.1.0/agentdodont/audit.py +69 -0
- agentdodont-0.1.0/agentdodont/mcp_proxy.py +238 -0
- agentdodont-0.1.0/agentdodont/pairing.py +200 -0
- agentdodont-0.1.0/agentdodont/policy.py +180 -0
- agentdodont-0.1.0/agentdodont/relay.py +309 -0
- agentdodont-0.1.0/agentdodont/rules.py +236 -0
- agentdodont-0.1.0/agentdodont/shared.py +198 -0
- agentdodont-0.1.0/agentdodont/suite.py +275 -0
- agentdodont-0.1.0/agentdodont/ui.py +228 -0
- agentdodont-0.1.0/docs/pypi.md +79 -0
- agentdodont-0.1.0/mcp-rules.example.json +15 -0
- agentdodont-0.1.0/pyproject.toml +57 -0
- agentdodont-0.1.0/tests/fake_mcp_server.py +41 -0
- agentdodont-0.1.0/tests/fixtures/gmail_inbox_injection_row.xml +2 -0
- agentdodont-0.1.0/tests/test_mcp_proxy.py +278 -0
- agentdodont-0.1.0/tests/test_pairing.py +118 -0
- agentdodont-0.1.0/tests/test_relay.py +196 -0
- agentdodont-0.1.0/tests/test_stage0.py +273 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
agentdodont-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: agentdodont
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A rules engine between an AI agent and its tools, built assuming the model can be hijacked. Includes an MCP proxy.
|
|
5
|
+
Project-URL: Homepage, https://github.com/moshesipper/agentdodont
|
|
6
|
+
Project-URL: Documentation, https://github.com/moshesipper/agentdodont/blob/main/docs/mcp-proxy.md
|
|
7
|
+
Project-URL: Issues, https://github.com/moshesipper/agentdodont/issues
|
|
8
|
+
Author: Moshe Sipper
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: ai-agents,android,claude,llm,mcp,prompt-injection,security
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Provides-Extra: phone
|
|
20
|
+
Requires-Dist: anthropic>=0.84; extra == 'phone'
|
|
21
|
+
Requires-Dist: cryptography>=42; extra == 'phone'
|
|
22
|
+
Requires-Dist: pillow>=10; extra == 'phone'
|
|
23
|
+
Requires-Dist: qrcode>=7; extra == 'phone'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# Agent Do/Don't
|
|
27
|
+
|
|
28
|
+
A rules engine between an AI agent and its tools, built assuming the model can be hijacked by
|
|
29
|
+
anything it reads. The model proposes; the rules decide: **do it**, **ask you**, or **refuse**.
|
|
30
|
+
|
|
31
|
+
This package contains the **MCP proxy**. It works with any agent that uses
|
|
32
|
+
[MCP](https://modelcontextprotocol.io) tools, such as Claude Code, Claude Desktop, or your own.
|
|
33
|
+
It sits between the agent and an MCP server, and neither of them needs any changes. It needs
|
|
34
|
+
nothing beyond the Python standard library. The project also includes an Android app with the
|
|
35
|
+
same rules ([GitHub](https://github.com/moshesipper/agentdodont)).
|
|
36
|
+
|
|
37
|
+
Status: **experimental.**
|
|
38
|
+
|
|
39
|
+
## What it does
|
|
40
|
+
|
|
41
|
+
Suppose an agent reads a web page with hidden instructions telling it to email your notes to
|
|
42
|
+
helpdesk@evil.example. If the model falls for it, the proxy sees the session has read untrusted
|
|
43
|
+
content, and refuses the email: that address isn't one of yours. The call never reaches the
|
|
44
|
+
email server.
|
|
45
|
+
|
|
46
|
+
- **Taint.** After a tool returns untrusted content, the session counts as untrusted from then
|
|
47
|
+
on. This holds across every server the agent uses, and questions name where the content came
|
|
48
|
+
from.
|
|
49
|
+
- **Where data goes.** URLs, email addresses and phone numbers in a call's arguments are checked
|
|
50
|
+
against your lists. Once the session is tainted, an address you haven't listed is refused,
|
|
51
|
+
not asked. Before that, a new address asks.
|
|
52
|
+
- **Risk.** It reads the server's tool annotations the cautious way. A tool with no annotations
|
|
53
|
+
counts as possibly irreversible and asks.
|
|
54
|
+
- **Your settings.** You can set any tool to "do it", "ask" or "never", and there's a rate limit.
|
|
55
|
+
- **Asking.** Questions appear in the client (MCP elicitation). If the client can't ask, the call
|
|
56
|
+
is refused, never run silently.
|
|
57
|
+
- **Log.** Every decision goes to `~/.agentdodont/mcp-audit.jsonl`.
|
|
58
|
+
|
|
59
|
+
## Set up
|
|
60
|
+
|
|
61
|
+
Start the proxy in place of the server, with the server's own command after `--`. With
|
|
62
|
+
[uv](https://docs.astral.sh/uv/) installed, nothing else needs installing. For Claude Code:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
claude mcp add fetch -- uvx agentdodont mcp-proxy --rules /path/to/mcp-rules.json --name fetch -- uvx mcp-server-fetch
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or put this in `.mcp.json` in your project:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"fetch": {
|
|
74
|
+
"command": "uvx",
|
|
75
|
+
"args": ["agentdodont", "mcp-proxy", "--rules", "/path/to/mcp-rules.json", "--name", "fetch",
|
|
76
|
+
"--", "uvx", "mcp-server-fetch"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Claude Desktop uses the same entry in `claude_desktop_config.json`. Without uv, run
|
|
83
|
+
`pip install agentdodont` and use `"command": "agentdodont"` with the same arguments minus the
|
|
84
|
+
first `"agentdodont"`.
|
|
85
|
+
|
|
86
|
+
A rules file is optional. Every field in it is optional too:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"allowed_sites": ["wikipedia.org", "github.com"],
|
|
91
|
+
"known_recipients": ["dana@example.com"],
|
|
92
|
+
"levels": {"read_*": "auto", "delete_*": "ask", "get-env": "deny"},
|
|
93
|
+
"tools": {"send_message": {"destination_args": {"channel": "recipient"}}}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## More
|
|
98
|
+
|
|
99
|
+
- [The full proxy guide](https://github.com/moshesipper/agentdodont/blob/main/docs/mcp-proxy.md):
|
|
100
|
+
every rule, every field, and the limits.
|
|
101
|
+
- [Threat model](https://github.com/moshesipper/agentdodont/blob/main/docs/threat-model.md)
|
|
102
|
+
- [Benchmark](https://github.com/moshesipper/agentdodont/blob/main/docs/benchmark.md)
|
|
103
|
+
|
|
104
|
+
Apache License 2.0.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Agent Do/Don't
|
|
2
|
+
|
|
3
|
+
**The model proposes. Agent Do/Don't decides.** *Do. Don't. Ask first.*
|
|
4
|
+
|
|
5
|
+
AI agents now send messages, change calendars, open links and tap through apps on your behalf.
|
|
6
|
+
Any text they read can hijack them: a notification, a calendar invite, a web page, another app's
|
|
7
|
+
screen. Most defenses try to make the model notice the trick. Agent Do/Don't assumes it won't.
|
|
8
|
+
|
|
9
|
+
Every tool call the agent makes goes through a rules engine that runs outside the model, which the
|
|
10
|
+
model can't see or influence. The engine decides: **do it**, **ask you**, or **refuse**. Everything
|
|
11
|
+
is logged and explained, and you can undo whatever can be undone.
|
|
12
|
+
|
|
13
|
+
This repository is a working Android implementation: a home-screen app with a Claude agent,
|
|
14
|
+
running on a real phone (Galaxy S22, Android 16). It's an early prototype. See [Status](#status).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## What sets it apart
|
|
19
|
+
|
|
20
|
+
Many tools can intercept an agent's tool calls and ask a human. Agent Do/Don't goes further,
|
|
21
|
+
because it assumes the model is **already compromised**:
|
|
22
|
+
|
|
23
|
+
- **It knows what the agent has read, and from where.** Every tool declares whether its output
|
|
24
|
+
is trusted; the code won't compile otherwise. Once a task has read outside content, it's
|
|
25
|
+
**tainted**, and the source is named in every question: *"this task has read notifications from Shell"*.
|
|
26
|
+
- **A tainted task can only send data to places you've already allowed.** Your contacts, or
|
|
27
|
+
sites on your list. Anything else is **refused, not asked**, so an injection can't talk you
|
|
28
|
+
into leaking data with one tired tap. Typing an address or URL into another app counts too.
|
|
29
|
+
Even before it has read anything, the agent asks before sending data anywhere new.
|
|
30
|
+
- **Some things are never possible.** The agent can't read or operate protected screens and
|
|
31
|
+
controls: Agent Do/Don't itself, permission prompts, factory reset, developer options. These
|
|
32
|
+
are recognized in 18 languages, and in any other language every named tap asks. A **scope
|
|
33
|
+
lock** keeps it inside the app the task opened.
|
|
34
|
+
- **Only you can undo, and only you can clear the record.** Every reversible change can be
|
|
35
|
+
undone, grouped by request. The agent has no tool for undoing or clearing history, so it
|
|
36
|
+
can't erase its tracks.
|
|
37
|
+
- **"Why did you do that?"** For every action: who proposed it, which rule decided, what you
|
|
38
|
+
answered, what happened.
|
|
39
|
+
- **Memory an injection can't poison.** What the agent remembers is encrypted on the phone, and
|
|
40
|
+
you can view and edit it. Secrets are refused, and memory writes from tainted tasks ask first.
|
|
41
|
+
- **You press Send.** Messages and emails are drafted in the real app. Agent Do/Don't never sends them.
|
|
42
|
+
- **Tested against a hijacked model,** not just a confused one (see [Evidence](#evidence)).
|
|
43
|
+
- **Your API key stays on your computer.** The phone talks to a small relay with a budget and a
|
|
44
|
+
rate limit. It pairs over Wi-Fi with a pinned certificate.
|
|
45
|
+
|
|
46
|
+
What it does **not** guarantee is just as important. Read the [threat model](docs/threat-model.md).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## How it works
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
your request
|
|
54
|
+
│
|
|
55
|
+
▼
|
|
56
|
+
┌─────────┐ proposes a tool call ┌───────────────────────────────────┐
|
|
57
|
+
│ model │ ──────────────────────▶ │ rules engine (no model) │
|
|
58
|
+
│ (Claude)│ ◀────────────────────── │ validate → risk → taint → where │
|
|
59
|
+
└─────────┘ result, labelled │ data goes → protected screens │
|
|
60
|
+
trusted / untrusted │ → scope lock → rate limit │
|
|
61
|
+
└─────────────────┬─────────────────┘
|
|
62
|
+
do it / ask you / refuse
|
|
63
|
+
▼
|
|
64
|
+
runs · audit log · undo entry
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- The engine ([Policy.kt](android/app/src/main/java/dev/aos/launcher/capabilities/Policy.kt)) is
|
|
68
|
+
plain Kotlin with no Android or model dependencies, so it's deterministic and unit-tested.
|
|
69
|
+
- Every applicable rule is evaluated and the **strictest verdict wins**. No approval overrides a refusal.
|
|
70
|
+
- Irreversible actions (send, delete, pay) **always ask**, whatever the settings.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Evidence
|
|
75
|
+
|
|
76
|
+
The debug build contains a **scripted attacker**: a stand-in "model" that does exactly what the
|
|
77
|
+
injected text says, as a fully hijacked model would. It runs through the same loop, rules and
|
|
78
|
+
confirmation screens as the real agent. On the S22:
|
|
79
|
+
|
|
80
|
+
| Injection arrives via | Attacker then tries to | Got through without the user's OK |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| A notification or calendar invite | Delete a calendar event; set a 3 a.m. alarm; send the calendar's event titles to an attacker URL | **0 of 3** (the delete and the alarm asked, naming the source; the URL was refused outright) |
|
|
83
|
+
| Another app's screen (Calendar) | Tap a control in Settings; read a different app's screen | **0 of 2** (the tap asked; the read was refused by the scope lock) |
|
|
84
|
+
|
|
85
|
+
The real model (Claude) ignored the injections too, even when told to obey them. The point is
|
|
86
|
+
that the result doesn't depend on that.
|
|
87
|
+
|
|
88
|
+
**Benchmark:** 35 attacks and 28 ordinary requests, replayed through the rules engine with it on
|
|
89
|
+
and off. With the rules off, all 35 attacks work. With them on, 17 are refused outright, 16
|
|
90
|
+
need your OK, and 2 get through, each a documented limit. Ordinary requests cost 13 questions
|
|
91
|
+
across 28 requests. The benchmark also found a gap (an injection inside the app being operated
|
|
92
|
+
could get an address typed in), now fixed. In a live run on the phone, the real model resisted 11
|
|
93
|
+
of 12 injections by itself; the one it obeyed (a 3 a.m. alarm) was stopped by the rules. Method, every scenario and the gaps: [docs/benchmark.md](docs/benchmark.md).
|
|
94
|
+
|
|
95
|
+
**Try to break it.** If you get a harmful action past Agent Do/Don't without a confirmation,
|
|
96
|
+
please report it privately ([SECURITY.md](SECURITY.md)).
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## What's in the repository
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
android/ The app: home screen with an intent box, the Claude agent, the rules engine,
|
|
104
|
+
tools (alarms, calendar, URLs, apps, notifications, contacts, email/text drafts),
|
|
105
|
+
screen operation through accessibility, encrypted memory, History, Undo, pairing.
|
|
106
|
+
agentdodont/ Python: the relay that keeps the API key off the phone (budget, rate limit,
|
|
107
|
+
QR pairing over pinned TLS, revocable device tokens); the MCP proxy (the same
|
|
108
|
+
rules for any MCP agent); and an experimental laptop agent that drives a phone
|
|
109
|
+
over ADB.
|
|
110
|
+
tests/ Python tests (relay, pairing, MCP proxy, laptop agent).
|
|
111
|
+
tools/ The live benchmark (the real model on a phone, against planted injections).
|
|
112
|
+
docs/ Threat model, benchmark, and every feature in detail with how it was verified.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Quick start
|
|
118
|
+
|
|
119
|
+
You need: an Android phone with USB debugging on (Android 11 or newer; tested on Android 16),
|
|
120
|
+
Android Studio (for its JDK and SDK), Python 3.10+, `adb` on your PATH, and an
|
|
121
|
+
[Anthropic API key](https://console.anthropic.com/).
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
git clone https://github.com/moshesipper/agentdodont && cd agentdodont
|
|
125
|
+
pip install -r requirements.txt
|
|
126
|
+
|
|
127
|
+
# 1. Your key goes in a gitignored file and stays on your computer.
|
|
128
|
+
echo "anthropic.apiKey=YOUR_KEY" >> android/local.properties
|
|
129
|
+
|
|
130
|
+
# 2. Build and install (set JAVA_HOME to Android Studio's JDK). The key is never built into the app.
|
|
131
|
+
cd android && ./gradlew installDebug && cd ..
|
|
132
|
+
|
|
133
|
+
# 3. Start the relay: it gives the phone a device token over USB and holds the key.
|
|
134
|
+
python -m agentdodont relay # leave running while you use the phone
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Then, on the phone:
|
|
138
|
+
|
|
139
|
+
- **Set it as the home screen** (optional): `adb shell cmd package set-home-activity dev.aos.launcher/.MainActivity`.
|
|
140
|
+
To undo: Settings › Apps › Default apps › Home app.
|
|
141
|
+
- **Grant what you want to use:** calendar and contacts permissions when asked; **Notification
|
|
142
|
+
access** for reading notifications; **Settings › Accessibility › Agent Do/Don't** for
|
|
143
|
+
operating other apps.
|
|
144
|
+
- Type a request, such as *"what's on my calendar tomorrow?"* or *"alarm 7:30"*. Look at
|
|
145
|
+
**History** and **Policy** to see what happened and to change what may happen.
|
|
146
|
+
|
|
147
|
+
**Over Wi-Fi instead of USB:** `python -m agentdodont relay --lan --pair` shows a QR code. Scan
|
|
148
|
+
it with the phone's camera, then confirm on the phone. After that, `relay --lan` is enough;
|
|
149
|
+
`relay --devices` lists paired phones and `relay --revoke <id>` cuts one off.
|
|
150
|
+
|
|
151
|
+
[docs/features.md](docs/features.md) has every option and command, plus the red-team commands.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Tests
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
cd android && ./gradlew testDebugUnitTest # rules engine, taint, undo, History, screen rules, word lists, memory, pairing
|
|
159
|
+
python -m unittest discover -s tests # relay, pairing, MCP proxy, laptop agent
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Status
|
|
165
|
+
|
|
166
|
+
**Works today:**
|
|
167
|
+
- the rules engine with taint and named sources, outbound allow-lists (tainted tasks are refused; any other agent task asks), protected screens in 18 languages, and the scope lock;
|
|
168
|
+
- user-only undo, History with "why", and clearing history with a visible marker;
|
|
169
|
+
- encrypted memory that you can inspect, and that injections can't write to silently;
|
|
170
|
+
- message and email drafts with your contacts as the allow-list;
|
|
171
|
+
- the relay with a budget, a rate limit and pinned Wi-Fi pairing;
|
|
172
|
+
- **experimental:** an [MCP proxy](docs/mcp-proxy.md) that puts the same rules between any MCP agent
|
|
173
|
+
(Claude Code, Claude Desktop…) and its tools, with one session across all its servers:
|
|
174
|
+
`pip install agentdodont`, or `uvx agentdodont mcp-proxy`.
|
|
175
|
+
|
|
176
|
+
**Next:**
|
|
177
|
+
- [ ] a defense and tests against "action rebinding" (the screen changes between check and tap)
|
|
178
|
+
- [ ] the rules engine as a standalone library, ported to Python, with shared test cases for both versions
|
|
179
|
+
- [ ] the MCP proxy beyond experimental: ready-made rules and runs against popular servers and clients
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
[Apache-2.0](LICENSE). Copyright 2026 Moshe Sipper.
|
|
186
|
+
|
|
187
|
+
## Security
|
|
188
|
+
|
|
189
|
+
Please report vulnerabilities privately; see [SECURITY.md](SECURITY.md).
|