aetherproof 0.5.0__tar.gz → 0.5.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.
- {aetherproof-0.5.0/aetherproof.egg-info → aetherproof-0.5.1}/PKG-INFO +49 -12
- {aetherproof-0.5.0 → aetherproof-0.5.1}/README.md +225 -188
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/__init__.py +1 -1
- {aetherproof-0.5.0 → aetherproof-0.5.1/aetherproof.egg-info}/PKG-INFO +49 -12
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof.egg-info/SOURCES.txt +1 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/pyproject.toml +1 -1
- aetherproof-0.5.1/tests/security/README.md +32 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_auto.py +24 -6
- aetherproof-0.5.1/tests/test_version_consistency.py +64 -0
- aetherproof-0.5.0/tests/security/README.md +0 -27
- {aetherproof-0.5.0 → aetherproof-0.5.1}/LICENSE +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/MANIFEST.in +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/__main__.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/auto.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/cli.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/__init__.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/hash.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/keystore.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/log.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/receipt.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/session.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/signer.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/core/verifier.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/ui/__init__.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/ui/display.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/ui/easy_mode.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/ui/expert_mode.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof/ui/menus.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof.egg-info/dependency_links.txt +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof.egg-info/entry_points.txt +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof.egg-info/requires.txt +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/aetherproof.egg-info/top_level.txt +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/setup.cfg +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/conftest.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_cli_contract.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_cloud_api_attested.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_cloud_models_matrix.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_hardening_v13.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_parsing_and_types.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_preimage_injectivity.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/security/test_v12_extensions.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/stress/full_audit.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/stress/industrial_stress.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/stress/isolation_audit.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_cli_entry.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_cli_paths.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_core_coverage.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_display.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_easy_mode.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_expert_mode.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_independent_verification.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_key_rotation.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_log.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_native_equivalence.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_native_security.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_readme_verifier.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_receipt.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_session.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_session_binding.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_verifier.py +0 -0
- {aetherproof-0.5.0 → aetherproof-0.5.1}/tests/test_verify_wizard.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aetherproof
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: AetherProof - the open-source receipt engine. Prototype of Signet.
|
|
5
5
|
Author-email: Pulkit Kr Srivastava <pulkitsrivastavae@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -56,7 +56,9 @@ Today that argument is unwinnable in both directions. You cannot prove you did n
|
|
|
56
56
|
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
57
57
|
control prove nothing, because you control them.
|
|
58
58
|
|
|
59
|
-
**AetherProof turns that into arithmetic that either checks or does not
|
|
59
|
+
**AetherProof turns that into arithmetic that either checks or does not.**
|
|
60
|
+
|
|
61
|
+
---
|
|
60
62
|
|
|
61
63
|
## Use it
|
|
62
64
|
|
|
@@ -108,7 +110,7 @@ aetherproof verify receipt.json --output output.txt
|
|
|
108
110
|
aetherproof # interactive menu
|
|
109
111
|
```
|
|
110
112
|
|
|
111
|
-
**More recipes:**[docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
113
|
+
**More recipes:** [docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
112
114
|
question, every snippet tested.
|
|
113
115
|
|
|
114
116
|
---
|
|
@@ -147,20 +149,33 @@ pub.verify(bytes.fromhex(r["signature"]), preimage) # raises if invalid
|
|
|
147
149
|
|
|
148
150
|
## What it proves
|
|
149
151
|
|
|
150
|
-
| Claim | Mechanism |
|
|
152
|
+
| Claim | Mechanism |
|
|
153
|
+
|---|---|
|
|
154
|
+
| This exact output was not modified after signing | `output_hash` inside the signed preimage |
|
|
155
|
+
| The receipt itself was not altered | Ed25519 over a length-prefixed canonical preimage |
|
|
156
|
+
| It was signed by the holder of a specific key | Ed25519 verify, no other input |
|
|
157
|
+
| A claimed time and log position were fixed at signing | both inside the preimage |
|
|
158
|
+
| The local log was not edited, reordered, or truncated in the middle | key-free hash chain |
|
|
159
|
+
| A specific turn belongs to a sealed session | Merkle inclusion proof, revealing no other turn |
|
|
160
|
+
| Anyone can check all of it offline, forever | receipt + public key, nothing else |
|
|
151
161
|
|
|
152
162
|
---
|
|
153
163
|
|
|
154
|
-
## What it does **not**prove
|
|
164
|
+
## What it does **not** prove
|
|
155
165
|
|
|
156
166
|
Read this before citing anything above.
|
|
157
167
|
|
|
158
|
-
**Integrity, not completeness
|
|
168
|
+
**Integrity, not completeness.** *"Show me the record of this decision"* is answered.
|
|
159
169
|
*"Show me that you logged them all"* is not. Someone who logs 9,000 of 10,000
|
|
160
170
|
outputs passes every check here. That cannot be fixed locally - it needs an
|
|
161
171
|
independent witness, which does not exist yet.
|
|
162
172
|
|
|
163
|
-
| Not proven | Why |
|
|
173
|
+
| Not proven | Why |
|
|
174
|
+
|---|---|
|
|
175
|
+
| That the named model produced the output | it signs a `(model, output)` pair you supply |
|
|
176
|
+
| That the timestamp is truthful | it is your own clock - bound, not externally anchored |
|
|
177
|
+
| That the signing key is held securely | a software key on disk unless you set a passphrase |
|
|
178
|
+
| That it survives a quantum adversary | Python is Ed25519 only; ML-DSA-65 is in the Rust core |
|
|
164
179
|
|
|
165
180
|
**Where it does not fit at all:** detecting deepfakes or unsigned AI content. A
|
|
166
181
|
scammer never signs, so there is nothing to verify.
|
|
@@ -171,11 +186,18 @@ Full list: [docs/CLAIMS.md](docs/CLAIMS.md).
|
|
|
171
186
|
|
|
172
187
|
## Two implementations
|
|
173
188
|
|
|
174
|
-
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
189
|
+
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| Receipt | **128 B fixed binary** | 646 B JSON |
|
|
192
|
+
| Post-quantum | **ML-DSA-65 (FIPS 204)** | none |
|
|
193
|
+
| Secret zeroization, constant-time compare | **yes** | no |
|
|
194
|
+
| `unsafe` in production | **zero, compiler-enforced** | n/a |
|
|
195
|
+
| Tests | 59 | 642 (93% coverage) |
|
|
196
|
+
| Distribution | source + CI wheels | PyPI |
|
|
175
197
|
|
|
176
198
|
Measured, 50,000 leaves, medians of seven isolated runs: Rust builds a Merkle tree
|
|
177
|
-
in **28.16 ms**against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
178
|
-
**3.93 µs**against 17.17 µs (4.4x).
|
|
199
|
+
in **28.16 ms** against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
200
|
+
**3.93 µs** against 17.17 µs (4.4x).
|
|
179
201
|
|
|
180
202
|
The Rust core is optional. `aetherproof` does not import it and behaves identically
|
|
181
203
|
without it - enforced in CI. See [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
@@ -203,7 +225,22 @@ Setup and post-quantum usage: [docs/INTEGRATION.md](docs/INTEGRATION.md#path-c--
|
|
|
203
225
|
|
|
204
226
|
## Documentation
|
|
205
227
|
|
|
206
|
-
| | |
|
|
228
|
+
| | |
|
|
229
|
+
|---|---|
|
|
230
|
+
| [INTEGRATION.md](docs/INTEGRATION.md) | **start here** - pick a path by one question |
|
|
231
|
+
| [GETTING-STARTED.md](docs/GETTING-STARTED.md) | first receipt, no code |
|
|
232
|
+
| [CLAIMS.md](docs/CLAIMS.md) | what this proves and what it does not |
|
|
233
|
+
| [VERIFICATION.md](docs/VERIFICATION.md) | the offline verifier, in full |
|
|
234
|
+
| [CLOUD-MODELS.md](docs/CLOUD-MODELS.md) | local weights vs an API you do not control |
|
|
235
|
+
| [AGENT-CHAIN.md](docs/AGENT-CHAIN.md) | binding agent context (receipt v1.2) |
|
|
236
|
+
| [SECURITY.md](SECURITY.md) | reporting a vulnerability, threat model, known issues |
|
|
237
|
+
| [ROADMAP.md](docs/ROADMAP.md) | 0.5.x - Rust core, bindings, post-quantum |
|
|
238
|
+
| [ANALYSIS.md](docs/ANALYSIS.md) | measured assessment, including what is unverified |
|
|
239
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | extension and spec workflow |
|
|
240
|
+
| [RELEASE-NOTES-0.5.1.md](docs/RELEASE-NOTES-0.5.1.md) | what changed in 0.5.1 |
|
|
241
|
+
| [RELEASE-NOTES-0.4.0.md](docs/RELEASE-NOTES-0.4.0.md) | what changed in 0.4.0 |
|
|
242
|
+
| [agent-chain-context-response.md](docs/agent-chain-context-response.md) | the v1.2 design discussion, from issue #1 |
|
|
243
|
+
| [DEMO.md](docs/DEMO.md) | recording a walkthrough |
|
|
207
244
|
|
|
208
245
|
---
|
|
209
246
|
|
|
@@ -215,4 +252,4 @@ copied freely; a proof layer nobody can adopt is not a proof layer.
|
|
|
215
252
|
|
|
216
253
|
*Versions up to 0.2.2 were AGPL-3.0-or-later. From 0.3.0 onward: Apache-2.0.*
|
|
217
254
|
|
|
218
|
-
Security issues: **[SECURITY.md](SECURITY.md)
|
|
255
|
+
Security issues: **[SECURITY.md](SECURITY.md)** - please do not open a public issue.
|
|
@@ -1,188 +1,225 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="docs/signet-logo.png" alt="Signet" width="240">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# AetherProof
|
|
6
|
-
|
|
7
|
-
**Cryptographic receipts for AI output.** Prove a model's output has not been
|
|
8
|
-
modified - no server, no account, verifiable offline forever.
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
pip install aetherproof
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
> **Not a developer?** Start with the [plain-language guide](docs/GETTING-STARTED.md)
|
|
15
|
-
> - first receipt in three steps, no code.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## The problem
|
|
20
|
-
|
|
21
|
-
Somebody acts on an AI's output. Weeks later it is questioned:
|
|
22
|
-
|
|
23
|
-
> *"Did it really say that, or did you change it afterwards?"*
|
|
24
|
-
|
|
25
|
-
Today that argument is unwinnable in both directions. You cannot prove you did not
|
|
26
|
-
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
27
|
-
control prove nothing, because you control them.
|
|
28
|
-
|
|
29
|
-
**AetherProof turns that into arithmetic that either checks or does not
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
aetherproof
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
>
|
|
113
|
-
>
|
|
114
|
-
>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/signet-logo.png" alt="Signet" width="240">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# AetherProof
|
|
6
|
+
|
|
7
|
+
**Cryptographic receipts for AI output.** Prove a model's output has not been
|
|
8
|
+
modified - no server, no account, verifiable offline forever.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install aetherproof
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
> **Not a developer?** Start with the [plain-language guide](docs/GETTING-STARTED.md)
|
|
15
|
+
> - first receipt in three steps, no code.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## The problem
|
|
20
|
+
|
|
21
|
+
Somebody acts on an AI's output. Weeks later it is questioned:
|
|
22
|
+
|
|
23
|
+
> *"Did it really say that, or did you change it afterwards?"*
|
|
24
|
+
|
|
25
|
+
Today that argument is unwinnable in both directions. You cannot prove you did not
|
|
26
|
+
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
27
|
+
control prove nothing, because you control them.
|
|
28
|
+
|
|
29
|
+
**AetherProof turns that into arithmetic that either checks or does not.**
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Use it
|
|
34
|
+
|
|
35
|
+
### Sign one output
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from aetherproof.auto import sign
|
|
39
|
+
|
|
40
|
+
resp = client.chat.completions.create(model="gpt-4o", messages=[...])
|
|
41
|
+
out = resp.choices[0].message.content
|
|
42
|
+
|
|
43
|
+
sign(prompt=user_prompt, output=out, model_id=resp.model)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
That is the whole integration. It never prompts, never blocks. On failure it
|
|
47
|
+
returns `None` and your program continues - set `AETHERPROOF_STRICT=1` if a missing
|
|
48
|
+
receipt should be an error instead.
|
|
49
|
+
|
|
50
|
+
### Wrap a function you already have
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from aetherproof.auto import receipted
|
|
54
|
+
|
|
55
|
+
@receipted(model_id="gpt-4o")
|
|
56
|
+
def ask(prompt: str) -> str:
|
|
57
|
+
return client.chat.completions.create(...).choices[0].message.content
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
No call sites change.
|
|
61
|
+
|
|
62
|
+
### A whole conversation, one signature
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from aetherproof.auto import AutoSession
|
|
66
|
+
|
|
67
|
+
with AutoSession(model_id="gpt-4o") as chat: # seals on exit
|
|
68
|
+
for prompt in prompts:
|
|
69
|
+
chat.turn(prompt=prompt, output=ask(prompt))
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
At 1,000 turns that is **one 412-byte seal**. Proving any single turn costs 10
|
|
73
|
+
hashes and about 1 KB, and reveals nothing about the other 999.
|
|
74
|
+
|
|
75
|
+
### From the command line
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
aetherproof sign model.onnx output.txt
|
|
79
|
+
aetherproof verify receipt.json --output output.txt
|
|
80
|
+
aetherproof # interactive menu
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**More recipes:** [docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
84
|
+
question, every snippet tested.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Verify it
|
|
89
|
+
|
|
90
|
+
Verification needs **21 lines and one dependency**. No network, no account, no
|
|
91
|
+
special hardware, and it keeps working if this project is abandoned.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install cryptography # that is the entire requirement
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**The shape of it**, so you can see there is no trick - this is illustrative, not
|
|
98
|
+
complete:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
|
102
|
+
import json
|
|
103
|
+
|
|
104
|
+
r = json.load(open("receipt.json"))
|
|
105
|
+
pub = Ed25519PublicKey.from_public_bytes(bytes.fromhex(r["public_key"]))
|
|
106
|
+
|
|
107
|
+
# every field length-prefixed as "<len>:<field>", concatenated, then signed
|
|
108
|
+
preimage = build_preimage(r) # see the full version below
|
|
109
|
+
pub.verify(bytes.fromhex(r["signature"]), preimage) # raises if invalid
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **Do not ship the snippet above.** It omits `log_sequence`, `hw_evidence`, the
|
|
113
|
+
> v1.2 extension commitment, and the v1.3 `receipt_id` and `signing_key_id`, so it
|
|
114
|
+
> rejects every receipt the current version produces. The complete verifier - 21
|
|
115
|
+
> lines, tested on every commit against real receipts - is in
|
|
116
|
+
> **[docs/VERIFICATION.md](docs/VERIFICATION.md)**.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## What it proves
|
|
121
|
+
|
|
122
|
+
| Claim | Mechanism |
|
|
123
|
+
|---|---|
|
|
124
|
+
| This exact output was not modified after signing | `output_hash` inside the signed preimage |
|
|
125
|
+
| The receipt itself was not altered | Ed25519 over a length-prefixed canonical preimage |
|
|
126
|
+
| It was signed by the holder of a specific key | Ed25519 verify, no other input |
|
|
127
|
+
| A claimed time and log position were fixed at signing | both inside the preimage |
|
|
128
|
+
| The local log was not edited, reordered, or truncated in the middle | key-free hash chain |
|
|
129
|
+
| A specific turn belongs to a sealed session | Merkle inclusion proof, revealing no other turn |
|
|
130
|
+
| Anyone can check all of it offline, forever | receipt + public key, nothing else |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## What it does **not** prove
|
|
135
|
+
|
|
136
|
+
Read this before citing anything above.
|
|
137
|
+
|
|
138
|
+
**Integrity, not completeness.** *"Show me the record of this decision"* is answered.
|
|
139
|
+
*"Show me that you logged them all"* is not. Someone who logs 9,000 of 10,000
|
|
140
|
+
outputs passes every check here. That cannot be fixed locally - it needs an
|
|
141
|
+
independent witness, which does not exist yet.
|
|
142
|
+
|
|
143
|
+
| Not proven | Why |
|
|
144
|
+
|---|---|
|
|
145
|
+
| That the named model produced the output | it signs a `(model, output)` pair you supply |
|
|
146
|
+
| That the timestamp is truthful | it is your own clock - bound, not externally anchored |
|
|
147
|
+
| That the signing key is held securely | a software key on disk unless you set a passphrase |
|
|
148
|
+
| That it survives a quantum adversary | Python is Ed25519 only; ML-DSA-65 is in the Rust core |
|
|
149
|
+
|
|
150
|
+
**Where it does not fit at all:** detecting deepfakes or unsigned AI content. A
|
|
151
|
+
scammer never signs, so there is nothing to verify.
|
|
152
|
+
|
|
153
|
+
Full list: [docs/CLAIMS.md](docs/CLAIMS.md).
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Two implementations
|
|
158
|
+
|
|
159
|
+
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| Receipt | **128 B fixed binary** | 646 B JSON |
|
|
162
|
+
| Post-quantum | **ML-DSA-65 (FIPS 204)** | none |
|
|
163
|
+
| Secret zeroization, constant-time compare | **yes** | no |
|
|
164
|
+
| `unsafe` in production | **zero, compiler-enforced** | n/a |
|
|
165
|
+
| Tests | 59 | 642 (93% coverage) |
|
|
166
|
+
| Distribution | source + CI wheels | PyPI |
|
|
167
|
+
|
|
168
|
+
Measured, 50,000 leaves, medians of seven isolated runs: Rust builds a Merkle tree
|
|
169
|
+
in **28.16 ms** against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
170
|
+
**3.93 µs** against 17.17 µs (4.4x).
|
|
171
|
+
|
|
172
|
+
The Rust core is optional. `aetherproof` does not import it and behaves identically
|
|
173
|
+
without it - enforced in CI. See [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
174
|
+
|
|
175
|
+
### Secrets that get wiped
|
|
176
|
+
|
|
177
|
+
A signing key held as a Python `bytes` object cannot be wiped - it is immutable, and
|
|
178
|
+
garbage collection does not overwrite the allocation. `SecureSigner` keeps the key
|
|
179
|
+
inside Rust and overwrites it on release, including when a block exits by exception.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
import _native
|
|
183
|
+
|
|
184
|
+
with _native.SecureSigner() as signer: # key wiped on exit
|
|
185
|
+
pub = signer.public_key() # nothing returns the secret
|
|
186
|
+
receipt = signer.sign_receipt(pid=1, binary=model_bytes,
|
|
187
|
+
memory_hash=0, syscall_count=1)
|
|
188
|
+
|
|
189
|
+
assert _native.SecureVerifier(pub).verify_receipt(receipt)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Setup and post-quantum usage: [docs/INTEGRATION.md](docs/INTEGRATION.md#path-c--secrets-that-get-wiped).
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Documentation
|
|
197
|
+
|
|
198
|
+
| | |
|
|
199
|
+
|---|---|
|
|
200
|
+
| [INTEGRATION.md](docs/INTEGRATION.md) | **start here** - pick a path by one question |
|
|
201
|
+
| [GETTING-STARTED.md](docs/GETTING-STARTED.md) | first receipt, no code |
|
|
202
|
+
| [CLAIMS.md](docs/CLAIMS.md) | what this proves and what it does not |
|
|
203
|
+
| [VERIFICATION.md](docs/VERIFICATION.md) | the offline verifier, in full |
|
|
204
|
+
| [CLOUD-MODELS.md](docs/CLOUD-MODELS.md) | local weights vs an API you do not control |
|
|
205
|
+
| [AGENT-CHAIN.md](docs/AGENT-CHAIN.md) | binding agent context (receipt v1.2) |
|
|
206
|
+
| [SECURITY.md](SECURITY.md) | reporting a vulnerability, threat model, known issues |
|
|
207
|
+
| [ROADMAP.md](docs/ROADMAP.md) | 0.5.x - Rust core, bindings, post-quantum |
|
|
208
|
+
| [ANALYSIS.md](docs/ANALYSIS.md) | measured assessment, including what is unverified |
|
|
209
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | extension and spec workflow |
|
|
210
|
+
| [RELEASE-NOTES-0.5.1.md](docs/RELEASE-NOTES-0.5.1.md) | what changed in 0.5.1 |
|
|
211
|
+
| [RELEASE-NOTES-0.4.0.md](docs/RELEASE-NOTES-0.4.0.md) | what changed in 0.4.0 |
|
|
212
|
+
| [agent-chain-context-response.md](docs/agent-chain-context-response.md) | the v1.2 design discussion, from issue #1 |
|
|
213
|
+
| [DEMO.md](docs/DEMO.md) | recording a walkthrough |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
**Apache-2.0.** Use it, deploy it, fork it, embed it in a commercial product - no
|
|
220
|
+
copyleft obligation. The receipt format and the offline verifier are meant to be
|
|
221
|
+
copied freely; a proof layer nobody can adopt is not a proof layer.
|
|
222
|
+
|
|
223
|
+
*Versions up to 0.2.2 were AGPL-3.0-or-later. From 0.3.0 onward: Apache-2.0.*
|
|
224
|
+
|
|
225
|
+
Security issues: **[SECURITY.md](SECURITY.md)** - please do not open a public issue.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aetherproof
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: AetherProof - the open-source receipt engine. Prototype of Signet.
|
|
5
5
|
Author-email: Pulkit Kr Srivastava <pulkitsrivastavae@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -56,7 +56,9 @@ Today that argument is unwinnable in both directions. You cannot prove you did n
|
|
|
56
56
|
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
57
57
|
control prove nothing, because you control them.
|
|
58
58
|
|
|
59
|
-
**AetherProof turns that into arithmetic that either checks or does not
|
|
59
|
+
**AetherProof turns that into arithmetic that either checks or does not.**
|
|
60
|
+
|
|
61
|
+
---
|
|
60
62
|
|
|
61
63
|
## Use it
|
|
62
64
|
|
|
@@ -108,7 +110,7 @@ aetherproof verify receipt.json --output output.txt
|
|
|
108
110
|
aetherproof # interactive menu
|
|
109
111
|
```
|
|
110
112
|
|
|
111
|
-
**More recipes:**[docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
113
|
+
**More recipes:** [docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
112
114
|
question, every snippet tested.
|
|
113
115
|
|
|
114
116
|
---
|
|
@@ -147,20 +149,33 @@ pub.verify(bytes.fromhex(r["signature"]), preimage) # raises if invalid
|
|
|
147
149
|
|
|
148
150
|
## What it proves
|
|
149
151
|
|
|
150
|
-
| Claim | Mechanism |
|
|
152
|
+
| Claim | Mechanism |
|
|
153
|
+
|---|---|
|
|
154
|
+
| This exact output was not modified after signing | `output_hash` inside the signed preimage |
|
|
155
|
+
| The receipt itself was not altered | Ed25519 over a length-prefixed canonical preimage |
|
|
156
|
+
| It was signed by the holder of a specific key | Ed25519 verify, no other input |
|
|
157
|
+
| A claimed time and log position were fixed at signing | both inside the preimage |
|
|
158
|
+
| The local log was not edited, reordered, or truncated in the middle | key-free hash chain |
|
|
159
|
+
| A specific turn belongs to a sealed session | Merkle inclusion proof, revealing no other turn |
|
|
160
|
+
| Anyone can check all of it offline, forever | receipt + public key, nothing else |
|
|
151
161
|
|
|
152
162
|
---
|
|
153
163
|
|
|
154
|
-
## What it does **not**prove
|
|
164
|
+
## What it does **not** prove
|
|
155
165
|
|
|
156
166
|
Read this before citing anything above.
|
|
157
167
|
|
|
158
|
-
**Integrity, not completeness
|
|
168
|
+
**Integrity, not completeness.** *"Show me the record of this decision"* is answered.
|
|
159
169
|
*"Show me that you logged them all"* is not. Someone who logs 9,000 of 10,000
|
|
160
170
|
outputs passes every check here. That cannot be fixed locally - it needs an
|
|
161
171
|
independent witness, which does not exist yet.
|
|
162
172
|
|
|
163
|
-
| Not proven | Why |
|
|
173
|
+
| Not proven | Why |
|
|
174
|
+
|---|---|
|
|
175
|
+
| That the named model produced the output | it signs a `(model, output)` pair you supply |
|
|
176
|
+
| That the timestamp is truthful | it is your own clock - bound, not externally anchored |
|
|
177
|
+
| That the signing key is held securely | a software key on disk unless you set a passphrase |
|
|
178
|
+
| That it survives a quantum adversary | Python is Ed25519 only; ML-DSA-65 is in the Rust core |
|
|
164
179
|
|
|
165
180
|
**Where it does not fit at all:** detecting deepfakes or unsigned AI content. A
|
|
166
181
|
scammer never signs, so there is nothing to verify.
|
|
@@ -171,11 +186,18 @@ Full list: [docs/CLAIMS.md](docs/CLAIMS.md).
|
|
|
171
186
|
|
|
172
187
|
## Two implementations
|
|
173
188
|
|
|
174
|
-
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
189
|
+
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| Receipt | **128 B fixed binary** | 646 B JSON |
|
|
192
|
+
| Post-quantum | **ML-DSA-65 (FIPS 204)** | none |
|
|
193
|
+
| Secret zeroization, constant-time compare | **yes** | no |
|
|
194
|
+
| `unsafe` in production | **zero, compiler-enforced** | n/a |
|
|
195
|
+
| Tests | 59 | 642 (93% coverage) |
|
|
196
|
+
| Distribution | source + CI wheels | PyPI |
|
|
175
197
|
|
|
176
198
|
Measured, 50,000 leaves, medians of seven isolated runs: Rust builds a Merkle tree
|
|
177
|
-
in **28.16 ms**against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
178
|
-
**3.93 µs**against 17.17 µs (4.4x).
|
|
199
|
+
in **28.16 ms** against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
200
|
+
**3.93 µs** against 17.17 µs (4.4x).
|
|
179
201
|
|
|
180
202
|
The Rust core is optional. `aetherproof` does not import it and behaves identically
|
|
181
203
|
without it - enforced in CI. See [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
@@ -203,7 +225,22 @@ Setup and post-quantum usage: [docs/INTEGRATION.md](docs/INTEGRATION.md#path-c--
|
|
|
203
225
|
|
|
204
226
|
## Documentation
|
|
205
227
|
|
|
206
|
-
| | |
|
|
228
|
+
| | |
|
|
229
|
+
|---|---|
|
|
230
|
+
| [INTEGRATION.md](docs/INTEGRATION.md) | **start here** - pick a path by one question |
|
|
231
|
+
| [GETTING-STARTED.md](docs/GETTING-STARTED.md) | first receipt, no code |
|
|
232
|
+
| [CLAIMS.md](docs/CLAIMS.md) | what this proves and what it does not |
|
|
233
|
+
| [VERIFICATION.md](docs/VERIFICATION.md) | the offline verifier, in full |
|
|
234
|
+
| [CLOUD-MODELS.md](docs/CLOUD-MODELS.md) | local weights vs an API you do not control |
|
|
235
|
+
| [AGENT-CHAIN.md](docs/AGENT-CHAIN.md) | binding agent context (receipt v1.2) |
|
|
236
|
+
| [SECURITY.md](SECURITY.md) | reporting a vulnerability, threat model, known issues |
|
|
237
|
+
| [ROADMAP.md](docs/ROADMAP.md) | 0.5.x - Rust core, bindings, post-quantum |
|
|
238
|
+
| [ANALYSIS.md](docs/ANALYSIS.md) | measured assessment, including what is unverified |
|
|
239
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | extension and spec workflow |
|
|
240
|
+
| [RELEASE-NOTES-0.5.1.md](docs/RELEASE-NOTES-0.5.1.md) | what changed in 0.5.1 |
|
|
241
|
+
| [RELEASE-NOTES-0.4.0.md](docs/RELEASE-NOTES-0.4.0.md) | what changed in 0.4.0 |
|
|
242
|
+
| [agent-chain-context-response.md](docs/agent-chain-context-response.md) | the v1.2 design discussion, from issue #1 |
|
|
243
|
+
| [DEMO.md](docs/DEMO.md) | recording a walkthrough |
|
|
207
244
|
|
|
208
245
|
---
|
|
209
246
|
|
|
@@ -215,4 +252,4 @@ copied freely; a proof layer nobody can adopt is not a proof layer.
|
|
|
215
252
|
|
|
216
253
|
*Versions up to 0.2.2 were AGPL-3.0-or-later. From 0.3.0 onward: Apache-2.0.*
|
|
217
254
|
|
|
218
|
-
Security issues: **[SECURITY.md](SECURITY.md)
|
|
255
|
+
Security issues: **[SECURITY.md](SECURITY.md)** - please do not open a public issue.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Security regression tests
|
|
2
|
+
|
|
3
|
+
Every test in this folder corresponds to a **real bug found during adversarial
|
|
4
|
+
stress testing** of AetherProof. They are the highest-value tests in the suite:
|
|
5
|
+
each one re-runs an attack that must stay blocked. If any of these fail, receipts
|
|
6
|
+
can be forged or a tamper can go undetected.
|
|
7
|
+
|
|
8
|
+
## What was found and fixed
|
|
9
|
+
|
|
10
|
+
| Bug | Severity | What it was | Fix | Test file |
|
|
11
|
+
|-----|----------|-------------|-----|-----------|
|
|
12
|
+
| **A** | Critical | Signing preimage used `"\|".join(fields)`. A `\|` inside any field shifted the boundaries, so two **different** receipts produced the **same** preimage - one signature forged both. | Length-prefix every field as `<len>:<field>` (injective). | `test_preimage_injectivity.py` |
|
|
13
|
+
| **B** | Medium | `Receipt.from_dict` didn't coerce `timestamp_ms` / `log_sequence`; a JSON string `"1"` stayed a string, diverging from int `1`. Unknown keys also crashed parsing. | Coerce numerics to `int`; ignore unknown keys. | `test_parsing_and_types.py` |
|
|
14
|
+
| **C** | Latent | `hw_evidence` entered the preimage via `str(list)` (Python repr) - key order / quoting changed it for semantically-equal evidence. | Canonical key-sorted JSON. | `test_preimage_injectivity.py` |
|
|
15
|
+
| **D** | Med-High | `aetherproof sign` with missing args exited **0**, so `sign && echo ok` falsely passed in CI. | Thread `bool` return -> `sys.exit(1)`. | `test_cli_contract.py` |
|
|
16
|
+
|
|
17
|
+
These were found by treating the receipt as an attacker would: crafting two
|
|
18
|
+
distinct receipts that collide under the encoding, feeding string-typed numbers,
|
|
19
|
+
reordering nested keys, and checking that every failure path exits non-zero.
|
|
20
|
+
|
|
21
|
+
## Run
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# the security suite only
|
|
25
|
+
python -m pytest tests/security -v
|
|
26
|
+
|
|
27
|
+
# everything
|
|
28
|
+
python -m pytest -q
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A passing run is the evidence: distinct receipts never share a preimage, a stolen
|
|
32
|
+
signature never forges a different receipt, and every failure exits non-zero.
|
|
@@ -33,6 +33,24 @@ def isolated_home(tmp_path, monkeypatch):
|
|
|
33
33
|
|
|
34
34
|
# ── zero-setup signing ───────────────────────────────────────────────────────
|
|
35
35
|
|
|
36
|
+
@pytest.fixture
|
|
37
|
+
def unusable_home(tmp_path):
|
|
38
|
+
"""An AETHERPROOF_HOME that cannot be created on any operating system.
|
|
39
|
+
|
|
40
|
+
These tests previously used "Z:/definitely/not/a/real/path". On Windows Z: is
|
|
41
|
+
an unmapped drive, so creation failed and the test passed. On Linux and macOS
|
|
42
|
+
"Z:" is a perfectly legal relative directory name, so mkdir succeeded, signing
|
|
43
|
+
worked, and the assertion that it fails was wrong. The suite was green on
|
|
44
|
+
Windows and red everywhere else for exactly this reason.
|
|
45
|
+
|
|
46
|
+
Placing the target beneath a regular file fails on every platform: POSIX
|
|
47
|
+
raises NotADirectoryError, Windows raises FileExistsError or NotADirectoryError.
|
|
48
|
+
Nothing can be created underneath a regular file.
|
|
49
|
+
"""
|
|
50
|
+
blocker = tmp_path / "this-is-a-file-not-a-directory"
|
|
51
|
+
blocker.write_text("blocks directory creation beneath it", encoding="utf-8")
|
|
52
|
+
return str(blocker / "home")
|
|
53
|
+
|
|
36
54
|
def test_sign_works_with_no_configuration():
|
|
37
55
|
r = auto.sign(prompt="what is 2+2?", output="4")
|
|
38
56
|
assert r is not None
|
|
@@ -97,14 +115,14 @@ def test_disabled_session_records_nothing(monkeypatch):
|
|
|
97
115
|
assert s.seal is None
|
|
98
116
|
|
|
99
117
|
|
|
100
|
-
def test_failure_is_swallowed_by_default(monkeypatch):
|
|
101
|
-
monkeypatch.setenv("AETHERPROOF_HOME",
|
|
118
|
+
def test_failure_is_swallowed_by_default(monkeypatch, unusable_home):
|
|
119
|
+
monkeypatch.setenv("AETHERPROOF_HOME", unusable_home)
|
|
102
120
|
auto.reset()
|
|
103
121
|
assert auto.sign(output="x") is None # must not raise
|
|
104
122
|
|
|
105
123
|
|
|
106
|
-
def test_strict_mode_raises_instead(monkeypatch):
|
|
107
|
-
monkeypatch.setenv("AETHERPROOF_HOME",
|
|
124
|
+
def test_strict_mode_raises_instead(monkeypatch, unusable_home):
|
|
125
|
+
monkeypatch.setenv("AETHERPROOF_HOME", unusable_home)
|
|
108
126
|
monkeypatch.setenv("AETHERPROOF_STRICT", "1")
|
|
109
127
|
auto.reset()
|
|
110
128
|
with pytest.raises(Exception):
|
|
@@ -232,8 +250,8 @@ def test_decorator_passes_the_return_value_through_untouched():
|
|
|
232
250
|
assert f() is sentinel
|
|
233
251
|
|
|
234
252
|
|
|
235
|
-
def test_decorator_failure_never_changes_the_caller_result(monkeypatch):
|
|
236
|
-
monkeypatch.setenv("AETHERPROOF_HOME",
|
|
253
|
+
def test_decorator_failure_never_changes_the_caller_result(monkeypatch, unusable_home):
|
|
254
|
+
monkeypatch.setenv("AETHERPROOF_HOME", unusable_home)
|
|
237
255
|
auto.reset()
|
|
238
256
|
|
|
239
257
|
@auto.receipted()
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""The package version must agree with the build metadata.
|
|
2
|
+
|
|
3
|
+
0.5.0 shipped to PyPI with pyproject.toml at 0.5.0 and __init__.py still at
|
|
4
|
+
0.4.0, so `aetherproof.__version__` reported the wrong number to anyone who
|
|
5
|
+
asked. Bumping a release in one place and not the other is easy to do and
|
|
6
|
+
invisible until it is published, which is the worst time to find it.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
import aetherproof
|
|
16
|
+
|
|
17
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _pyproject_version() -> str:
|
|
21
|
+
text = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
|
|
22
|
+
match = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE)
|
|
23
|
+
assert match, "pyproject.toml has no top-level version"
|
|
24
|
+
return match.group(1)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_dunder_version_matches_pyproject():
|
|
28
|
+
assert aetherproof.__version__ == _pyproject_version(), (
|
|
29
|
+
f"aetherproof.__version__ is {aetherproof.__version__} but pyproject.toml "
|
|
30
|
+
f"says {_pyproject_version()}; bump both"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_installed_metadata_is_not_ahead_of_the_source():
|
|
35
|
+
"""Installed metadata may lag the source tree, but must never lead it.
|
|
36
|
+
|
|
37
|
+
During development the source is bumped before anything is reinstalled, so an
|
|
38
|
+
editable install legitimately reports the previous version. That is normal and
|
|
39
|
+
must not fail, or the check gets ignored and then deleted.
|
|
40
|
+
|
|
41
|
+
Metadata *ahead* of the source is different: it means the working tree is
|
|
42
|
+
older than what is installed, so tests are not exercising the code that would
|
|
43
|
+
ship.
|
|
44
|
+
"""
|
|
45
|
+
from importlib import metadata
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
installed = metadata.version("aetherproof")
|
|
49
|
+
except metadata.PackageNotFoundError:
|
|
50
|
+
pytest.skip("not installed; running from a source tree")
|
|
51
|
+
|
|
52
|
+
def parts(v):
|
|
53
|
+
return tuple(int(x) for x in re.findall(r"\d+", v)[:3])
|
|
54
|
+
|
|
55
|
+
assert parts(installed) <= parts(aetherproof.__version__), (
|
|
56
|
+
f"installed metadata is {installed} but the source says "
|
|
57
|
+
f"{aetherproof.__version__}; the working tree is behind what is installed"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_version_is_a_plausible_release_number():
|
|
62
|
+
assert re.fullmatch(r"\d+\.\d+\.\d+([.-]?(a|b|rc|dev)\d*)?", aetherproof.__version__), (
|
|
63
|
+
f"{aetherproof.__version__!r} is not a release-shaped version"
|
|
64
|
+
)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Security regression tests
|
|
2
|
-
|
|
3
|
-
Every test in this folder corresponds to a **real bug found during adversarial
|
|
4
|
-
stress testing**of AetherProof. They are the highest-value tests in the suite:
|
|
5
|
-
each one re-runs an attack that must stay blocked. If any of these fail, receipts
|
|
6
|
-
can be forged or a tamper can go undetected.
|
|
7
|
-
|
|
8
|
-
## What was found and fixed
|
|
9
|
-
|
|
10
|
-
| Bug | Severity | What it was | Fix | Test file | |-----|----------|-------------|-----|-----------| | **A**| Critical | Signing preimage used `"\|".join(fields)`. A `\|` inside any field shifted the boundaries, so two **different**receipts produced the **same**preimage - one signature forged both. | Length-prefix every field as `<len>:<field>` (injective). | `test_preimage_injectivity.py` | | **B**| Medium | `Receipt.from_dict` didn't coerce `timestamp_ms` / `log_sequence`; a JSON string `"1"` stayed a string, diverging from int `1`. Unknown keys also crashed parsing. | Coerce numerics to `int`; ignore unknown keys. | `test_parsing_and_types.py` | | **C**| Latent | `hw_evidence` entered the preimage via `str(list)` (Python repr) - key order / quoting changed it for semantically-equal evidence. | Canonical key-sorted JSON. | `test_preimage_injectivity.py` | | **D**| Med-High | `aetherproof sign` with missing args exited **0**, so `sign && echo ok` falsely passed in CI. | Thread `bool` return -> `sys.exit(1)`. | `test_cli_contract.py` |
|
|
11
|
-
|
|
12
|
-
These were found by treating the receipt as an attacker would: crafting two
|
|
13
|
-
distinct receipts that collide under the encoding, feeding string-typed numbers,
|
|
14
|
-
reordering nested keys, and checking that every failure path exits non-zero.
|
|
15
|
-
|
|
16
|
-
## Run
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# the security suite only
|
|
20
|
-
python -m pytest tests/security -v
|
|
21
|
-
|
|
22
|
-
# everything
|
|
23
|
-
python -m pytest -q
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
A passing run is the evidence: distinct receipts never share a preimage, a stolen
|
|
27
|
-
signature never forges a different receipt, and every failure exits non-zero.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|