llm-agent-assurance 0.2.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.
- llm_agent_assurance-0.2.0/.github/workflows/ci.yml +26 -0
- llm_agent_assurance-0.2.0/.github/workflows/pages.yml +42 -0
- llm_agent_assurance-0.2.0/.gitignore +11 -0
- llm_agent_assurance-0.2.0/LICENSE +202 -0
- llm_agent_assurance-0.2.0/PKG-INFO +136 -0
- llm_agent_assurance-0.2.0/README.es.md +112 -0
- llm_agent_assurance-0.2.0/README.md +113 -0
- llm_agent_assurance-0.2.0/docs/demo.gif +0 -0
- llm_agent_assurance-0.2.0/docs/og.png +0 -0
- llm_agent_assurance-0.2.0/examples/__init__.py +0 -0
- llm_agent_assurance-0.2.0/examples/demo_vulnerable_agent.py +20 -0
- llm_agent_assurance-0.2.0/pyproject.toml +39 -0
- llm_agent_assurance-0.2.0/scripts/build_site.py +100 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/__init__.py +33 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/cli.py +95 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/demo.py +94 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/engagement.py +146 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/i18n.py +13 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/model.py +153 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/__init__.py +39 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/base.py +51 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/data_integrity.py +93 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/system_prompt_leak.py +124 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/type_confusion.py +126 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/unbounded_input.py +109 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/probes/verbose_errors.py +97 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/report.py +145 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/scanner.py +47 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/target.py +5 -0
- llm_agent_assurance-0.2.0/src/agent_assurance/transport.py +77 -0
- llm_agent_assurance-0.2.0/tests/test_probes.py +96 -0
- llm_agent_assurance-0.2.0/tests/test_scanner_and_report.py +133 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
- name: Install
|
|
22
|
+
run: pip install -e ".[dev]"
|
|
23
|
+
- name: Tests
|
|
24
|
+
run: pytest -q
|
|
25
|
+
- name: Demo smoke test
|
|
26
|
+
run: agent-assurance demo
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Demo report (GitHub Pages)
|
|
2
|
+
|
|
3
|
+
# Publica el informe de ejemplo generado por el escaneo sin red. No usa
|
|
4
|
+
# secretos ni toca sistemas de terceros.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pages: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: pages
|
|
18
|
+
cancel-in-progress: true
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
- run: pip install -e . markdown
|
|
29
|
+
- run: python scripts/build_site.py site
|
|
30
|
+
- uses: actions/upload-pages-artifact@v3
|
|
31
|
+
with:
|
|
32
|
+
path: site
|
|
33
|
+
|
|
34
|
+
deploy:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment:
|
|
38
|
+
name: github-pages
|
|
39
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
40
|
+
steps:
|
|
41
|
+
- id: deployment
|
|
42
|
+
uses: actions/deploy-pages@v4
|
|
@@ -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.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: llm-agent-assurance
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Methodology and test harness for assessing the security of LLM agents and applications in production (OWASP LLM Top 10 / NIST AI RMF).
|
|
5
|
+
Project-URL: Homepage, https://github.com/Giocrisrai/agent-assurance
|
|
6
|
+
Project-URL: Issues, https://github.com/Giocrisrai/agent-assurance/issues
|
|
7
|
+
Author-email: Giocrisrai Godoy Bonillo <contact@giocrisrai.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai-assurance,llm,owasp,prompt-injection,red-teaming,security
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Security
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: httpx>=0.27
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# agent-assurance
|
|
25
|
+
|
|
26
|
+
**English** · [Español](README.es.md)
|
|
27
|
+
|
|
28
|
+
**A methodology and test harness for assessing the security of LLM agents and applications in production**, mapped to the [OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/) and the NIST AI RMF.
|
|
29
|
+
|
|
30
|
+
[](https://github.com/Giocrisrai/agent-assurance/actions)
|
|
31
|
+
[](https://www.python.org/)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
|
|
34
|
+
**[▶ See a sample report](https://giocrisrai.github.io/agent-assurance/)** — generated on every push by the offline demo scan, against a recorded vulnerable agent.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
> Distilled from real audits of conversational agents in production. This repository publishes the **methodology and the harness**; the reports delivered to clients are confidential.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Why it exists
|
|
43
|
+
|
|
44
|
+
Companies are shipping LLM agents (customer service, HR, sales, quoting) very fast, and **almost none of them get audited**. The attack surface is not the one a classic web pentest covers: it is system-prompt leakage, tampering with business data, excessive agency and unbounded consumption. `agent-assurance` turns those checks into tests that are **repeatable, auditable and comparable between assessments**.
|
|
45
|
+
|
|
46
|
+
The central design principle: **a probe that finds nothing is not a failure. It is a working defense, observed**, and the report records it as such. That is the difference between an audit and a list of complaints.
|
|
47
|
+
|
|
48
|
+
## Ethical scope (a project invariant)
|
|
49
|
+
|
|
50
|
+
Probes prove that a vector **exists**. They never exploit it:
|
|
51
|
+
|
|
52
|
+
- No sustained flooding or DoS: only minimal bursts to observe the rate limit.
|
|
53
|
+
- No email is sent to real third parties.
|
|
54
|
+
- The debugger PIN is never derived and no code is executed on the target server.
|
|
55
|
+
- Every test respects the target's rate limit.
|
|
56
|
+
|
|
57
|
+
Use it **only on systems you own or have explicit written authorization to test**.
|
|
58
|
+
|
|
59
|
+
## Probe catalog
|
|
60
|
+
|
|
61
|
+
| Probe | OWASP | What it detects |
|
|
62
|
+
|-------|-------|-----------------|
|
|
63
|
+
| `verbose-errors` | LLM02 | Raw errors from the LLM provider returned to the client (leaks provider, content policy, versions). |
|
|
64
|
+
| `type-confusion` | CONFIG | Unexpected input type → unhandled exception; with Flask `debug=True` it exposes the Werkzeug debugger (**potential RCE**). |
|
|
65
|
+
| `system-prompt-leak` | LLM07 | System-prompt extraction through sentence continuation and an "internal audit" pretext. |
|
|
66
|
+
| `data-integrity` | LLM01 | The agent accepts user-supplied data as authoritative (confirms made-up prices). |
|
|
67
|
+
| `unbounded-input` | LLM10 | No input length cap → token-cost amplification. |
|
|
68
|
+
|
|
69
|
+
Each probe produces `Finding`s with severity, impact, fix and **reproducible evidence** (trimmed request and response).
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# The PyPI package is `llm-agent-assurance` (the name `agent-assurance` on PyPI
|
|
75
|
+
# belongs to an unrelated project). The command and the import keep the short name.
|
|
76
|
+
pip install llm-agent-assurance
|
|
77
|
+
|
|
78
|
+
# See the methodology end to end against a recorded demo agent (no network):
|
|
79
|
+
agent-assurance demo # add --lang es for the Spanish report
|
|
80
|
+
|
|
81
|
+
# Audit a real chat endpoint (POST JSON {"message": "..."}):
|
|
82
|
+
agent-assurance scan https://your-service/api/chat --field message
|
|
83
|
+
|
|
84
|
+
# Audit a Spanish-speaking agent (Spanish probes and report):
|
|
85
|
+
agent-assurance scan https://your-service/api/chat --field mensaje --lang es
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
As a library:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from agent_assurance import scan, render_markdown, HttpTransport
|
|
92
|
+
|
|
93
|
+
transport = HttpTransport(
|
|
94
|
+
url="https://your-service/api/chat",
|
|
95
|
+
body_builder=lambda msg: {"message": msg},
|
|
96
|
+
extract=lambda data: data.get("reply", ""),
|
|
97
|
+
)
|
|
98
|
+
assessment = scan(transport, target_label="HR agent v2", lang="en") # "en" (default) or "es"
|
|
99
|
+
print(render_markdown(assessment, lang="en")) # Markdown report, ready for the client
|
|
100
|
+
print("Max severity:", assessment.max_severity.label("en"))
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
In CI, `agent-assurance scan` exits with code `2` when any finding is High or Critical. Use it as a gate before promoting an agent to production.
|
|
104
|
+
|
|
105
|
+
> **Language note.** Reports, probe prompts and the recorded demo agent are in English by default. Pass `--lang es` (CLI) or `lang="es"` (library) for Spanish. Probes talk to the target in the chosen language and look for response markers in that language, so set it to the language the target agent speaks.
|
|
106
|
+
|
|
107
|
+
## Design
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Transport (Protocol) how to talk to the agent (real HTTP or recorded)
|
|
111
|
+
│
|
|
112
|
+
▼
|
|
113
|
+
Probe.run(transport) ──► ProbeResult findings + observed defenses + not assessable
|
|
114
|
+
│
|
|
115
|
+
▼
|
|
116
|
+
scan(...) ──► Assessment ──► render_markdown() ──► report
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- **Abstract transport:** probes are testable without a network by injecting recorded responses from real agents.
|
|
120
|
+
- **Resilient:** if a probe fails (for example, the endpoint goes down mid-audit), it is recorded as "not assessable" and the assessment continues, as it would in a real audit.
|
|
121
|
+
- **The report is the product:** the vocabulary in the code (severities, OWASP taxonomy) is the one that appears in the deliverable.
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pip install -e ".[dev]"
|
|
127
|
+
pytest
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
Apache-2.0. The methodology is open; client reports are not.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
*Author: [Giocrisrai Godoy Bonillo](https://giocrisrai.com) — AI Engineer. I audit LLM agents in production and also build and operate them. Available for LLM security assessments: contact@giocrisrai.com*
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# agent-assurance
|
|
2
|
+
|
|
3
|
+
[English](README.md) · **Español**
|
|
4
|
+
|
|
5
|
+
**Metodología y arnés de pruebas para evaluar la seguridad de agentes y aplicaciones LLM en producción**, mapeado a [OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/) y NIST AI RMF.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/Giocrisrai/agent-assurance/actions)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
**[▶ Ver un informe de ejemplo](https://giocrisrai.github.io/agent-assurance/)** — se genera en cada push con el escaneo de demostración sin red, sobre un agente vulnerable grabado.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
> Destilado de auditorías reales a agentes conversacionales en producción. Este repositorio publica la **metodología y el arnés**; los informes entregados a clientes son confidenciales.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Por qué existe
|
|
20
|
+
|
|
21
|
+
Las empresas están desplegando agentes LLM (atención al cliente, RRHH, ventas, cotización) a gran velocidad y **casi ninguna los audita**. Los vectores no son los del pentest web clásico: son fuga de system prompt, manipulación de la integridad de los datos de negocio, agencia excesiva y consumo no acotado. `agent-assurance` sistematiza esas pruebas para que sean **repetibles, auditables y comparables entre evaluaciones**.
|
|
22
|
+
|
|
23
|
+
El principio de diseño central: **una sonda que no encuentra nada no es un fallo — es una defensa correcta observada**, y el informe la reporta como tal. Eso distingue una auditoría de una lista de quejas.
|
|
24
|
+
|
|
25
|
+
## Alcance ético (invariante del proyecto)
|
|
26
|
+
|
|
27
|
+
Las sondas demuestran la **existencia** de un vector, nunca lo explotan:
|
|
28
|
+
|
|
29
|
+
- No hay flood/DoS sostenido — solo ráfagas mínimas para observar el rate limit.
|
|
30
|
+
- No se envía correo a terceros reales.
|
|
31
|
+
- No se deriva el PIN del depurador ni se ejecuta código en el servidor objetivo.
|
|
32
|
+
- Toda prueba respeta el límite de tasa del objetivo.
|
|
33
|
+
|
|
34
|
+
Úsese **solo sobre sistemas propios o con autorización explícita por escrito**.
|
|
35
|
+
|
|
36
|
+
## Catálogo de sondas
|
|
37
|
+
|
|
38
|
+
| Sonda | OWASP | Qué detecta |
|
|
39
|
+
|-------|-------|-------------|
|
|
40
|
+
| `verbose-errors` | LLM02 | Errores del proveedor LLM devueltos crudos al cliente (filtra proveedor, política RAI, versiones). |
|
|
41
|
+
| `type-confusion` | CONFIG | Entrada de tipo inesperado → excepción no controlada; en Flask `debug=True` destapa el depurador de Werkzeug (**RCE potencial**). |
|
|
42
|
+
| `system-prompt-leak` | LLM07 | Extracción del system prompt por continuación de frase y pretexto de "auditoría interna". |
|
|
43
|
+
| `data-integrity` | LLM01 | El agente acepta datos del usuario como fuente autoritativa (confirma precios inventados). |
|
|
44
|
+
| `unbounded-input` | LLM10 | Ausencia de tope de longitud → amplificación de costo de tokens. |
|
|
45
|
+
|
|
46
|
+
Cada sonda produce `Finding`s con severidad, impacto, corrección y **evidencia reproducible** (petición/respuesta recortadas).
|
|
47
|
+
|
|
48
|
+
## Uso
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# El paquete en PyPI se llama `llm-agent-assurance` (el nombre `agent-assurance` en PyPI
|
|
52
|
+
# es de un proyecto ajeno). El comando y el import conservan el nombre corto.
|
|
53
|
+
pip install llm-agent-assurance
|
|
54
|
+
|
|
55
|
+
# Ver la metodología de punta a punta con un agente demo grabado (sin red):
|
|
56
|
+
agent-assurance demo --lang es
|
|
57
|
+
|
|
58
|
+
# Auditar un endpoint de chat real (POST JSON {"mensaje": "..."}):
|
|
59
|
+
agent-assurance scan https://tu-servicio/api/chat --field mensaje --lang es
|
|
60
|
+
|
|
61
|
+
# Sin --lang el idioma por defecto es inglés (informe, sondas y agente demo).
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Como librería:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from agent_assurance import scan, render_markdown, HttpTransport
|
|
68
|
+
|
|
69
|
+
transport = HttpTransport(
|
|
70
|
+
url="https://tu-servicio/api/chat",
|
|
71
|
+
body_builder=lambda msg: {"mensaje": msg},
|
|
72
|
+
extract=lambda data: data.get("respuesta", ""),
|
|
73
|
+
)
|
|
74
|
+
assessment = scan(transport, target_label="Agente RRHH v2", lang="es") # "en" (por defecto) o "es"
|
|
75
|
+
print(render_markdown(assessment, lang="es")) # informe Markdown listo para el cliente
|
|
76
|
+
print("Severidad máxima:", assessment.max_severity.label("es"))
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
En CI, `agent-assurance scan` devuelve código de salida `2` si hay algún hallazgo Alto o Crítico — úsalo como gate antes de promover un agente a producción.
|
|
80
|
+
|
|
81
|
+
> **Nota de idioma.** Por defecto los informes, los prompts de las sondas y el agente demo grabado están en inglés. Usa `--lang es` (CLI) o `lang="es"` (librería) para obtener todo en español. Las sondas hablan con el objetivo en el idioma elegido y buscan marcadores de respuesta en ese idioma, así que debe coincidir con el idioma en que habla el agente evaluado.
|
|
82
|
+
|
|
83
|
+
## Diseño
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Transport (Protocol) cómo hablarle al agente (HTTP real o grabado)
|
|
87
|
+
│
|
|
88
|
+
▼
|
|
89
|
+
Probe.run(transport) ──► ProbeResult findings + defensas observadas + no evaluable
|
|
90
|
+
│
|
|
91
|
+
▼
|
|
92
|
+
scan(...) ──► Assessment ──► render_markdown() ──► informe
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **Transporte abstracto:** las sondas son testeables sin red inyectando respuestas grabadas de agentes reales.
|
|
96
|
+
- **Resiliente:** si una sonda falla (p. ej. el endpoint se cae a mitad de auditoría), se registra como "no evaluable" y la evaluación continúa — igual que en una auditoría real.
|
|
97
|
+
- **El informe es el producto:** el vocabulario del código (severidades, taxonomía OWASP) es el que aparece literalmente en el entregable.
|
|
98
|
+
|
|
99
|
+
## Desarrollo
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install -e ".[dev]"
|
|
103
|
+
pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Licencia
|
|
107
|
+
|
|
108
|
+
Apache-2.0. La metodología es abierta; los informes de clientes, no.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
*Autor: Giocrisrai Godoy Bonillo — Ingeniería de IA para sistemas en producción. Mantiene agentes LLM en producción, no solo los prueba.*
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# agent-assurance
|
|
2
|
+
|
|
3
|
+
**English** · [Español](README.es.md)
|
|
4
|
+
|
|
5
|
+
**A methodology and test harness for assessing the security of LLM agents and applications in production**, mapped to the [OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/) and the NIST AI RMF.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/Giocrisrai/agent-assurance/actions)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
**[▶ See a sample report](https://giocrisrai.github.io/agent-assurance/)** — generated on every push by the offline demo scan, against a recorded vulnerable agent.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
> Distilled from real audits of conversational agents in production. This repository publishes the **methodology and the harness**; the reports delivered to clients are confidential.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Why it exists
|
|
20
|
+
|
|
21
|
+
Companies are shipping LLM agents (customer service, HR, sales, quoting) very fast, and **almost none of them get audited**. The attack surface is not the one a classic web pentest covers: it is system-prompt leakage, tampering with business data, excessive agency and unbounded consumption. `agent-assurance` turns those checks into tests that are **repeatable, auditable and comparable between assessments**.
|
|
22
|
+
|
|
23
|
+
The central design principle: **a probe that finds nothing is not a failure. It is a working defense, observed**, and the report records it as such. That is the difference between an audit and a list of complaints.
|
|
24
|
+
|
|
25
|
+
## Ethical scope (a project invariant)
|
|
26
|
+
|
|
27
|
+
Probes prove that a vector **exists**. They never exploit it:
|
|
28
|
+
|
|
29
|
+
- No sustained flooding or DoS: only minimal bursts to observe the rate limit.
|
|
30
|
+
- No email is sent to real third parties.
|
|
31
|
+
- The debugger PIN is never derived and no code is executed on the target server.
|
|
32
|
+
- Every test respects the target's rate limit.
|
|
33
|
+
|
|
34
|
+
Use it **only on systems you own or have explicit written authorization to test**.
|
|
35
|
+
|
|
36
|
+
## Probe catalog
|
|
37
|
+
|
|
38
|
+
| Probe | OWASP | What it detects |
|
|
39
|
+
|-------|-------|-----------------|
|
|
40
|
+
| `verbose-errors` | LLM02 | Raw errors from the LLM provider returned to the client (leaks provider, content policy, versions). |
|
|
41
|
+
| `type-confusion` | CONFIG | Unexpected input type → unhandled exception; with Flask `debug=True` it exposes the Werkzeug debugger (**potential RCE**). |
|
|
42
|
+
| `system-prompt-leak` | LLM07 | System-prompt extraction through sentence continuation and an "internal audit" pretext. |
|
|
43
|
+
| `data-integrity` | LLM01 | The agent accepts user-supplied data as authoritative (confirms made-up prices). |
|
|
44
|
+
| `unbounded-input` | LLM10 | No input length cap → token-cost amplification. |
|
|
45
|
+
|
|
46
|
+
Each probe produces `Finding`s with severity, impact, fix and **reproducible evidence** (trimmed request and response).
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# The PyPI package is `llm-agent-assurance` (the name `agent-assurance` on PyPI
|
|
52
|
+
# belongs to an unrelated project). The command and the import keep the short name.
|
|
53
|
+
pip install llm-agent-assurance
|
|
54
|
+
|
|
55
|
+
# See the methodology end to end against a recorded demo agent (no network):
|
|
56
|
+
agent-assurance demo # add --lang es for the Spanish report
|
|
57
|
+
|
|
58
|
+
# Audit a real chat endpoint (POST JSON {"message": "..."}):
|
|
59
|
+
agent-assurance scan https://your-service/api/chat --field message
|
|
60
|
+
|
|
61
|
+
# Audit a Spanish-speaking agent (Spanish probes and report):
|
|
62
|
+
agent-assurance scan https://your-service/api/chat --field mensaje --lang es
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
As a library:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from agent_assurance import scan, render_markdown, HttpTransport
|
|
69
|
+
|
|
70
|
+
transport = HttpTransport(
|
|
71
|
+
url="https://your-service/api/chat",
|
|
72
|
+
body_builder=lambda msg: {"message": msg},
|
|
73
|
+
extract=lambda data: data.get("reply", ""),
|
|
74
|
+
)
|
|
75
|
+
assessment = scan(transport, target_label="HR agent v2", lang="en") # "en" (default) or "es"
|
|
76
|
+
print(render_markdown(assessment, lang="en")) # Markdown report, ready for the client
|
|
77
|
+
print("Max severity:", assessment.max_severity.label("en"))
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
In CI, `agent-assurance scan` exits with code `2` when any finding is High or Critical. Use it as a gate before promoting an agent to production.
|
|
81
|
+
|
|
82
|
+
> **Language note.** Reports, probe prompts and the recorded demo agent are in English by default. Pass `--lang es` (CLI) or `lang="es"` (library) for Spanish. Probes talk to the target in the chosen language and look for response markers in that language, so set it to the language the target agent speaks.
|
|
83
|
+
|
|
84
|
+
## Design
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Transport (Protocol) how to talk to the agent (real HTTP or recorded)
|
|
88
|
+
│
|
|
89
|
+
▼
|
|
90
|
+
Probe.run(transport) ──► ProbeResult findings + observed defenses + not assessable
|
|
91
|
+
│
|
|
92
|
+
▼
|
|
93
|
+
scan(...) ──► Assessment ──► render_markdown() ──► report
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- **Abstract transport:** probes are testable without a network by injecting recorded responses from real agents.
|
|
97
|
+
- **Resilient:** if a probe fails (for example, the endpoint goes down mid-audit), it is recorded as "not assessable" and the assessment continues, as it would in a real audit.
|
|
98
|
+
- **The report is the product:** the vocabulary in the code (severities, OWASP taxonomy) is the one that appears in the deliverable.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install -e ".[dev]"
|
|
104
|
+
pytest
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Apache-2.0. The methodology is open; client reports are not.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
*Author: [Giocrisrai Godoy Bonillo](https://giocrisrai.com) — AI Engineer. I audit LLM agents in production and also build and operate them. Available for LLM security assessments: contact@giocrisrai.com*
|
|
Binary file
|
|
Binary file
|
|
File without changes
|