veritrail 0.3.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.
- veritrail-0.3.0/LICENSE +201 -0
- veritrail-0.3.0/PKG-INFO +276 -0
- veritrail-0.3.0/README.md +251 -0
- veritrail-0.3.0/pyproject.toml +38 -0
- veritrail-0.3.0/setup.cfg +4 -0
- veritrail-0.3.0/tests/test_api.py +143 -0
- veritrail-0.3.0/tests/test_crypto.py +56 -0
- veritrail-0.3.0/tests/test_engine.py +215 -0
- veritrail-0.3.0/tests/test_extended.py +184 -0
- veritrail-0.3.0/tests/test_fuzz_1000.py +209 -0
- veritrail-0.3.0/tests/test_ledger_tamper.py +76 -0
- veritrail-0.3.0/tests/test_postgres.py +153 -0
- veritrail-0.3.0/tests/test_scope.py +71 -0
- veritrail-0.3.0/veritrail/__init__.py +98 -0
- veritrail-0.3.0/veritrail/action.py +126 -0
- veritrail-0.3.0/veritrail/api/__init__.py +0 -0
- veritrail-0.3.0/veritrail/api/server.py +320 -0
- veritrail-0.3.0/veritrail/audit.py +65 -0
- veritrail-0.3.0/veritrail/cli.py +83 -0
- veritrail-0.3.0/veritrail/crypto.py +132 -0
- veritrail-0.3.0/veritrail/delegation.py +141 -0
- veritrail-0.3.0/veritrail/detection.py +225 -0
- veritrail-0.3.0/veritrail/engine.py +654 -0
- veritrail-0.3.0/veritrail/errors.py +35 -0
- veritrail-0.3.0/veritrail/forensics.py +232 -0
- veritrail-0.3.0/veritrail/ledger.py +191 -0
- veritrail-0.3.0/veritrail/persistence.py +339 -0
- veritrail-0.3.0/veritrail/principals.py +107 -0
- veritrail-0.3.0/veritrail/revocation.py +91 -0
- veritrail-0.3.0/veritrail/scope.py +163 -0
- veritrail-0.3.0/veritrail.egg-info/PKG-INFO +276 -0
- veritrail-0.3.0/veritrail.egg-info/SOURCES.txt +34 -0
- veritrail-0.3.0/veritrail.egg-info/dependency_links.txt +1 -0
- veritrail-0.3.0/veritrail.egg-info/entry_points.txt +2 -0
- veritrail-0.3.0/veritrail.egg-info/requires.txt +12 -0
- veritrail-0.3.0/veritrail.egg-info/top_level.txt +1 -0
veritrail-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
veritrail-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veritrail
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Verifiable provenance and forensics for autonomous AI agents — a tamper-evident flight recorder and cryptographic chain-of-custody for agentic actions.
|
|
5
|
+
Author: Veritrail
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: ai-agents,provenance,audit,security,forensics,owasp,nist,delegation
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Intended Audience :: Information Technology
|
|
10
|
+
Classifier: Topic :: Security
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: cryptography>=42.0
|
|
15
|
+
Requires-Dist: fastapi>=0.110
|
|
16
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
17
|
+
Requires-Dist: pydantic>=2.6
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
20
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
21
|
+
Provides-Extra: postgres
|
|
22
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
|
|
23
|
+
Requires-Dist: psycopg_pool>=3.2; extra == "postgres"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Veritrail — Provenance and Forensics for AI Agents
|
|
27
|
+
|
|
28
|
+
[](https://github.com/rsh1k/veritrail/actions/workflows/ci.yml)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
[](pyproject.toml)
|
|
31
|
+
|
|
32
|
+
**A tamper-evident flight recorder and cryptographic chain-of-custody for autonomous AI agents.** Veritrail proves which human authorized which agent to take which action — even five delegations deep — detects when an agent's authority has been hijacked, and keeps an audit trail you can still trust months later.
|
|
33
|
+
|
|
34
|
+
> Built around the OWASP Top 10 for Agentic Applications (2026) and NIST cryptographic standards. Ships as a Python SDK, a REST service, and a one-command Docker deployment.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## The problem nobody else is solving
|
|
39
|
+
|
|
40
|
+
AI agents have stopped just answering questions. They file tickets, move money, deploy code, and spin up other agents to help. The moment an agent *acts*, a question appears that traditional security tooling can't answer: **when something goes wrong, who actually authorized it?**
|
|
41
|
+
|
|
42
|
+
OAuth and API keys prove a single hop — "this token is valid right now." They say nothing about the agent three delegations down the chain that inherited that authority, drifted from its original goal, and wired money to the wrong account. By the time an auditor asks "show me the human who approved this," the trail is a pile of unstructured logs that anyone with database access could have rewritten.
|
|
43
|
+
|
|
44
|
+
This is the gap Veritrail closes. It treats every delegation of authority as a signed, attenuating capability, records every action in a tamper-evident ledger, and lets you reconstruct and cryptographically verify the entire chain back to a human being — on demand, for any action, forever.
|
|
45
|
+
|
|
46
|
+
Nearly four in ten organizations have already had an AI agent exceed its intended access. If you are putting agents into production in a regulated industry — banking, insurance, healthcare, anything with an audit committee — this is the layer your CISO is going to ask for.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## How Veritrail is different
|
|
51
|
+
|
|
52
|
+
Most agent-security products watch traffic and score prompts. Veritrail works one layer deeper: it makes **authority itself** verifiable and **history** impossible to quietly rewrite.
|
|
53
|
+
|
|
54
|
+
- **Attenuated delegation.** Every grant is an Ed25519-signed capability. When an agent delegates to a sub-agent, the child's scope must be a subset of the parent's — authority can only ever shrink as it flows down a chain. Privilege escalation is rejected the moment someone tries to issue it, not discovered later.
|
|
55
|
+
- **Cryptographic chain reconstruction.** Point Veritrail at any action and it walks every hop, checks every signature and every attenuation step, confirms nothing in the chain has been revoked, and verifies the chain ends at a real human. No human root, a broken link, or a revoked grant means the action is *not authorized* — full stop.
|
|
56
|
+
- **A tamper-evident ledger.** Every record carries the hash of the one before it. Edit, reorder, or delete any past entry and the chain breaks; a single pass detects it. Publish the head hash to an external witness and even truncation of recent history becomes detectable.
|
|
57
|
+
- **Explainable hijack detection.** Findings map to the OWASP Top 10 for Agentic Applications (2026), so your SOC triages in a vocabulary it already speaks rather than yet another vendor taxonomy.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## What it catches
|
|
62
|
+
|
|
63
|
+
Veritrail's detectors cover eight of the ten OWASP ASI 2026 risk categories. Each finding is deterministic and explainable — no black-box score you can't defend in an incident review.
|
|
64
|
+
|
|
65
|
+
| OWASP code | Risk | How Veritrail detects it |
|
|
66
|
+
|------------|------|--------------------------|
|
|
67
|
+
| **ASI01 / ASI02** | Agent Goal Hijack / Tool Misuse | Action falls outside the tools, actions, or risk ceiling the chain granted |
|
|
68
|
+
| **ASI03** | Identity & Privilege Abuse | Bad signature, actor isn't the delegation's subject, expired authority, or a revoked grant/principal |
|
|
69
|
+
| **ASI06** | Memory & Context Poisoning | The action's stated intent diverges from the purpose it was delegated for |
|
|
70
|
+
| **ASI07** | Insecure Inter-Agent Communication | A delegation handed between agents fails signature verification (a spoofed grant) |
|
|
71
|
+
| **ASI08** | Cascading Failures | Abnormally high action fan-out under a single grant in a short window — the blast radius of a fault |
|
|
72
|
+
| **ASI09** | Human-Agent Trust Exploitation | Consent fatigue — a high-risk action slipped through inside a burst of low-risk approvals |
|
|
73
|
+
| **ASI10** | Rogue Agents | An actor accumulates repeated blocking findings, signalling behavioral drift |
|
|
74
|
+
|
|
75
|
+
ASI04 (supply chain) and ASI05 (unexpected code execution) are deliberately left to complementary controls — MCP manifest signing and execution sandboxing — because they belong at a different layer than provenance. Veritrail is honest about its boundaries.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Install and run in five minutes
|
|
80
|
+
|
|
81
|
+
### As a Python SDK
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install -e .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from veritrail import Engine, Scope, crypto
|
|
89
|
+
|
|
90
|
+
eng = Engine()
|
|
91
|
+
|
|
92
|
+
# Enroll a human and two agents. The registry only ever holds public keys.
|
|
93
|
+
h_priv, h_pub = crypto.generate_keypair()
|
|
94
|
+
o_priv, o_pub = crypto.generate_keypair()
|
|
95
|
+
w_priv, w_pub = crypto.generate_keypair()
|
|
96
|
+
cfo = eng.register_human("Alice (CFO)", h_pub)
|
|
97
|
+
orch = eng.register_agent("Orchestrator", o_pub)
|
|
98
|
+
worker = eng.register_agent("Worker", w_pub)
|
|
99
|
+
|
|
100
|
+
# The CFO grants the orchestrator scoped authority.
|
|
101
|
+
root = eng.issue_root_delegation(
|
|
102
|
+
human_private_key=h_priv, human_id=cfo.id, agent_id=orch.id,
|
|
103
|
+
scope=Scope.make(tools={"invoices.read", "invoices.pay"},
|
|
104
|
+
actions={"read", "write"}, max_risk=60),
|
|
105
|
+
purpose="reconcile and pay approved invoices", ttl_seconds=3600,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# The orchestrator sub-delegates a narrower, read-only scope.
|
|
109
|
+
sub = eng.sub_delegate(
|
|
110
|
+
issuer_private_key=o_priv, issuer_id=orch.id, subject_id=worker.id,
|
|
111
|
+
parent_delegation_id=root.id,
|
|
112
|
+
scope=Scope.make(tools={"invoices.read"}, actions={"read"}, max_risk=20),
|
|
113
|
+
purpose="read invoices for reconciliation", ttl_seconds=1800,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# The worker records an action and gets back a verdict.
|
|
117
|
+
rec, verdict = eng.record_action(
|
|
118
|
+
actor_private_key=w_priv, actor_id=worker.id, delegation_id=sub.id,
|
|
119
|
+
tool="invoices.read", action="read", risk=10,
|
|
120
|
+
description="read approved invoice batch",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
assert verdict.authorized # passed every check
|
|
124
|
+
assert verdict.chain.human_root_name == "Alice (CFO)" # attributed to the human
|
|
125
|
+
assert eng.verify_ledger() # history is intact
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Want to see a hijack get caught? Run the narrated demo — it walks a clean three-hop chain and a compromised agent side by side, and writes two forensic HTML reports:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python -m examples.demo
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### As a REST service
|
|
135
|
+
|
|
136
|
+
Clients sign locally; the service only ever sees public keys and signatures, so **no private key material is ever sent to, stored by, or logged by the server.**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install -r requirements.txt
|
|
140
|
+
uvicorn veritrail.api.server:app --host 0.0.0.0 --port 8080
|
|
141
|
+
# interactive API docs at http://localhost:8080/docs
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
| Method & path | What it does |
|
|
145
|
+
|---------------|--------------|
|
|
146
|
+
| `GET /healthz` | Liveness probe |
|
|
147
|
+
| `POST /v1/principals` | Register a human or agent (public key only) |
|
|
148
|
+
| `POST /v1/delegations` | Ingest a client-signed delegation; re-verified server-side |
|
|
149
|
+
| `POST /v1/actions` | Ingest a client-signed action; returns the verdict |
|
|
150
|
+
| `POST /v1/revocations` | Revoke a delegation or principal |
|
|
151
|
+
| `GET /v1/actions/{id}/verdict` | Authorization verdict plus findings |
|
|
152
|
+
| `GET /v1/actions/{id}/chain` | The reconstructed chain of custody |
|
|
153
|
+
| `GET /v1/actions/{id}/report` | A self-contained forensic HTML report |
|
|
154
|
+
| `GET /v1/ledger/verify` | Tamper-evidence check across the whole ledger |
|
|
155
|
+
| `GET /v1/stats` | Counts, ledger head, Merkle root |
|
|
156
|
+
|
|
157
|
+
Turn on durable storage and an API key with two environment variables:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
export VERITRAIL_DB=/data/veritrail.db # SQLite (single node)
|
|
161
|
+
# or, for multi-replica deployments:
|
|
162
|
+
# export VERITRAIL_DB=postgresql://user:pass@host:5432/veritrail
|
|
163
|
+
export VERITRAIL_API_KEY=your-secret-key # requires Bearer auth on writes
|
|
164
|
+
uvicorn veritrail.api.server:app --host 0.0.0.0 --port 8080
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### As a container
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
docker compose up --build
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The image runs as a non-root user with a read-only root filesystem, every Linux capability dropped, `no-new-privileges` set, and a built-in health check.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Built for the enterprise
|
|
178
|
+
|
|
179
|
+
- **Durable, and ready to scale.** Point `VERITRAIL_DB` at a path for the zero-ops **SQLite** backend, or at a `postgresql://` URL for the **PostgreSQL** backend built for multi-replica deployments. Both use a write-through model (fast in-memory working set, durable storage of record). The ledger append is coordinated — across every replica, via a Postgres advisory lock — so the tamper-evident hash chain stays linear and verifiable no matter how many writers there are, and one replica can resolve records another replica wrote.
|
|
180
|
+
- **Revocation that actually revokes.** A signature proves a grant was authentic when issued; it says nothing about whether that authority is still valid. Revoke a leaked agent key or an offboarded employee and every action whose chain runs through them stops verifying immediately.
|
|
181
|
+
- **Observability that drops into your stack.** Veritrail emits structured audit events using OpenTelemetry GenAI semantic-convention field names (`gen_ai.agent.id`, `gen_ai.operation.name`, `gen_ai.tool.name`), so they flow into an OTel collector, Datadog, Splunk, or Elastic without remapping.
|
|
182
|
+
- **Hardened API surface.** Strict input validation, security headers on every response, optional bearer-token auth with constant-time comparison, and per-client rate limiting.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## How it works
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
sign locally (private keys never leave the client)
|
|
190
|
+
Human ─────────────────────────────────────────────────────┐
|
|
191
|
+
│ root delegation (Ed25519-signed) │
|
|
192
|
+
▼ │
|
|
193
|
+
Agent A ── sub-delegate (child scope ⊆ parent scope) ─► Agent B
|
|
194
|
+
│ │
|
|
195
|
+
▼ │
|
|
196
|
+
Action record │
|
|
197
|
+
│ │
|
|
198
|
+
┌──────────────────────────────────────────┘ │
|
|
199
|
+
▼ ▼
|
|
200
|
+
┌──────────────┐ verify ┌──────────────────────────────────┐
|
|
201
|
+
│ Engine │ ───────────► │ reconstruct chain → human root │
|
|
202
|
+
│ registry │ │ check revocations │
|
|
203
|
+
│ revocations │ │ run detectors → OWASP ASI findings│
|
|
204
|
+
│ ledger │ │ verdict: authorized? yes/no │
|
|
205
|
+
└──────────────┘ └──────────────────────────────────┘
|
|
206
|
+
│ append-only, hash-chained, write-through to SQLite
|
|
207
|
+
▼
|
|
208
|
+
┌──────────────┐
|
|
209
|
+
│ Tamper- │ merkle_root() / head hash → external witness
|
|
210
|
+
│ evident log │
|
|
211
|
+
└──────────────┘
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Module map: `crypto` (Ed25519, SHA-256, canonical serialization) · `scope` (capabilities and attenuation) · `principals` (registry / trust anchor) · `delegation` (signed grants) · `action` (signed action records) · `ledger` (tamper-evident log) · `revocation` (revoked grants and principals) · `detection` (per-action ASI detectors) · `engine` (the SDK, plus chain-level detectors and verdicts) · `forensics` (HTML report) · `persistence` (SQLite store) · `audit` (OpenTelemetry-friendly events) · `api` (REST service) · `cli`.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Standards alignment
|
|
219
|
+
|
|
220
|
+
**NIST.** Signatures are Ed25519 (FIPS 186-5). Hashing is SHA-256 (FIPS 180-4) across the ledger, parameter digests, and Merkle tree. The append-only, integrity-verifiable audit log follows the spirit of SP 800-92; the human-versus-agent identity separation reflects SP 800-63; and the map / measure / manage loop maps onto the NIST AI Risk Management Framework — delegated purpose and scope are the *map*, detector findings are the *measure*, and blocking plus a forensic record are the *manage*.
|
|
221
|
+
|
|
222
|
+
**OWASP.** Detectors map to the OWASP Top 10 for Agentic Applications (2026), as in the table above. The REST surface follows OWASP API security guidance: strict input validation, typed and non-leaky errors, security headers, and a hard rule that private keys are never accepted, stored, or logged.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Testing
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
pip install -e ".[dev]"
|
|
230
|
+
pytest -q
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The suite is built to be adversarial, not just to chase coverage. Alongside the unit and HTTP-level tests, five property-based tests each run **1,000 randomized samples** — five thousand scenarios in total — asserting that core invariants hold for every one:
|
|
234
|
+
|
|
235
|
+
1. A randomly-shaped but well-formed chain always reconstructs to its human root and authorizes.
|
|
236
|
+
2. Any sub-delegation that escalates privilege is rejected at issue time.
|
|
237
|
+
3. Any edit, reorder, or interior deletion of the ledger is detected (and tail truncation is caught by the head-witness check).
|
|
238
|
+
4. Any forged action signature is caught and the action is refused.
|
|
239
|
+
5. Revoking any link in a chain — or the actor — blocks the action.
|
|
240
|
+
|
|
241
|
+
That third invariant is there because the fuzzer found it: a self-contained hash chain cannot detect truncation of its most recent entries on its own, which is exactly why Veritrail exposes `verify_against_head()` for external-witness verification.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Production hardening
|
|
246
|
+
|
|
247
|
+
Veritrail is a production-grade reference implementation of the core engine. It is not a turnkey, independently-audited SaaS, and it would be dishonest to pretend otherwise. Before you bet a regulated workload on it:
|
|
248
|
+
|
|
249
|
+
- **Persistence and scale.** Use the SQLite backend (`VERITRAIL_DB=/data/veritrail.db`) for a single node or a shared volume; use the PostgreSQL backend (`VERITRAIL_DB=postgresql://...`, install with `pip install 'veritrail[postgres]'`) for multi-node, high-write deployments. Run several stateless API replicas over the shared database — ledger appends are serialized across replicas by a Postgres advisory lock, so the chain stays correct. Note: the deterministic authorization checks (signature, chain, scope, expiry, revocation, ledger integrity) are globally correct across replicas; the behavioral heuristics (consent fatigue, action fan-out) use a per-replica recent view and are best-effort across replicas.
|
|
250
|
+
- **External witness.** Publish the ledger head or Merkle root to an independent timestamping authority or transparency log on a schedule, so you can prove the log was not rewritten even by an insider with database access.
|
|
251
|
+
- **Key management.** Keep agent keys in an HSM or KMS, or a per-agent enclave; rotate and revoke them.
|
|
252
|
+
- **AuthN/Z and network.** Put the service behind mTLS or an API gateway; the built-in API key and rate limiter are backstops, not your whole access-control story.
|
|
253
|
+
- **Learned detection.** The detectors here are deterministic by design. Layer an anomaly model on top through the same `Finding` interface when you want behavioral coverage beyond the deterministic rules.
|
|
254
|
+
- **Independent audit.** Commission a third-party cryptographic and application-security review before production use.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## FAQ
|
|
259
|
+
|
|
260
|
+
**What does Veritrail actually do in one sentence?** It gives every action an AI agent takes a verifiable, tamper-evident chain of custody back to the human who authorized it, and flags the action when that chain has been hijacked.
|
|
261
|
+
|
|
262
|
+
**How is this different from agent observability tools?** Observability tools tell you *what happened*. Veritrail tells you *whether it was authorized*, proves it cryptographically, and makes the record impossible to quietly alter. They are complementary — Veritrail even emits OpenTelemetry-style events so it sits alongside your existing tracing.
|
|
263
|
+
|
|
264
|
+
**Does the server ever see my private keys?** No. Clients sign delegations and actions locally; the server only receives public keys and signatures and re-verifies everything itself.
|
|
265
|
+
|
|
266
|
+
**Which OWASP agentic risks does it cover?** Eight of the ten ASI 2026 categories: ASI01, ASI02, ASI03, ASI06, ASI07, ASI08, ASI09, and ASI10. Supply chain (ASI04) and code execution (ASI05) are left to complementary controls.
|
|
267
|
+
|
|
268
|
+
**What languages and frameworks does it work with?** The reference implementation is Python and exposes both an SDK and a language-agnostic REST API, so any agent stack that can make an HTTP request can use it.
|
|
269
|
+
|
|
270
|
+
**Is it ready for production?** The core engine is production-grade and thoroughly tested. Read the Production Hardening section above for the specific operational pieces — persistence backend, external witness, key management, independent audit — to put in place first.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
Apache-2.0.
|