probity-records 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.
- probity_records-0.2.0/LICENSE +201 -0
- probity_records-0.2.0/PKG-INFO +76 -0
- probity_records-0.2.0/README.md +57 -0
- probity_records-0.2.0/pyproject.toml +30 -0
- probity_records-0.2.0/setup.cfg +4 -0
- probity_records-0.2.0/src/probity_records/__init__.py +197 -0
- probity_records-0.2.0/src/probity_records/__main__.py +68 -0
- probity_records-0.2.0/src/probity_records/authority.py +118 -0
- probity_records-0.2.0/src/probity_records/celexpr.py +68 -0
- probity_records-0.2.0/src/probity_records/constraints.py +291 -0
- probity_records-0.2.0/src/probity_records/core.py +293 -0
- probity_records-0.2.0/src/probity_records/exports.py +146 -0
- probity_records-0.2.0/src/probity_records/governance.py +135 -0
- probity_records-0.2.0/src/probity_records/grants.py +348 -0
- probity_records-0.2.0/src/probity_records/identity.py +224 -0
- probity_records-0.2.0/src/probity_records/identity_vectors.py +135 -0
- probity_records-0.2.0/src/probity_records/journal.py +536 -0
- probity_records-0.2.0/src/probity_records/oidc_approval.py +93 -0
- probity_records-0.2.0/src/probity_records/otel.py +541 -0
- probity_records-0.2.0/src/probity_records/quorum.py +365 -0
- probity_records-0.2.0/src/probity_records/records.py +168 -0
- probity_records-0.2.0/src/probity_records/revocation.py +131 -0
- probity_records-0.2.0/src/probity_records/signing.py +347 -0
- probity_records-0.2.0/src/probity_records/walk.py +86 -0
- probity_records-0.2.0/src/probity_records/witness.py +677 -0
- probity_records-0.2.0/src/probity_records.egg-info/PKG-INFO +76 -0
- probity_records-0.2.0/src/probity_records.egg-info/SOURCES.txt +45 -0
- probity_records-0.2.0/src/probity_records.egg-info/dependency_links.txt +1 -0
- probity_records-0.2.0/src/probity_records.egg-info/requires.txt +5 -0
- probity_records-0.2.0/src/probity_records.egg-info/top_level.txt +1 -0
- probity_records-0.2.0/tests/test_break_it.py +117 -0
- probity_records-0.2.0/tests/test_exports.py +66 -0
- probity_records-0.2.0/tests/test_governance.py +121 -0
- probity_records-0.2.0/tests/test_grants.py +163 -0
- probity_records-0.2.0/tests/test_grants_attenuation.py +180 -0
- probity_records-0.2.0/tests/test_identity.py +82 -0
- probity_records-0.2.0/tests/test_oidc_approval.py +118 -0
- probity_records-0.2.0/tests/test_otel.py +312 -0
- probity_records-0.2.0/tests/test_quorum.py +104 -0
- probity_records-0.2.0/tests/test_quorum_sod.py +140 -0
- probity_records-0.2.0/tests/test_records.py +211 -0
- probity_records-0.2.0/tests/test_retry_permits.py +69 -0
- probity_records-0.2.0/tests/test_revocation.py +119 -0
- probity_records-0.2.0/tests/test_shared_canonical.py +60 -0
- probity_records-0.2.0/tests/test_signing.py +207 -0
- probity_records-0.2.0/tests/test_signing_contract.py +237 -0
- probity_records-0.2.0/tests/test_witness.py +212 -0
|
@@ -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 2026 Sankalp Gilda
|
|
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.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: probity-records
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Signed, offline-verifiable records of agent tool calls: single-use permits, approval binding and lost-reply outcomes
|
|
5
|
+
Author: Sankalp Gilda
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Source, https://github.com/probityai/probity/tree/main/packages/probity-records
|
|
8
|
+
Project-URL: Issues, https://github.com/probityai/probity/issues
|
|
9
|
+
Keywords: ai-agents,dsse,in-toto,approvals,tool-calls,audit
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: cel-expr-python==0.1.3
|
|
14
|
+
Requires-Dist: cryptography<51,>=44
|
|
15
|
+
Requires-Dist: jcs-admit~=0.1.1
|
|
16
|
+
Requires-Dist: agent-evidence-verify<0.8,>=0.5.1
|
|
17
|
+
Requires-Dist: agent-evidence-vectors<0.38,>=0.36.3
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# probity-records
|
|
21
|
+
|
|
22
|
+
Signed records of agent tool calls that anyone can check offline: a single-use permit bound to the
|
|
23
|
+
exact call arguments, the human approval it rests on, and what the call did, including a lost reply.
|
|
24
|
+
|
|
25
|
+
It is for framework integrations (Temporal, Pydantic AI) that write those records, and for the
|
|
26
|
+
auditor who verifies them without access to the system that ran the agent.
|
|
27
|
+
|
|
28
|
+
Install: `pip install probity-records==0.2.0`
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from probity_records import Journal, Signer, verify_journal
|
|
32
|
+
|
|
33
|
+
signer = Signer.generate()
|
|
34
|
+
journal = Journal("records", signer)
|
|
35
|
+
journal.append("https://example.org/predicate/v1/note", "note", "00" * 32, {"text": "hello"})
|
|
36
|
+
report = verify_journal("records", [signer.public_pem()], journal.checkpoint())
|
|
37
|
+
print(report["verdict"], report["verified"], "of", report["records"])
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
It prints `PASS 1 of 1`.
|
|
41
|
+
|
|
42
|
+
Each tool-call record carries two published contracts, and their published readers judge them:
|
|
43
|
+
`approval-binding/v1` by `agent_evidence_vectors.approvalbinding`, and `uncertain_effect/v1` by
|
|
44
|
+
`agent-evidence-verify`.
|
|
45
|
+
|
|
46
|
+
## Key custody and the customer-held witness key
|
|
47
|
+
|
|
48
|
+
The signing key does not have to live next to the agent. `VaultTransitKey`, `AwsKmsKey` and `GcpKmsKey` sign
|
|
49
|
+
through HashiCorp Vault transit, AWS KMS or Cloud KMS Ed25519, so the private key never leaves the service.
|
|
50
|
+
Each pins its public key at construction and refuses a service that answers with another one. `delegate`
|
|
51
|
+
issues a short-lived session key signed by a root key, and `verify_delegation` re-checks the certificate
|
|
52
|
+
offline. The key's provenance travels in every permit and checkpoint it signs.
|
|
53
|
+
|
|
54
|
+
The witness key belongs to the customer. The journal publishes a C2SP tlog checkpoint feed. A witness the
|
|
55
|
+
customer runs, with a key we never hold, cosigns each checkpoint over an RFC 9162 consistency proof and refuses a
|
|
56
|
+
split view with HTTP 422. `Witness` and `serve_witness` are the server, `Feed` the client. The auditor pins a
|
|
57
|
+
`c2sp.org/tlog-policy` naming that witness, and `verify_journal` then fails with `witness_quorum_not_met`
|
|
58
|
+
unless the journal carries the cosignature. An independent witness built only from `golang.org/x/mod`,
|
|
59
|
+
`transparency-dev/formats` and `transparency-dev/merkle` completes the same handshake
|
|
60
|
+
(`interop/go-witness/interop.py`).
|
|
61
|
+
|
|
62
|
+
## Authority beyond one approval
|
|
63
|
+
|
|
64
|
+
| Module | What it records and checks |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `grants` | Signed capability grants: per-tool, closed-world argument constraints (17 types, from `range` and `subpath` to `url_safe` and `shlex`), delegation that can only narrow, the grant digest in the permit |
|
|
67
|
+
| `quorum` | M-of-N approvals, one key per approver, bound to the request hash, fetched and retried while pending |
|
|
68
|
+
| `revocation` | Signed, append-only revocation lists for keys, permits and grants; root rotation; a last-known-good cache that fails closed |
|
|
69
|
+
| `governance` | Exceptions with owner, rationale and expiry under a quorum; intake, risk routing, approval, attestation and sign-off as signed steps |
|
|
70
|
+
| `exports` | `python -m probity_records seal-export`: a signed census of a governance platform export that anyone re-checks offline |
|
|
71
|
+
|
|
72
|
+
`verify_journal(path, keys, checkpoint, trust=Trust(...))` re-runs the grant, quorum, revocation and
|
|
73
|
+
governance checks from the records and the trust the auditor pins, and re-counts every human approval
|
|
74
|
+
(M of N) under the approver keys and threshold the auditor pinned, re-verifying each approver's own
|
|
75
|
+
signature. An export seal is re-checked with `verify_export_seal` or `python -m probity_records
|
|
76
|
+
verify-export`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# probity-records
|
|
2
|
+
|
|
3
|
+
Signed records of agent tool calls that anyone can check offline: a single-use permit bound to the
|
|
4
|
+
exact call arguments, the human approval it rests on, and what the call did, including a lost reply.
|
|
5
|
+
|
|
6
|
+
It is for framework integrations (Temporal, Pydantic AI) that write those records, and for the
|
|
7
|
+
auditor who verifies them without access to the system that ran the agent.
|
|
8
|
+
|
|
9
|
+
Install: `pip install probity-records==0.2.0`
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from probity_records import Journal, Signer, verify_journal
|
|
13
|
+
|
|
14
|
+
signer = Signer.generate()
|
|
15
|
+
journal = Journal("records", signer)
|
|
16
|
+
journal.append("https://example.org/predicate/v1/note", "note", "00" * 32, {"text": "hello"})
|
|
17
|
+
report = verify_journal("records", [signer.public_pem()], journal.checkpoint())
|
|
18
|
+
print(report["verdict"], report["verified"], "of", report["records"])
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It prints `PASS 1 of 1`.
|
|
22
|
+
|
|
23
|
+
Each tool-call record carries two published contracts, and their published readers judge them:
|
|
24
|
+
`approval-binding/v1` by `agent_evidence_vectors.approvalbinding`, and `uncertain_effect/v1` by
|
|
25
|
+
`agent-evidence-verify`.
|
|
26
|
+
|
|
27
|
+
## Key custody and the customer-held witness key
|
|
28
|
+
|
|
29
|
+
The signing key does not have to live next to the agent. `VaultTransitKey`, `AwsKmsKey` and `GcpKmsKey` sign
|
|
30
|
+
through HashiCorp Vault transit, AWS KMS or Cloud KMS Ed25519, so the private key never leaves the service.
|
|
31
|
+
Each pins its public key at construction and refuses a service that answers with another one. `delegate`
|
|
32
|
+
issues a short-lived session key signed by a root key, and `verify_delegation` re-checks the certificate
|
|
33
|
+
offline. The key's provenance travels in every permit and checkpoint it signs.
|
|
34
|
+
|
|
35
|
+
The witness key belongs to the customer. The journal publishes a C2SP tlog checkpoint feed. A witness the
|
|
36
|
+
customer runs, with a key we never hold, cosigns each checkpoint over an RFC 9162 consistency proof and refuses a
|
|
37
|
+
split view with HTTP 422. `Witness` and `serve_witness` are the server, `Feed` the client. The auditor pins a
|
|
38
|
+
`c2sp.org/tlog-policy` naming that witness, and `verify_journal` then fails with `witness_quorum_not_met`
|
|
39
|
+
unless the journal carries the cosignature. An independent witness built only from `golang.org/x/mod`,
|
|
40
|
+
`transparency-dev/formats` and `transparency-dev/merkle` completes the same handshake
|
|
41
|
+
(`interop/go-witness/interop.py`).
|
|
42
|
+
|
|
43
|
+
## Authority beyond one approval
|
|
44
|
+
|
|
45
|
+
| Module | What it records and checks |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `grants` | Signed capability grants: per-tool, closed-world argument constraints (17 types, from `range` and `subpath` to `url_safe` and `shlex`), delegation that can only narrow, the grant digest in the permit |
|
|
48
|
+
| `quorum` | M-of-N approvals, one key per approver, bound to the request hash, fetched and retried while pending |
|
|
49
|
+
| `revocation` | Signed, append-only revocation lists for keys, permits and grants; root rotation; a last-known-good cache that fails closed |
|
|
50
|
+
| `governance` | Exceptions with owner, rationale and expiry under a quorum; intake, risk routing, approval, attestation and sign-off as signed steps |
|
|
51
|
+
| `exports` | `python -m probity_records seal-export`: a signed census of a governance platform export that anyone re-checks offline |
|
|
52
|
+
|
|
53
|
+
`verify_journal(path, keys, checkpoint, trust=Trust(...))` re-runs the grant, quorum, revocation and
|
|
54
|
+
governance checks from the records and the trust the auditor pins, and re-counts every human approval
|
|
55
|
+
(M of N) under the approver keys and threshold the auditor pinned, re-verifying each approver's own
|
|
56
|
+
signature. An export seal is re-checked with `verify_export_seal` or `python -m probity_records
|
|
57
|
+
verify-export`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "probity-records"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Signed, offline-verifiable records of agent tool calls: single-use permits, approval binding and lost-reply outcomes"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Sankalp Gilda"}]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"cel-expr-python==0.1.3",
|
|
16
|
+
"cryptography>=44,<51",
|
|
17
|
+
"jcs-admit~=0.1.1",
|
|
18
|
+
"agent-evidence-verify>=0.5.1,<0.8",
|
|
19
|
+
"agent-evidence-vectors>=0.36.3,<0.38",
|
|
20
|
+
]
|
|
21
|
+
keywords = ["ai-agents", "dsse", "in-toto", "approvals", "tool-calls", "audit"]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Source = "https://github.com/probityai/probity/tree/main/packages/probity-records"
|
|
25
|
+
Issues = "https://github.com/probityai/probity/issues"
|
|
26
|
+
|
|
27
|
+
# Kept outside the root workspace lock, like probity-effects: the framework integrations that
|
|
28
|
+
# depend on it bring their own dependency trees.
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
dev = ["pytest>=9.2.0,<10"]
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""Signed, offline-verifiable records of agent tool calls, shared by the framework integrations."""
|
|
2
|
+
|
|
3
|
+
from .authority import GRANT_ALLOW, QUORUM_ALLOW, Trust
|
|
4
|
+
from .constraints import ConstraintError, narrows
|
|
5
|
+
from .constraints import check as check_constraint
|
|
6
|
+
from .core import (
|
|
7
|
+
APPROVAL_DOMAIN,
|
|
8
|
+
IN_TOTO_PAYLOAD_TYPE,
|
|
9
|
+
Signer,
|
|
10
|
+
admitted_loads,
|
|
11
|
+
args_digest,
|
|
12
|
+
args_sha256,
|
|
13
|
+
canonical,
|
|
14
|
+
canonical_of_received,
|
|
15
|
+
key_id,
|
|
16
|
+
load_public,
|
|
17
|
+
open_envelope,
|
|
18
|
+
pae,
|
|
19
|
+
permit_id,
|
|
20
|
+
sha256_hex,
|
|
21
|
+
sign_approval,
|
|
22
|
+
sign_envelope,
|
|
23
|
+
sign_permit,
|
|
24
|
+
statement,
|
|
25
|
+
verify_approval,
|
|
26
|
+
verify_permit,
|
|
27
|
+
)
|
|
28
|
+
from .exports import (
|
|
29
|
+
EXPORT_SEAL,
|
|
30
|
+
FieldMap,
|
|
31
|
+
compare_seals,
|
|
32
|
+
seal_export,
|
|
33
|
+
verify_export_seal,
|
|
34
|
+
)
|
|
35
|
+
from .exports import census as export_census
|
|
36
|
+
from .governance import (
|
|
37
|
+
EXCEPTION_ALLOW,
|
|
38
|
+
GOVERNANCE_EXCEPTION,
|
|
39
|
+
GOVERNANCE_STEP,
|
|
40
|
+
STEPS,
|
|
41
|
+
check_exception_call,
|
|
42
|
+
exception_body,
|
|
43
|
+
exception_digest,
|
|
44
|
+
exception_evidence,
|
|
45
|
+
route_by_risk,
|
|
46
|
+
step_predicate,
|
|
47
|
+
)
|
|
48
|
+
from .grants import (
|
|
49
|
+
CAPABILITY_GRANT,
|
|
50
|
+
grant_digest,
|
|
51
|
+
grant_evidence,
|
|
52
|
+
issue_grant,
|
|
53
|
+
raw_public,
|
|
54
|
+
verify_call_under_grant,
|
|
55
|
+
verify_chain,
|
|
56
|
+
verify_grant_allow,
|
|
57
|
+
)
|
|
58
|
+
from .journal import (
|
|
59
|
+
CHECKPOINT_TYPE,
|
|
60
|
+
JOURNAL_FILE,
|
|
61
|
+
KEYS_FILE,
|
|
62
|
+
NOT_RUN_RETRY,
|
|
63
|
+
RECONCILED_RETRY,
|
|
64
|
+
RETRY_REASONS,
|
|
65
|
+
Journal,
|
|
66
|
+
verify_journal,
|
|
67
|
+
)
|
|
68
|
+
from .quorum import APPROVAL_QUORUM, QuorumResult, request_hash, sign_vote
|
|
69
|
+
from .quorum import count as count_votes
|
|
70
|
+
from .records import (
|
|
71
|
+
APPROVAL_BINDING_CONTRACT,
|
|
72
|
+
OUTCOMES,
|
|
73
|
+
REPLIES,
|
|
74
|
+
TOOL_CALL_RECORD,
|
|
75
|
+
UNCERTAIN_EFFECT_CONTRACT,
|
|
76
|
+
build_approval_binding,
|
|
77
|
+
build_uncertain_effect,
|
|
78
|
+
embed_approval_binding,
|
|
79
|
+
judge_approval_binding,
|
|
80
|
+
judge_uncertain_effect,
|
|
81
|
+
tool_call_predicate,
|
|
82
|
+
verifier_case,
|
|
83
|
+
)
|
|
84
|
+
from .revocation import (
|
|
85
|
+
REVOCATION_LIST,
|
|
86
|
+
RevocationError,
|
|
87
|
+
RevocationState,
|
|
88
|
+
sign_revocations,
|
|
89
|
+
verify_approval_live,
|
|
90
|
+
)
|
|
91
|
+
from .signing import (
|
|
92
|
+
AwsKmsKey,
|
|
93
|
+
DelegatedKey,
|
|
94
|
+
Delegation,
|
|
95
|
+
GcpKmsKey,
|
|
96
|
+
SigningError,
|
|
97
|
+
SigningKey,
|
|
98
|
+
VaultTransitKey,
|
|
99
|
+
delegate,
|
|
100
|
+
verify_delegation,
|
|
101
|
+
)
|
|
102
|
+
from .walk import grant_permit_claims, grant_walk, mint_grant_permit
|
|
103
|
+
|
|
104
|
+
__all__ = [
|
|
105
|
+
"APPROVAL_BINDING_CONTRACT",
|
|
106
|
+
"APPROVAL_DOMAIN",
|
|
107
|
+
"APPROVAL_QUORUM",
|
|
108
|
+
"CAPABILITY_GRANT",
|
|
109
|
+
"CHECKPOINT_TYPE",
|
|
110
|
+
"EXCEPTION_ALLOW",
|
|
111
|
+
"EXPORT_SEAL",
|
|
112
|
+
"GOVERNANCE_EXCEPTION",
|
|
113
|
+
"GOVERNANCE_STEP",
|
|
114
|
+
"GRANT_ALLOW",
|
|
115
|
+
"IN_TOTO_PAYLOAD_TYPE",
|
|
116
|
+
"JOURNAL_FILE",
|
|
117
|
+
"KEYS_FILE",
|
|
118
|
+
"NOT_RUN_RETRY",
|
|
119
|
+
"OUTCOMES",
|
|
120
|
+
"QUORUM_ALLOW",
|
|
121
|
+
"RECONCILED_RETRY",
|
|
122
|
+
"REPLIES",
|
|
123
|
+
"RETRY_REASONS",
|
|
124
|
+
"REVOCATION_LIST",
|
|
125
|
+
"STEPS",
|
|
126
|
+
"TOOL_CALL_RECORD",
|
|
127
|
+
"UNCERTAIN_EFFECT_CONTRACT",
|
|
128
|
+
"AwsKmsKey",
|
|
129
|
+
"ConstraintError",
|
|
130
|
+
"DelegatedKey",
|
|
131
|
+
"Delegation",
|
|
132
|
+
"FieldMap",
|
|
133
|
+
"GcpKmsKey",
|
|
134
|
+
"Journal",
|
|
135
|
+
"QuorumResult",
|
|
136
|
+
"RevocationError",
|
|
137
|
+
"RevocationState",
|
|
138
|
+
"Signer",
|
|
139
|
+
"SigningError",
|
|
140
|
+
"SigningKey",
|
|
141
|
+
"Trust",
|
|
142
|
+
"VaultTransitKey",
|
|
143
|
+
"admitted_loads",
|
|
144
|
+
"args_digest",
|
|
145
|
+
"args_sha256",
|
|
146
|
+
"build_approval_binding",
|
|
147
|
+
"build_uncertain_effect",
|
|
148
|
+
"canonical",
|
|
149
|
+
"canonical_of_received",
|
|
150
|
+
"check_constraint",
|
|
151
|
+
"check_exception_call",
|
|
152
|
+
"compare_seals",
|
|
153
|
+
"count_votes",
|
|
154
|
+
"delegate",
|
|
155
|
+
"embed_approval_binding",
|
|
156
|
+
"exception_body",
|
|
157
|
+
"exception_digest",
|
|
158
|
+
"exception_evidence",
|
|
159
|
+
"export_census",
|
|
160
|
+
"grant_digest",
|
|
161
|
+
"grant_evidence",
|
|
162
|
+
"grant_permit_claims",
|
|
163
|
+
"grant_walk",
|
|
164
|
+
"issue_grant",
|
|
165
|
+
"judge_approval_binding",
|
|
166
|
+
"judge_uncertain_effect",
|
|
167
|
+
"key_id",
|
|
168
|
+
"load_public",
|
|
169
|
+
"mint_grant_permit",
|
|
170
|
+
"narrows",
|
|
171
|
+
"open_envelope",
|
|
172
|
+
"pae",
|
|
173
|
+
"permit_id",
|
|
174
|
+
"raw_public",
|
|
175
|
+
"request_hash",
|
|
176
|
+
"route_by_risk",
|
|
177
|
+
"seal_export",
|
|
178
|
+
"sha256_hex",
|
|
179
|
+
"sign_approval",
|
|
180
|
+
"sign_envelope",
|
|
181
|
+
"sign_permit",
|
|
182
|
+
"sign_revocations",
|
|
183
|
+
"sign_vote",
|
|
184
|
+
"statement",
|
|
185
|
+
"step_predicate",
|
|
186
|
+
"tool_call_predicate",
|
|
187
|
+
"verifier_case",
|
|
188
|
+
"verify_approval",
|
|
189
|
+
"verify_approval_live",
|
|
190
|
+
"verify_call_under_grant",
|
|
191
|
+
"verify_chain",
|
|
192
|
+
"verify_delegation",
|
|
193
|
+
"verify_export_seal",
|
|
194
|
+
"verify_grant_allow",
|
|
195
|
+
"verify_journal",
|
|
196
|
+
"verify_permit",
|
|
197
|
+
]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Command line: seal a governance export, verify a seal, compare two seals.
|
|
2
|
+
|
|
3
|
+
python -m probity_records seal-export EXPORT --key KEY.pem --source NAME --kind entities --out SEAL.json
|
|
4
|
+
python -m probity_records verify-export EXPORT SEAL.json --pub PUB.pem
|
|
5
|
+
python -m probity_records compare-seals OLD.json NEW.json
|
|
6
|
+
python -m probity_records identity-vectors [--check FILE]
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from .core import Signer
|
|
17
|
+
from .exports import EXPORT_KINDS, compare_seals, seal_export, verify_export_seal
|
|
18
|
+
from .journal import now
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def main(argv: list[str] | None = None) -> int:
|
|
22
|
+
parser = argparse.ArgumentParser(prog="python -m probity_records")
|
|
23
|
+
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
24
|
+
seal = sub.add_parser("seal-export")
|
|
25
|
+
seal.add_argument("export", type=Path)
|
|
26
|
+
seal.add_argument("--key", type=Path, required=True)
|
|
27
|
+
seal.add_argument("--source", required=True)
|
|
28
|
+
seal.add_argument("--kind", choices=EXPORT_KINDS, required=True)
|
|
29
|
+
seal.add_argument("--captured-at")
|
|
30
|
+
seal.add_argument("--out", type=Path, required=True)
|
|
31
|
+
ver = sub.add_parser("verify-export")
|
|
32
|
+
ver.add_argument("export", type=Path)
|
|
33
|
+
ver.add_argument("seal", type=Path)
|
|
34
|
+
ver.add_argument("--pub", type=Path, action="append", required=True)
|
|
35
|
+
cmp_ = sub.add_parser("compare-seals")
|
|
36
|
+
cmp_.add_argument("older", type=Path)
|
|
37
|
+
cmp_.add_argument("newer", type=Path)
|
|
38
|
+
idv = sub.add_parser("identity-vectors")
|
|
39
|
+
idv.add_argument("--check", type=Path)
|
|
40
|
+
args = parser.parse_args(argv)
|
|
41
|
+
if args.cmd == "identity-vectors":
|
|
42
|
+
from .identity_vectors import check, vectors
|
|
43
|
+
|
|
44
|
+
if args.check is None:
|
|
45
|
+
print(json.dumps(vectors(), indent=2, sort_keys=True))
|
|
46
|
+
return 0
|
|
47
|
+
bad = check(json.loads(args.check.read_text()))
|
|
48
|
+
print(json.dumps({"differ": bad}))
|
|
49
|
+
return 1 if bad else 0
|
|
50
|
+
if args.cmd == "seal-export":
|
|
51
|
+
envelope = seal_export(Signer.from_pem(args.key.read_bytes()), args.export.read_bytes(), source=args.source,
|
|
52
|
+
kind=args.kind, captured_at=args.captured_at or now())
|
|
53
|
+
args.out.write_text(json.dumps(envelope, indent=2, sort_keys=True) + "\n")
|
|
54
|
+
return 0
|
|
55
|
+
if args.cmd == "verify-export":
|
|
56
|
+
report = verify_export_seal(json.loads(args.seal.read_text()), args.export.read_bytes(),
|
|
57
|
+
[p.read_bytes() for p in args.pub])
|
|
58
|
+
print(json.dumps({k: report[k] for k in ("verdict", "failures")}, sort_keys=True))
|
|
59
|
+
census = report["census"] or {}
|
|
60
|
+
print(f"records {census.get('records')} missing ids {census.get('missingIds')}")
|
|
61
|
+
return 0 if report["verdict"] == "PASS" else 1
|
|
62
|
+
print(json.dumps(compare_seals(json.loads(args.older.read_text()), json.loads(args.newer.read_text())),
|
|
63
|
+
sort_keys=True))
|
|
64
|
+
return 0
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
sys.exit(main())
|