trustweave 0.1.1__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.
- trustweave-0.1.1/LICENSE +202 -0
- trustweave-0.1.1/PKG-INFO +289 -0
- trustweave-0.1.1/README.md +254 -0
- trustweave-0.1.1/pyproject.toml +79 -0
- trustweave-0.1.1/setup.cfg +4 -0
- trustweave-0.1.1/src/trustweave/__init__.py +3 -0
- trustweave-0.1.1/src/trustweave/cli.py +464 -0
- trustweave-0.1.1/src/trustweave/diff.py +268 -0
- trustweave-0.1.1/src/trustweave/engine.py +122 -0
- trustweave-0.1.1/src/trustweave/evidence.py +98 -0
- trustweave-0.1.1/src/trustweave/framework_import.py +154 -0
- trustweave-0.1.1/src/trustweave/io.py +79 -0
- trustweave-0.1.1/src/trustweave/mcp_import.py +146 -0
- trustweave-0.1.1/src/trustweave/mcp_profile.py +218 -0
- trustweave-0.1.1/src/trustweave/models.py +318 -0
- trustweave-0.1.1/src/trustweave/policy_review.py +152 -0
- trustweave-0.1.1/src/trustweave/report.py +420 -0
- trustweave-0.1.1/src/trustweave/sarif.py +149 -0
- trustweave-0.1.1/src/trustweave/scenarios.py +234 -0
- trustweave-0.1.1/src/trustweave/statement.py +41 -0
- trustweave-0.1.1/src/trustweave/trace_review.py +211 -0
- trustweave-0.1.1/src/trustweave.egg-info/PKG-INFO +289 -0
- trustweave-0.1.1/src/trustweave.egg-info/SOURCES.txt +36 -0
- trustweave-0.1.1/src/trustweave.egg-info/dependency_links.txt +1 -0
- trustweave-0.1.1/src/trustweave.egg-info/entry_points.txt +2 -0
- trustweave-0.1.1/src/trustweave.egg-info/requires.txt +12 -0
- trustweave-0.1.1/src/trustweave.egg-info/top_level.txt +1 -0
- trustweave-0.1.1/tests/test_adversarial_scenarios.py +46 -0
- trustweave-0.1.1/tests/test_diff.py +145 -0
- trustweave-0.1.1/tests/test_foundation_hardening.py +144 -0
- trustweave-0.1.1/tests/test_framework_import.py +83 -0
- trustweave-0.1.1/tests/test_mcp_import.py +87 -0
- trustweave-0.1.1/tests/test_mcp_profile.py +93 -0
- trustweave-0.1.1/tests/test_policy_review.py +130 -0
- trustweave-0.1.1/tests/test_sarif.py +151 -0
- trustweave-0.1.1/tests/test_statement.py +49 -0
- trustweave-0.1.1/tests/test_trace_review.py +113 -0
- trustweave-0.1.1/tests/test_trustweave.py +133 -0
trustweave-0.1.1/LICENSE
ADDED
|
@@ -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,289 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trustweave
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Local-first security build evidence for AI agent trust boundaries.
|
|
5
|
+
Author: TrustWeave Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/MohammadThabetHassan/trustweave
|
|
8
|
+
Project-URL: Documentation, https://github.com/MohammadThabetHassan/trustweave/tree/main/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/MohammadThabetHassan/trustweave
|
|
10
|
+
Project-URL: Issues, https://github.com/MohammadThabetHassan/trustweave/issues
|
|
11
|
+
Keywords: ai-agents,security,mcp,policy,supply-chain,attestation
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: yaml
|
|
25
|
+
Requires-Dist: PyYAML>=6.0; extra == "yaml"
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: PyYAML>=6.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=7.0; extra == "dev"
|
|
30
|
+
Requires-Dist: hypothesis>=6.0; extra == "dev"
|
|
31
|
+
Requires-Dist: cyclonedx-bom>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.8; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.13; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# TrustWeave
|
|
37
|
+
|
|
38
|
+
> **Review AI-agent trust-boundary changes like code.**
|
|
39
|
+
|
|
40
|
+
TrustWeave is a local-first developer tool for reviewing the declared data sources, tools, and policy decisions of an AI agent. It turns a small, versioned manifest plus a deterministic policy into reviewable JSON and Markdown evidence. It can also compare two declared architectures and review a **pre-recorded local trace** without executing an agent, tool, model, MCP server, or network request.
|
|
41
|
+
|
|
42
|
+
TrustWeave is deliberately narrow: it gives reviewers visible evidence before a configuration change becomes deployed behavior. It is **not** a runtime enforcement gateway, a vulnerability scanner for live systems, or proof that an agent is secure.
|
|
43
|
+
|
|
44
|
+
## Start here
|
|
45
|
+
|
|
46
|
+
| If you need to… | Start with… | Result |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Review an agent’s declared sources, tools, and flows | [`scan`](docs/CLI_REFERENCE.md#scan) | An Agent Security Bundle with deterministic decisions for every declared flow. |
|
|
49
|
+
| Verify expected policy behavior in CI | [`test`](docs/CLI_REFERENCE.md#test) | Synthetic policy-regression evidence that uses no real systems or data. |
|
|
50
|
+
| Learn a cited synthetic adversarial pattern and its policy boundary | [`explain`](docs/CLI_REFERENCE.md#explain) | Local Markdown explanation; no prompt, payload, model, or tool execution. |
|
|
51
|
+
| Review whether a candidate configuration changed security-relevant paths | [`diff`](docs/CLI_REFERENCE.md#diff) | A baseline-versus-candidate review artifact and focused signals. |
|
|
52
|
+
| Review the declared human-approval boundary for high-impact paths | [`policy-check`](docs/CLI_REFERENCE.md#policy-check) | Static evidence that approval controls are declared, bound to the action context, and fail closed. |
|
|
53
|
+
| Review a local trace of what was recorded | [`trace-review`](docs/TRACE_REVIEW.md) | A privacy-preserving comparison between trace metadata, declared flows, and policy decisions. |
|
|
54
|
+
| Review an MCP integration’s declared metadata before connection | [`mcp-profile-check`](docs/MCP_PROFILE.md) | A static mapping and authorization-expectation review with no server discovery or token handling. |
|
|
55
|
+
| Turn local MCP metadata into human-resolved security evidence | [`Local reviewer workflow`](docs/REVIEWER_WORKFLOW.md) | A non-authorizing inventory → scaffold → reviewed manifest and policy process. |
|
|
56
|
+
| Export review findings for a compatible static-analysis consumer | [`sarif`](docs/CLI_REFERENCE.md#sarif) | A deterministic local SARIF 2.1.0 artifact; no automatic upload occurs. |
|
|
57
|
+
| Understand limits, artifact meanings, and release checks | [`docs/QUALITY.md`](docs/QUALITY.md) | The exact local and hosted evidence required for a release. |
|
|
58
|
+
|
|
59
|
+
## Safety boundary
|
|
60
|
+
|
|
61
|
+
> **TrustWeave reads local declarative files and pre-recorded structured trace metadata only.** It does not execute tool configurations, connect to MCP servers, call models, access credentials, send network traffic, scan hosts, or perform business actions.
|
|
62
|
+
|
|
63
|
+
Trace review deliberately excludes message content and tool arguments from reports. A finding means that a reviewer should compare local evidence with the declared manifest and policy; it is **not** a vulnerability verdict, incident conclusion, or deployment authorization.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
Install the released package from PyPI:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
python -m pip install trustweave
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The active repository remains private. Authorized collaborators can instead clone it for source development:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/MohammadThabetHassan/trustweave.git
|
|
77
|
+
cd trustweave
|
|
78
|
+
python -m pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
TrustWeave supports Python 3.11 or later. The core JSON workflow has no required runtime dependencies. Safe YAML parsing is optional through `PyYAML`.
|
|
82
|
+
|
|
83
|
+
### 1. Generate declared-architecture evidence
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
rm -rf artifacts
|
|
87
|
+
|
|
88
|
+
trustweave scan \
|
|
89
|
+
--manifest examples/support-agent.manifest.json \
|
|
90
|
+
--policy policies/default-policy.json \
|
|
91
|
+
--output-dir artifacts
|
|
92
|
+
|
|
93
|
+
trustweave test \
|
|
94
|
+
--policy policies/default-policy.json \
|
|
95
|
+
--scenarios scenarios/default-scenarios.json \
|
|
96
|
+
--output-dir artifacts
|
|
97
|
+
|
|
98
|
+
trustweave attest \
|
|
99
|
+
--source-revision "$(git rev-parse --short HEAD 2>/dev/null || echo local)" \
|
|
100
|
+
--output-dir artifacts
|
|
101
|
+
|
|
102
|
+
trustweave report --output-dir artifacts
|
|
103
|
+
trustweave verify --attestation artifacts/attestation.json
|
|
104
|
+
trustweave policy-check \
|
|
105
|
+
--policy policies/default-policy.json \
|
|
106
|
+
--output-dir artifacts \
|
|
107
|
+
--exit-on-review
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The reference policy declares a review-queue approval boundary for its conditional-to-external path. `policy-check` records that declaration and produces review findings if a high-impact approval path lacks a declared control, lacks bindings to the actor, exact action context, and expiry, or does not fail closed. It does **not** implement a queue, authenticate a reviewer, or validate approval at runtime.
|
|
111
|
+
|
|
112
|
+
The reference agent is fully synthetic. It includes an allowed retrieval path, a confidential-data path that requires approval before a mock external action, and an intentionally unsafe untrusted-content-to-external-action path that policy denies.
|
|
113
|
+
|
|
114
|
+
### 2. Exercise cited synthetic adversarial patterns
|
|
115
|
+
|
|
116
|
+
TrustWeave includes a curated library of entirely synthetic, taxonomy-cited trust-boundary patterns. It models labels and expected policy outcomes—not prompts, payloads, target systems, or live exploitation:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
trustweave test \
|
|
120
|
+
--policy policies/default-policy.json \
|
|
121
|
+
--scenarios scenarios/adversarial-scenarios.json \
|
|
122
|
+
--output-dir artifacts/adversarial
|
|
123
|
+
|
|
124
|
+
trustweave explain \
|
|
125
|
+
--scenarios scenarios/adversarial-scenarios.json \
|
|
126
|
+
--scenario-id TW-ADV-001
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The library covers prompt-injection-shaped retrieved context, tool-misuse-shaped metadata, confused-deputy paths, excessive agency, sensitive-data routes, supply-chain metadata, and approval-boundary cases using OWASP and MITRE references. A passing result demonstrates only the local policy decision for that synthetic label pair. See [`docs/SCENARIOS.md`](docs/SCENARIOS.md).
|
|
130
|
+
|
|
131
|
+
### 3. Review a recorded local trace
|
|
132
|
+
|
|
133
|
+
A trace is **evidence**, not an instruction. The examples contain only synthetic text and mock tool names.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
trustweave trace-review \
|
|
137
|
+
--manifest examples/support-agent.manifest.json \
|
|
138
|
+
--policy policies/default-policy.json \
|
|
139
|
+
--trace examples/traces/clear-support-trace.json \
|
|
140
|
+
--output-dir artifacts/trace-clear \
|
|
141
|
+
--exit-on-review
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The clear trace exits with status `0`. The following deliberately review-required trace records an untrusted-context event followed by a call that the declared policy denies. It writes evidence and exits with `1` only because `--exit-on-review` was requested.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
trustweave trace-review \
|
|
148
|
+
--manifest examples/support-agent.manifest.json \
|
|
149
|
+
--policy policies/default-policy.json \
|
|
150
|
+
--trace examples/traces/review-required-support-trace.json \
|
|
151
|
+
--output-dir artifacts/trace-review \
|
|
152
|
+
--exit-on-review
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
See the complete privacy, input, and exit-code contract in [`docs/TRACE_REVIEW.md`](docs/TRACE_REVIEW.md).
|
|
156
|
+
|
|
157
|
+
### 4. Review a candidate architecture change
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
rm -rf review-artifacts
|
|
161
|
+
|
|
162
|
+
trustweave scan \
|
|
163
|
+
--manifest examples/support-agent.manifest.json \
|
|
164
|
+
--policy policies/default-policy.json \
|
|
165
|
+
--output-dir review-artifacts/base
|
|
166
|
+
|
|
167
|
+
trustweave scan \
|
|
168
|
+
--manifest examples/support-agent.candidate.manifest.json \
|
|
169
|
+
--policy policies/default-policy.json \
|
|
170
|
+
--output-dir review-artifacts/head
|
|
171
|
+
|
|
172
|
+
trustweave diff \
|
|
173
|
+
--base review-artifacts/base/agent-security-bundle.json \
|
|
174
|
+
--head review-artifacts/head/agent-security-bundle.json \
|
|
175
|
+
--output-dir review-artifacts/diff
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The candidate adds a synthetic external archive capability. Its untrusted-input path remains denied, but the diff emits a review signal because a human should confirm that the new capability and policy coverage are intentional.
|
|
179
|
+
|
|
180
|
+
To review a **capability change on an existing sensitive tool**, scan `examples/support-agent.capability-growth.manifest.json` as the head bundle and diff it against the baseline. The generated diff inventories `customer-record.export` as an added capability and emits `TW-DIFF-003`, a least-privilege review signal. The candidate is declarative and synthetic: it does not export a record or enable a runtime action.
|
|
181
|
+
|
|
182
|
+
### 5. Export local review evidence as SARIF
|
|
183
|
+
|
|
184
|
+
After generating one or more review artifacts, export their existing findings as deterministic SARIF 2.1.0 data:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
trustweave sarif \
|
|
188
|
+
--policy-review artifacts/policy-review.json \
|
|
189
|
+
--output artifacts/trustweave.sarif
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The command is a local format conversion only. It preserves review identifiers, messages, and artifact locations, creates stable result fingerprints, and does **not** upload to GitHub, enable code scanning, connect to a service, or make a runtime-security claim. See the [SARIF CLI contract](docs/CLI_REFERENCE.md#sarif).
|
|
193
|
+
|
|
194
|
+
### 6. Normalize an already-recorded MCP tools list
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
trustweave mcp-import \
|
|
198
|
+
--tool-list examples/mcp-tools/support-tools-list.json \
|
|
199
|
+
--output-dir artifacts/mcp-inventory
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
This strictly validates and sorts a supplied MCP `tools/list` snapshot into an inventory. It does **not** fetch the list, open a transport, infer authorization or an action class, process credentials, or call a tool. MCP annotations remain review metadata and are not trusted authority. See [`docs/MCP_IMPORT.md`](docs/MCP_IMPORT.md).
|
|
203
|
+
|
|
204
|
+
### 7. Review declared MCP metadata without connecting
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
trustweave mcp-profile-check \
|
|
208
|
+
--manifest examples/support-agent.manifest.json \
|
|
209
|
+
--profile examples/mcp-profiles/clear-support-profile.json \
|
|
210
|
+
--output-dir artifacts/mcp-clear \
|
|
211
|
+
--exit-on-review
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
This maps an explicit local MCP metadata profile to the Agent Security Manifest. It does **not** discover a server, open HTTP or stdio, retrieve metadata, exchange credentials, validate a token, or invoke a tool. See [`docs/MCP_PROFILE.md`](docs/MCP_PROFILE.md) for the strict input and review contract.
|
|
215
|
+
|
|
216
|
+
## Evidence workflow
|
|
217
|
+
|
|
218
|
+
```mermaid
|
|
219
|
+
flowchart LR
|
|
220
|
+
M[Declared agent manifest] --> S[scan]
|
|
221
|
+
P[Deterministic policy] --> S
|
|
222
|
+
S --> B[Agent Security Bundle]
|
|
223
|
+
B --> D[diff]
|
|
224
|
+
B --> R[report]
|
|
225
|
+
P --> T[test]
|
|
226
|
+
C[Synthetic scenarios] --> T
|
|
227
|
+
T --> E[Regression results]
|
|
228
|
+
B --> A[attest]
|
|
229
|
+
E --> A
|
|
230
|
+
L[Local trace metadata] --> TR[trace-review]
|
|
231
|
+
M --> TR
|
|
232
|
+
P --> TR
|
|
233
|
+
TR --> TE[Trace review artifacts]
|
|
234
|
+
MP[Local MCP metadata profile] --> MC[mcp-profile-check]
|
|
235
|
+
M --> MC
|
|
236
|
+
MC --> ME[MCP profile review artifacts]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
| Command | Primary artifact | What the artifact establishes | What it does **not** establish |
|
|
240
|
+
|---|---|---|---|
|
|
241
|
+
| `scan` | `agent-security-bundle.json` | Deterministic decisions for every **declared** flow. | Runtime discovery, tool execution, or security of a deployed agent. |
|
|
242
|
+
| `test` | `security-test-results.json` | Whether synthetic trust/action scenarios match the current policy. | Model-level behavior or a live attack result. |
|
|
243
|
+
| `policy-check` | `policy-review.json` and `.md` | Structural policy findings such as shadowed rules or review-sensitive allow/default decisions. | Correct business authorization or runtime enforcement. |
|
|
244
|
+
| `diff` | `bundle-diff.json` and `.md` | Declared source, tool, **capability**, path, rule, and decision changes between bundles. | Undeclared runtime behavior or a vulnerability verdict. |
|
|
245
|
+
| `trace-review` | `trace-review.json` and `.md` | Mismatches between safe local trace metadata, declared flows, and policy decisions. | Trace authenticity, full incident reconstruction, or message-content inspection. |
|
|
246
|
+
| `mcp-profile-check` | `mcp-profile-review.json` and `.md` | Mismatches between a local MCP profile and declared manifest tool/action-class mappings. | Server discovery, OAuth, token validation, MCP conformance, or live capability validation. |
|
|
247
|
+
| `attest` and `verify` | `attestation.json` | Internal hash-chain consistency among local artifacts. | External signing, identity, non-repudiation, or transparency-log inclusion. |
|
|
248
|
+
|
|
249
|
+
## Documentation map
|
|
250
|
+
|
|
251
|
+
| Document | Purpose |
|
|
252
|
+
|---|---|
|
|
253
|
+
| [CLI reference](docs/CLI_REFERENCE.md) | Inputs, outputs, exit codes, and errors for every command. |
|
|
254
|
+
| [Trace review guide](docs/TRACE_REVIEW.md) | Trace contract, privacy boundary, review outcomes, and CI usage. |
|
|
255
|
+
| [MCP metadata profile guide](docs/MCP_PROFILE.md) | Safe profile contract, mapping review, and strict non-connection boundary. |
|
|
256
|
+
| [Local reviewer workflow](docs/REVIEWER_WORKFLOW.md) | Human-resolved inventory, scaffold, manifest, policy, and evidence sequence. |
|
|
257
|
+
| [Architecture](docs/ARCHITECTURE.md) | Components, data flows, invariants, and extension boundaries. |
|
|
258
|
+
| [Product contract](docs/PRODUCT_CONTRACT.md) | Explicit user promises, non-goals, and acceptance evidence. |
|
|
259
|
+
| [Threat model](docs/THREAT_MODEL.md) | Assumptions, control boundaries, and out-of-scope threats. |
|
|
260
|
+
| [Quality evidence](docs/QUALITY.md) | Required local and hosted checks before a direct commit or release. |
|
|
261
|
+
| [Schema and compatibility](docs/SCHEMA_AND_COMPATIBILITY.md) | Current schemas and rules for compatible changes. |
|
|
262
|
+
| [Roadmap](docs/ROADMAP.md) | Planned work and deliberately deferred integrations. |
|
|
263
|
+
| [Release procedure](docs/RELEASE.md) | Versioning, evidence, and authorization gates for releases. |
|
|
264
|
+
|
|
265
|
+
## Local verification
|
|
266
|
+
|
|
267
|
+
The repository CI verifies the same core controls. Run these commands from a clean checkout before a direct commit:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
python -m pip install -e . bandit build pip-audit pytest ruff mypy PyYAML
|
|
271
|
+
|
|
272
|
+
ruff format --check .
|
|
273
|
+
ruff check .
|
|
274
|
+
mypy src
|
|
275
|
+
bandit -r src/trustweave -q
|
|
276
|
+
pytest
|
|
277
|
+
python -m build
|
|
278
|
+
pip-audit -r requirements.txt
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The hosted **Quality and tests** workflow also validates local documentation links, schemas, workflow YAML, and CLI documentation; builds an isolated wheel; runs policy, bundle-diff, capability-growth, offline trace, and MCP metadata references; and uploads generated evidence.
|
|
282
|
+
|
|
283
|
+
## Contributing and security
|
|
284
|
+
|
|
285
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before proposing a change. Contributions must preserve the non-executing core, use synthetic examples, include deterministic tests, state explicit limits, and avoid real credentials, personal data, external targets, or hidden side effects.
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
TrustWeave is distributed under the [Apache License 2.0](LICENSE).
|