modelsign 1.2.0__tar.gz → 1.4.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.
- {modelsign-1.2.0 → modelsign-1.4.0}/.github/workflows/ci.yml +1 -1
- modelsign-1.4.0/CHANGELOG.md +59 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/PKG-INFO +60 -3
- {modelsign-1.2.0 → modelsign-1.4.0}/README.md +57 -2
- modelsign-1.4.0/docs/attestation.md +108 -0
- modelsign-1.4.0/docs/aws-kms.md +93 -0
- modelsign-1.4.0/docs/outreach/demo-verification.md +26 -0
- modelsign-1.4.0/docs/outreach/modelsign-1.3-engineering-packet.md +113 -0
- modelsign-1.4.0/docs/reviews/2026-12-03-v1.3.0.md +47 -0
- modelsign-1.4.0/docs/reviews/2026-12-03-v1.4-development.md +53 -0
- modelsign-1.4.0/docs/superpowers/plans/2026-12-03-kms.md +11 -0
- modelsign-1.4.0/docs/superpowers/plans/2026-12-03-trust-rollback.md +64 -0
- modelsign-1.4.0/docs/superpowers/specs/2026-12-03-kms-design.md +37 -0
- modelsign-1.4.0/docs/superpowers/specs/2026-12-03-trust-rollback-design.md +258 -0
- modelsign-1.4.0/docs/trust-policy.md +138 -0
- modelsign-1.4.0/examples/security_review_demo.py +73 -0
- modelsign-1.4.0/examples/trust_policy_demo.py +119 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/pyproject.toml +5 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/__init__.py +4 -1
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/api.py +56 -8
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/approvals.py +13 -3
- modelsign-1.4.0/src/modelsign/attest.py +392 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/cli.py +203 -29
- modelsign-1.4.0/src/modelsign/crypto/aws_kms.py +80 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/crypto/keys.py +41 -7
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/crypto/sign.py +15 -3
- modelsign-1.4.0/src/modelsign/crypto/signers.py +28 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/guard.py +11 -1
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/identity/card.py +13 -0
- modelsign-1.4.0/src/modelsign/policy.py +275 -0
- modelsign-1.4.0/src/modelsign/policy_state.py +228 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/sig.py +19 -3
- modelsign-1.4.0/src/modelsign/trust_bundle.py +234 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/PKG-INFO +60 -3
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/SOURCES.txt +27 -1
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/requires.txt +3 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_api.py +22 -0
- modelsign-1.4.0/tests/test_attest.py +277 -0
- modelsign-1.4.0/tests/test_digest_binding_review.py +42 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_keys.py +49 -0
- modelsign-1.4.0/tests/test_kms.py +224 -0
- modelsign-1.4.0/tests/test_policy.py +348 -0
- modelsign-1.4.0/tests/test_policy_cli.py +186 -0
- modelsign-1.4.0/tests/test_policy_state.py +155 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_timestamps.py +44 -0
- modelsign-1.4.0/tests/test_trust_bundle.py +147 -0
- modelsign-1.2.0/CHANGELOG.md +0 -29
- {modelsign-1.2.0 → modelsign-1.4.0}/.github/FUNDING.yml +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/.gitignore +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/LICENSE +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/action.yml +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/docs/security-policy-follow-ons.md +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/docs/superpowers/plans/2026-12-03-rfc3161.md +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/docs/superpowers/specs/2026-12-03-rfc3161-design.md +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/docs/timestamps.md +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/setup.cfg +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/crypto/__init__.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/crypto/verify.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/formats/__init__.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/formats/directory.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/formats/single.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/identity/__init__.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/identity/canonical.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/lineage.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/middleware/__init__.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/middleware/response.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/oms.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign/timestamps.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/dependency_links.txt +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/entry_points.txt +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/src/modelsign.egg-info/top_level.txt +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/conftest.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_approvals.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_canonical.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_card.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_cli.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_formats.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_guard.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_integration.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_lineage.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_middleware.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_oms.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_sig.py +0 -0
- {modelsign-1.2.0 → modelsign-1.4.0}/tests/test_sign_verify.py +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.4.0 (2026-12-03)
|
|
4
|
+
|
|
5
|
+
- Optional signed trust bundles with pinned roots, exact model grants and current-key revocation policy.
|
|
6
|
+
- Signed model IDs/security versions and deployment floors.
|
|
7
|
+
- Explicitly initialized POSIX rollback state with locking, atomic updates and cross-model trust sequence memory.
|
|
8
|
+
- Shared API/CLI/guard policy enforcement, including approvals before model-state commits.
|
|
9
|
+
- Offline bundle issuance and explicit state initialization/reset with audit backup.
|
|
10
|
+
- Identity-only policies do not require a security version; version floors and state still do.
|
|
11
|
+
- Preserve operational verification errors (CLI exit 2) and explicit embedded-key verification for approval-only checks.
|
|
12
|
+
|
|
13
|
+
## v1.3.0 (2026-12-03)
|
|
14
|
+
|
|
15
|
+
- Optional AWS KMS Ed25519 signing for models and approvals; pinned key/algorithm,
|
|
16
|
+
local verification of responses, offline verification, optional SDK dependency.
|
|
17
|
+
Experimental: tested through the SDK boundary, not against a live AWS key.
|
|
18
|
+
- Reject malformed attestation schemas and handle invalid Unicode as a controlled error.
|
|
19
|
+
- Malformed signature metadata fails verification instead of raising during digest generation.
|
|
20
|
+
- Key generation refuses incomplete or mismatched pairs, uses exclusive creation,
|
|
21
|
+
and restricts private-key permissions from the moment of creation.
|
|
22
|
+
- Keyring aliases cannot escape their directory; writes validate keys, reject symlink
|
|
23
|
+
destinations, and atomically replace entries without modifying hardlinked files.
|
|
24
|
+
|
|
25
|
+
- Runtime attestations (`modelsign.attest`): a serving process signs, per output,
|
|
26
|
+
a statement naming the verified model's signature digest and the output's hash.
|
|
27
|
+
- `VerifyResult.signature_digest` and `signer_key` (the key that verified), set on success.
|
|
28
|
+
- Attestations bind the verifying key, computed hash and identity hash; the
|
|
29
|
+
signature digest is carried as a label only, since it spans unauthenticated fields.
|
|
30
|
+
- `modelsign verify-attestation` for checking one against an output and a `.sig`.
|
|
31
|
+
- An attestation is a claim by the attestor key's holder, not proof of computation.
|
|
32
|
+
|
|
33
|
+
## v1.2.0 (2026-12-03)
|
|
34
|
+
|
|
35
|
+
- Optional RFC 3161 timestamps binding a model signature and its current approval chain.
|
|
36
|
+
- `sign`/`approve --timestamp URL --tsa-ca FILE`; failures preserve the existing signature.
|
|
37
|
+
- Offline `verify --require-timestamp` and matching direct/installed guard policy.
|
|
38
|
+
- Explicit TSA roots, OpenSSL 3 verification, optional `timestamp` extra.
|
|
39
|
+
- Bounded HTTP responses and a hard total network deadline.
|
|
40
|
+
- Existing model signatures and lineage digests remain compatible.
|
|
41
|
+
- Tested with local test authorities and the external FreeTSA service.
|
|
42
|
+
- Timestamps do not implement revocation, archival validation or rollback prevention.
|
|
43
|
+
|
|
44
|
+
## v1.0.0 (2026-03-25)
|
|
45
|
+
|
|
46
|
+
Initial release.
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
- **Ed25519 model signing** with domain-prefixed messages (`modelsign-v1:`)
|
|
51
|
+
- **Model Identity Card** — structured, signed metadata (architecture, base model, training, eval metrics, provenance)
|
|
52
|
+
- **RFC 8785 canonical JSON** for deterministic, cross-platform signature verification
|
|
53
|
+
- **Streaming SHA-256** for large model files (1MB chunks, no full-file memory load)
|
|
54
|
+
- **Directory support** — sign multi-file models with recursive manifests
|
|
55
|
+
- **TOFU keyring** — trust-on-first-use with persistent trusted key store
|
|
56
|
+
- **CLI commands**: `sign`, `verify`, `inspect`, `keygen`, `keyring`, `version`
|
|
57
|
+
- **Python SDK** — all modules independently importable
|
|
58
|
+
- **Response signing middleware** (optional) for API endpoint authenticity
|
|
59
|
+
- **Version migration policy** — forward-compatible .sig format with semver checks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelsign
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Sign AI models with identity. Verify anywhere. Part of the AURE Provenance stack by Constant Systems.
|
|
5
5
|
Author-email: James Kerr <qj@constantqj.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -24,6 +24,8 @@ Provides-Extra: middleware
|
|
|
24
24
|
Requires-Dist: fastapi>=0.100; extra == "middleware"
|
|
25
25
|
Provides-Extra: timestamp
|
|
26
26
|
Requires-Dist: asn1crypto>=1.5.1; extra == "timestamp"
|
|
27
|
+
Provides-Extra: aws-kms
|
|
28
|
+
Requires-Dist: boto3>=1.40.0; extra == "aws-kms"
|
|
27
29
|
Provides-Extra: dev
|
|
28
30
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
31
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -214,6 +216,41 @@ them, and `--min-approvals` counts **distinct** approvers: one person in two
|
|
|
214
216
|
roles is one person. Pinning specific approvers (`require_approval(keys=...)`)
|
|
215
217
|
takes public key PEM paths or key bytes, not fingerprints.
|
|
216
218
|
|
|
219
|
+
## Runtime attestations
|
|
220
|
+
|
|
221
|
+
A model signature says what the weights are, not which weights answered a
|
|
222
|
+
request. A serving process can close that gap by signing, for each output, a
|
|
223
|
+
statement that names the model it verified at load:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
from modelsign.guard import require_verified
|
|
227
|
+
from modelsign.attest import Attestor, verify_attestation
|
|
228
|
+
|
|
229
|
+
result = require_verified("./model", pubkey="vendor.pem")
|
|
230
|
+
attestor = Attestor(result, key="serving.pem") # refuses an unverified model
|
|
231
|
+
|
|
232
|
+
attestation = attestor.attest(response_body, request=request_body) # log it, or return it
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
modelsign verify-attestation att.json --pubkey serving_pub.pem \
|
|
237
|
+
--output response.bin --model-sig model.sig --model-pubkey vendor.pem
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
The statement carries what verification established about the model — the key
|
|
241
|
+
it verified under, the weights' hash and the hash of the identity card — plus
|
|
242
|
+
the SHA-256 of the output and optionally of the request, a nonce and the
|
|
243
|
+
attestor's key. `--model-pubkey` is what ties the attested model to a signer
|
|
244
|
+
you trust; `--model-sig` alone compares a label. It holds hashes
|
|
245
|
+
only, never the content. See [docs/attestation.md](docs/attestation.md) for
|
|
246
|
+
the exact format.
|
|
247
|
+
|
|
248
|
+
Be precise about what this proves: an attestation is a signed **claim by
|
|
249
|
+
whoever holds the serving key** that this output came from that model, and
|
|
250
|
+
evidence that neither was altered afterwards. It is not proof the computation
|
|
251
|
+
happened, which needs trusted hardware, and `issued_at` is the server's own
|
|
252
|
+
clock.
|
|
253
|
+
|
|
217
254
|
## OpenSSF Model Signing interoperability
|
|
218
255
|
|
|
219
256
|
```bash
|
|
@@ -332,6 +369,26 @@ Apache 2.0
|
|
|
332
369
|
Optional timestamps bind the model signature and current approval chain to a
|
|
333
370
|
trusted TSA time. See [the timestamp guide](docs/timestamps.md) for installation,
|
|
334
371
|
`--timestamp`, `--require-timestamp`, explicit CA trust and offline verification.
|
|
335
|
-
Install with `pip install "modelsign[timestamp]==1.
|
|
372
|
+
Install with `pip install "modelsign[timestamp]==1.3.0"` and OpenSSL 3. `signed_at` remains
|
|
336
373
|
self-reported; timestamps do not implement key revocation or prevent replay of
|
|
337
|
-
older valid releases.
|
|
374
|
+
older valid releases.
|
|
375
|
+
|
|
376
|
+
## AWS KMS signing (experimental, v1.3.0)
|
|
377
|
+
|
|
378
|
+
An optional AWS KMS backend signs through an existing pure-Ed25519 key while
|
|
379
|
+
keeping verification offline. See [the KMS guide](docs/aws-kms.md) for the signer
|
|
380
|
+
interface, optional SDK extra, IAM requirements and 4,096-byte signing-message
|
|
381
|
+
limit. This backend has SDK-contract tests, not live AWS validation, and is
|
|
382
|
+
available through `pip install "modelsign[aws-kms]==1.3.0"`.
|
|
383
|
+
|
|
384
|
+
## Deployment trust and rollback policy (v1.4)
|
|
385
|
+
|
|
386
|
+
Version 1.4 adds optional root-signed trust bundles and signed model
|
|
387
|
+
security versions. See [the policy guide](docs/trust-policy.md) for offline bundle
|
|
388
|
+
issuance, API/CLI/guard enforcement, explicit state initialization, shared sequence
|
|
389
|
+
tracking and administrative recovery. Persistent state requires POSIX flock
|
|
390
|
+
and local atomic writes.
|
|
391
|
+
|
|
392
|
+
Run `python examples/trust_policy_demo.py` from a checkout with modelsign 1.4 installed
|
|
393
|
+
to see valid loading, version rollback rejection, publisher revocation and old
|
|
394
|
+
bundle replay rejection using disposable keys and files.
|
|
@@ -182,6 +182,41 @@ them, and `--min-approvals` counts **distinct** approvers: one person in two
|
|
|
182
182
|
roles is one person. Pinning specific approvers (`require_approval(keys=...)`)
|
|
183
183
|
takes public key PEM paths or key bytes, not fingerprints.
|
|
184
184
|
|
|
185
|
+
## Runtime attestations
|
|
186
|
+
|
|
187
|
+
A model signature says what the weights are, not which weights answered a
|
|
188
|
+
request. A serving process can close that gap by signing, for each output, a
|
|
189
|
+
statement that names the model it verified at load:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from modelsign.guard import require_verified
|
|
193
|
+
from modelsign.attest import Attestor, verify_attestation
|
|
194
|
+
|
|
195
|
+
result = require_verified("./model", pubkey="vendor.pem")
|
|
196
|
+
attestor = Attestor(result, key="serving.pem") # refuses an unverified model
|
|
197
|
+
|
|
198
|
+
attestation = attestor.attest(response_body, request=request_body) # log it, or return it
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
modelsign verify-attestation att.json --pubkey serving_pub.pem \
|
|
203
|
+
--output response.bin --model-sig model.sig --model-pubkey vendor.pem
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The statement carries what verification established about the model — the key
|
|
207
|
+
it verified under, the weights' hash and the hash of the identity card — plus
|
|
208
|
+
the SHA-256 of the output and optionally of the request, a nonce and the
|
|
209
|
+
attestor's key. `--model-pubkey` is what ties the attested model to a signer
|
|
210
|
+
you trust; `--model-sig` alone compares a label. It holds hashes
|
|
211
|
+
only, never the content. See [docs/attestation.md](docs/attestation.md) for
|
|
212
|
+
the exact format.
|
|
213
|
+
|
|
214
|
+
Be precise about what this proves: an attestation is a signed **claim by
|
|
215
|
+
whoever holds the serving key** that this output came from that model, and
|
|
216
|
+
evidence that neither was altered afterwards. It is not proof the computation
|
|
217
|
+
happened, which needs trusted hardware, and `issued_at` is the server's own
|
|
218
|
+
clock.
|
|
219
|
+
|
|
185
220
|
## OpenSSF Model Signing interoperability
|
|
186
221
|
|
|
187
222
|
```bash
|
|
@@ -300,6 +335,26 @@ Apache 2.0
|
|
|
300
335
|
Optional timestamps bind the model signature and current approval chain to a
|
|
301
336
|
trusted TSA time. See [the timestamp guide](docs/timestamps.md) for installation,
|
|
302
337
|
`--timestamp`, `--require-timestamp`, explicit CA trust and offline verification.
|
|
303
|
-
Install with `pip install "modelsign[timestamp]==1.
|
|
338
|
+
Install with `pip install "modelsign[timestamp]==1.3.0"` and OpenSSL 3. `signed_at` remains
|
|
304
339
|
self-reported; timestamps do not implement key revocation or prevent replay of
|
|
305
|
-
older valid releases.
|
|
340
|
+
older valid releases.
|
|
341
|
+
|
|
342
|
+
## AWS KMS signing (experimental, v1.3.0)
|
|
343
|
+
|
|
344
|
+
An optional AWS KMS backend signs through an existing pure-Ed25519 key while
|
|
345
|
+
keeping verification offline. See [the KMS guide](docs/aws-kms.md) for the signer
|
|
346
|
+
interface, optional SDK extra, IAM requirements and 4,096-byte signing-message
|
|
347
|
+
limit. This backend has SDK-contract tests, not live AWS validation, and is
|
|
348
|
+
available through `pip install "modelsign[aws-kms]==1.3.0"`.
|
|
349
|
+
|
|
350
|
+
## Deployment trust and rollback policy (v1.4)
|
|
351
|
+
|
|
352
|
+
Version 1.4 adds optional root-signed trust bundles and signed model
|
|
353
|
+
security versions. See [the policy guide](docs/trust-policy.md) for offline bundle
|
|
354
|
+
issuance, API/CLI/guard enforcement, explicit state initialization, shared sequence
|
|
355
|
+
tracking and administrative recovery. Persistent state requires POSIX flock
|
|
356
|
+
and local atomic writes.
|
|
357
|
+
|
|
358
|
+
Run `python examples/trust_policy_demo.py` from a checkout with modelsign 1.4 installed
|
|
359
|
+
to see valid loading, version rollback rejection, publisher revocation and old
|
|
360
|
+
bundle replay rejection using disposable keys and files.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Runtime attestations
|
|
2
|
+
|
|
3
|
+
`modelsign.attest` binds a served output to the signed model behind it.
|
|
4
|
+
|
|
5
|
+
## Making one
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from modelsign.guard import require_verified
|
|
9
|
+
from modelsign.attest import Attestor
|
|
10
|
+
|
|
11
|
+
result = require_verified("./model", pubkey="vendor.pem")
|
|
12
|
+
attestor = Attestor(result, key="serving.pem")
|
|
13
|
+
attestation = attestor.attest(response_body, request=request_body)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`Attestor` is built from a `VerifyResult` and refuses one that did not verify,
|
|
17
|
+
one that verified only against its own embedded key (`allow_untrusted=True`
|
|
18
|
+
opts out, and the statement then records `"trust": "embedded"`), and one with
|
|
19
|
+
no modelsign signature digest, such as an OMS bundle. Use a serving key that
|
|
20
|
+
is not the model-signing key: the two make different claims.
|
|
21
|
+
|
|
22
|
+
## Format
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"statement": {
|
|
27
|
+
"type": "modelsign-attestation",
|
|
28
|
+
"version": 1,
|
|
29
|
+
"model": {
|
|
30
|
+
"signer_key": "<base64 raw Ed25519 key the model verified under>",
|
|
31
|
+
"sha256": "sha256:<model or manifest hash, as computed>",
|
|
32
|
+
"identity_sha256": "sha256:<canonical JSON of the signed identity card>",
|
|
33
|
+
"name": "<name from the signed identity card>",
|
|
34
|
+
"trust": "pubkey | keyring | embedded",
|
|
35
|
+
"signature_digest": "sha256:<sig_digest of the model's .sig>"
|
|
36
|
+
},
|
|
37
|
+
"output_sha256": "sha256:<hex>",
|
|
38
|
+
"request_sha256": "sha256:<hex>",
|
|
39
|
+
"issued_at": "2026-12-03T17:00:00Z",
|
|
40
|
+
"nonce": "<32 hex chars>",
|
|
41
|
+
"attestor_key": "<base64 raw Ed25519 public key>"
|
|
42
|
+
},
|
|
43
|
+
"signature": "<base64 Ed25519 signature>"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The signature is over `b"modelsign-attestation-v1\x00" + canonical_json(statement)`,
|
|
48
|
+
with RFC 8785 canonical JSON. `request_sha256` is present only when a request
|
|
49
|
+
was given.
|
|
50
|
+
|
|
51
|
+
`signer_key`, `sha256` and `identity_sha256` are the values verification
|
|
52
|
+
established: the key that did the verifying (not the one embedded in the
|
|
53
|
+
`.sig`), the hash computed from the bytes on disk, and the identity card the
|
|
54
|
+
signature covers. `signature_digest` is the digest lineage and approvals use.
|
|
55
|
+
It locates the `.sig`, but it also spans fields the model signature does not
|
|
56
|
+
authenticate (`signed_at`, the embedded public key, the `file` label, the
|
|
57
|
+
manifest listing), so someone able to edit the `.sig` can change it without
|
|
58
|
+
breaking verification. Treat it as a label, not as the binding.
|
|
59
|
+
|
|
60
|
+
Content is hashed as follows: `bytes` as they are, `str` as UTF-8, and any
|
|
61
|
+
other JSON value as its canonical encoding. The verifier must supply the same
|
|
62
|
+
form the server hashed.
|
|
63
|
+
|
|
64
|
+
## Checking one
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from modelsign.attest import verify_attestation
|
|
68
|
+
|
|
69
|
+
r = verify_attestation(attestation, pubkey="serving_pub.pem",
|
|
70
|
+
output=response_body, request=request_body,
|
|
71
|
+
model_sig="model.sig", model_pubkey="vendor.pem")
|
|
72
|
+
r.verified, r.output_checked, r.request_checked, r.model_checked, r.signer_checked
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
modelsign verify-attestation att.json --pubkey serving_pub.pem \
|
|
77
|
+
--output response.bin --request request.bin \
|
|
78
|
+
--model-sig model.sig --model-pubkey vendor.pem --json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The key inside the attestation is never used to verify it; it must equal the
|
|
82
|
+
key you supply, compared on whole key bytes, and a non-canonical base64
|
|
83
|
+
encoding is refused. A bad attestation is a falsy result rather than an
|
|
84
|
+
exception. The signature alone shows the attestor made *some* statement, so
|
|
85
|
+
the result records which of output, request, model and signer were actually
|
|
86
|
+
compared. `model_sig` alone is compared as a label; with `model_pubkey` the
|
|
87
|
+
attested signer must be that key and the `.sig` must verify under it.
|
|
88
|
+
The CLI reads `--output` and `--request` as raw bytes.
|
|
89
|
+
|
|
90
|
+
## What it does and does not establish
|
|
91
|
+
|
|
92
|
+
Established, given trust in the attestor key: its holder stated that this
|
|
93
|
+
output (and request) came from the model with this signature digest, and
|
|
94
|
+
neither the statement nor the hashed content has changed since.
|
|
95
|
+
|
|
96
|
+
Not established:
|
|
97
|
+
|
|
98
|
+
- that the computation happened as claimed. Whoever holds the serving key can
|
|
99
|
+
sign any statement; this format supplies no independent proof of execution.
|
|
100
|
+
- when it happened. `issued_at` is the attestor's own clock.
|
|
101
|
+
- that the model's signature is itself trustworthy. Check the `.sig` with
|
|
102
|
+
`modelsign verify` under your own key and approval policy.
|
|
103
|
+
- uniqueness. The nonce makes two attestations of one output distinct; it does
|
|
104
|
+
not stop an attestation from being presented twice.
|
|
105
|
+
|
|
106
|
+
Verification validates required v1 fields, digest encodings, nonce shape, and
|
|
107
|
+
the UTC timestamp syntax even for a signature-only check. Timestamp syntax
|
|
108
|
+
validation does not establish freshness or trust in the serving clock.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# AWS KMS signing (experimental)
|
|
2
|
+
|
|
3
|
+
Install with `pip install 'modelsign[aws-kms]==1.3.0'`. This backend has
|
|
4
|
+
SDK-contract tests but has not been validated against a live AWS key.
|
|
5
|
+
It uses an **existing** AWS KMS
|
|
6
|
+
`ECC_NIST_EDWARDS25519` / `SIGN_VERIFY` key and the `ED25519_SHA_512` algorithm.
|
|
7
|
+
It does not create keys, alter IAM, upload PEM keys, or fall back to a local key.
|
|
8
|
+
|
|
9
|
+
Authentication follows boto3's normal credential chain (for example a configured
|
|
10
|
+
profile, environment, or workload role). Use an approved account and region.
|
|
11
|
+
The principal needs `kms:GetPublicKey` and `kms:Sign` on the selected key.
|
|
12
|
+
AWS charges and regional algorithm availability are governed by your AWS account.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
modelsign sign model.safetensors --name Example \
|
|
16
|
+
--kms-key-id arn:aws:kms:REGION:ACCOUNT:key/KEY-ID --aws-region REGION
|
|
17
|
+
modelsign approve model.safetensors --role release \
|
|
18
|
+
--kms-key-id arn:aws:kms:REGION:ACCOUNT:key/APPROVER-KEY-ID --aws-region REGION
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`--key` and `--kms-key-id` are mutually exclusive. `--aws-region` requires the KMS
|
|
22
|
+
option; otherwise the SDK can choose a region from your configuration. Aliases
|
|
23
|
+
are accepted, but resolved once to a key ARN: each signer instance pins that ARN
|
|
24
|
+
and its exported public key, so alias retargeting does not change the instance.
|
|
25
|
+
|
|
26
|
+
The existing timestamp flags can be combined with KMS signing; install both
|
|
27
|
+
extras with `pip install 'modelsign[aws-kms,timestamp]==1.3.0'` and provide the TSA CA bundle.
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from modelsign.api import sign_model
|
|
31
|
+
from modelsign.approvals import approve
|
|
32
|
+
from modelsign.crypto.aws_kms import AwsKmsSigner
|
|
33
|
+
|
|
34
|
+
signer = AwsKmsSigner("alias/modelsign", region_name="us-east-1")
|
|
35
|
+
sign_model("model.safetensors", name="Example", signer=signer)
|
|
36
|
+
approve("model.safetensors", role="release", signer=signer)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Public key and verification
|
|
40
|
+
|
|
41
|
+
Obtain and authenticate the public key through your deployment's trusted channel.
|
|
42
|
+
For example, an administrator using their authenticated AWS account can export it:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from pathlib import Path
|
|
46
|
+
from cryptography.hazmat.primitives import serialization
|
|
47
|
+
from modelsign.crypto.aws_kms import AwsKmsSigner
|
|
48
|
+
|
|
49
|
+
signer = AwsKmsSigner("YOUR_KEY_ARN", region_name="YOUR_REGION")
|
|
50
|
+
Path("publisher-public.pem").write_bytes(signer.public_key().public_bytes(
|
|
51
|
+
serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo))
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Distribute that public key through an independently trusted channel. Verifiers
|
|
55
|
+
use the existing command, offline and without boto3 or AWS credentials:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
modelsign verify model.safetensors --pubkey publisher-public.pem
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
An ARN is not a cryptographic trust anchor. Neither the ARN nor credentials are
|
|
62
|
+
automatically added to the identity card. KMS signs the exact ModelSign message:
|
|
63
|
+
the model hash and identity-card contents (or approval fields) go to AWS; model
|
|
64
|
+
weights and the signing private key do not leave their respective locations.
|
|
65
|
+
|
|
66
|
+
## Compatibility and failure behavior
|
|
67
|
+
|
|
68
|
+
The signer interface exposes `public_key()` and `sign(message)` using pure Ed25519.
|
|
69
|
+
Local PEM keys and loaded Ed25519 keys remain supported. Model signature format,
|
|
70
|
+
approval messages, lineage, timestamp binding and offline verification stay the
|
|
71
|
+
same. Each returned signature is checked locally against the key embedded in the
|
|
72
|
+
result before a file is written.
|
|
73
|
+
|
|
74
|
+
AWS accepts at most **4,096 bytes** in RAW mode. That limit applies to the full
|
|
75
|
+
ModelSign signing message, including the identity card, not the model file.
|
|
76
|
+
Large cards are rejected with a clear error. This backend never substitutes a
|
|
77
|
+
prehashed message or Ed25519ph, which would break existing verification.
|
|
78
|
+
|
|
79
|
+
Unsupported keys, unexpected response key/algorithm, invalid returned signatures,
|
|
80
|
+
and service failures fail closed. Existing signature files are preserved on
|
|
81
|
+
signing or timestamp-request failure. SDK clients created by this backend use
|
|
82
|
+
5-second connect and 15-second read timeouts with at most two attempts; caller-
|
|
83
|
+
supplied SDK clients retain their own configuration.
|
|
84
|
+
|
|
85
|
+
## Test status
|
|
86
|
+
|
|
87
|
+
The implementation is tested using botocore Stubber with exact request parameters
|
|
88
|
+
and real local Ed25519 signatures returned at the SDK boundary. This exercises
|
|
89
|
+
local verification and policy, but **is not a live AWS KMS interoperability test**.
|
|
90
|
+
No production AWS account or key has been provisioned or used for this branch.
|
|
91
|
+
|
|
92
|
+
References: [AWS Sign](https://docs.aws.amazon.com/kms/latest/APIReference/API_Sign.html),
|
|
93
|
+
[AWS GetPublicKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Sharing demo verification
|
|
2
|
+
|
|
3
|
+
Executed on 2026-12-03 with Python 3.12 in a virtual environment containing the
|
|
4
|
+
published PyPI ModelSign 1.3.0 package (not an editable source installation).
|
|
5
|
+
|
|
6
|
+
Command: `python examples/security_review_demo.py`
|
|
7
|
+
|
|
8
|
+
Result: exit status 0. All eight checks returned true:
|
|
9
|
+
|
|
10
|
+
- Valid model and trusted approval accepted.
|
|
11
|
+
- Output, request, model and signer comparisons all performed.
|
|
12
|
+
- Changed output rejected.
|
|
13
|
+
- Changed request rejected.
|
|
14
|
+
- Wrong attestor key rejected.
|
|
15
|
+
- Wrong model signer rejected.
|
|
16
|
+
- Changed model blocked by the pre-load guard.
|
|
17
|
+
- Restored original model still verifies.
|
|
18
|
+
|
|
19
|
+
The script uses disposable synthetic model bytes and a synthetic response. It does
|
|
20
|
+
not run inference or call AWS/TSA/network services. The separate FinSense artifact
|
|
21
|
+
compatibility check was completed during the v1.3.0 release verification.
|
|
22
|
+
|
|
23
|
+
The v1.4 design received a builder review. Its two findings—approval checks before
|
|
24
|
+
model-state commit and shared bundle-sequence state across model IDs—were resolved;
|
|
25
|
+
the follow-up review reported no important unanswered planning questions. This is
|
|
26
|
+
not implementation verification or a security audit of code that does not yet exist.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# ModelSign 1.3.0: engineering review packet
|
|
2
|
+
|
|
3
|
+
Status: draft for sharing. No outreach has been sent by preparing this packet.
|
|
4
|
+
Audience: engineers responsible for model artifact verification, ML deployment
|
|
5
|
+
pipelines, inference services, or software supply-chain security.
|
|
6
|
+
|
|
7
|
+
## Short message
|
|
8
|
+
|
|
9
|
+
I released ModelSign 1.3.0, an Apache-2.0 Python library/CLI for signing model
|
|
10
|
+
artifacts and enforcing verification before loading them. It supports timestamped
|
|
11
|
+
approval chains and serving-key attestations that bind response/request hashes to
|
|
12
|
+
the verified model's content, identity card and signer.
|
|
13
|
+
|
|
14
|
+
I've published a FinSense v5 example with a timestamped signature and a pre-load
|
|
15
|
+
verification gate. There is also a small offline demo that rejects changed model
|
|
16
|
+
bytes, changed outputs/requests and incorrect keys. The offline demo uses synthetic
|
|
17
|
+
bytes and does not run inference.
|
|
18
|
+
|
|
19
|
+
I'd value a technical review: can you reproduce the failure cases, find a trust or
|
|
20
|
+
policy bypass, or identify friction in putting this into an MLOps pipeline?
|
|
21
|
+
|
|
22
|
+
Runtime attestations are signed claims by a serving key, not proof of execution.
|
|
23
|
+
AWS KMS support is experimental and tested at the SDK boundary, not with a live
|
|
24
|
+
AWS key. Revocation feeds and rollback floors are design work for v1.4, not shipped
|
|
25
|
+
features.
|
|
26
|
+
|
|
27
|
+
- Release: https://pypi.org/project/modelsign/1.3.0/
|
|
28
|
+
- Source and notes: https://github.com/QuantQJ/modelsign/releases/tag/v1.3.0
|
|
29
|
+
- FinSense: https://huggingface.co/ConstantQJ/finsense-v5
|
|
30
|
+
- Review scope: https://github.com/QuantQJ/modelsign/blob/v1.3.0/docs/reviews/2026-12-03-v1.3.0.md
|
|
31
|
+
|
|
32
|
+
James Kerr / Constant Systems
|
|
33
|
+
|
|
34
|
+
## Reproduce the offline demonstration
|
|
35
|
+
|
|
36
|
+
Use a fresh environment with Python 3.9 or later. This demo requires neither
|
|
37
|
+
OpenSSL, an external TSA, AWS, nor ML frameworks:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python3 -m venv .venv-modelsign-review
|
|
41
|
+
.venv-modelsign-review/bin/python -m pip install 'modelsign==1.3.0'
|
|
42
|
+
.venv-modelsign-review/bin/python examples/security_review_demo.py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The script accompanies this packet in the repository branch/PR containing the
|
|
46
|
+
packet; it was added after the v1.3.0 tag, so do not expect it in that tag's tree.
|
|
47
|
+
Run the commands from a checkout containing it. It uses temporary keys and files,
|
|
48
|
+
cleans them up, and exits nonzero if an expected security check fails. On Windows
|
|
49
|
+
use the environment's Scripts/python.exe instead of bin/python.
|
|
50
|
+
|
|
51
|
+
Expected: modelsign_version is 1.3.0, synthetic_demo is true, and all eight checks
|
|
52
|
+
are true. This shows integrity/policy behavior with known fixtures; it is not an
|
|
53
|
+
independent security audit or an ML accuracy benchmark.
|
|
54
|
+
|
|
55
|
+
## Reproduce the real FinSense artifact gate
|
|
56
|
+
|
|
57
|
+
Use the pinned public revision:
|
|
58
|
+
https://huggingface.co/ConstantQJ/finsense-v5/tree/822405c196aa16b6c3cb2030f8e231fc88a31ca1
|
|
59
|
+
|
|
60
|
+
Follow that revision's SIGNING.md snapshot download instructions. Fetch all actual
|
|
61
|
+
LFS objects, not just Git pointer files. Download into a clean directory, keep
|
|
62
|
+
keys/CA outside the snapshot, and do not add files before verifying its manifest.
|
|
63
|
+
The signed guide pins ModelSign 1.2.0; v1.3.0 was separately tested against this
|
|
64
|
+
unchanged artifact. Install the timestamp extra when evaluating v1.3.0:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m pip install 'modelsign[timestamp]==1.3.0'
|
|
68
|
+
modelsign verify /path/to/clean-snapshot \
|
|
69
|
+
--sig /path/to/clean-snapshot/modelsign.sig \
|
|
70
|
+
--pubkey /path/to/independently-trusted-publisher.pem \
|
|
71
|
+
--require-timestamp --tsa-ca /path/to/independently-trusted-tsa-ca.pem --json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
OpenSSL 3 must be available; on macOS with Homebrew set MODELSIGN_OPENSSL to the
|
|
75
|
+
installed OpenSSL 3 executable if the system command is LibreSSL.
|
|
76
|
+
|
|
77
|
+
Confirm the publisher key independently. Its full SHA-256 fingerprint of the raw
|
|
78
|
+
32-byte public key is:
|
|
79
|
+
`fac28faad5cb425998539313db2ba0e26ea42320c3ca620c39e11be22eaed1d5`.
|
|
80
|
+
This packet is a reference, not an independent trust channel for someone obtaining
|
|
81
|
+
all their files from one untrusted source. Do not use the short display fingerprint
|
|
82
|
+
as an authorization identifier. The TSA CA also requires independent trust.
|
|
83
|
+
|
|
84
|
+
For the changed-file case, run TAMPER_DEMO.md from the pinned revision using this
|
|
85
|
+
v1.3 environment. It modifies only a temporary copy. Model verification does not
|
|
86
|
+
validate sentiment accuracy or the provenance of training data. Review the model
|
|
87
|
+
card's evaluation limitations separately. FinSense does not automatically publish
|
|
88
|
+
per-response runtime attestations; those are demonstrated by the separate script.
|
|
89
|
+
|
|
90
|
+
## Reviewer questions
|
|
91
|
+
|
|
92
|
+
1. Can altered bytes, identity fields, approvals or serving statements be accepted
|
|
93
|
+
under pinned keys and the explicitly required policy?
|
|
94
|
+
2. Are the actual checked properties clear in API and CLI results? Can a caller
|
|
95
|
+
confuse signature-only verification with output/model/signer verification?
|
|
96
|
+
3. Does the pre-load gate fit artifact caching, container builds and inference
|
|
97
|
+
startup? What concrete integration would remove the most friction?
|
|
98
|
+
4. For the proposed v1.4 policy, are bundle scope, revocation behavior and state
|
|
99
|
+
transitions sufficiently explicit? The design is separate from this release.
|
|
100
|
+
|
|
101
|
+
## How to share without overstating it
|
|
102
|
+
|
|
103
|
+
Send the short message and demo to a small number of engineers who own the relevant
|
|
104
|
+
pipeline, or use a community's designated project/showcase channel after checking
|
|
105
|
+
its current rules. Ask for reproducible findings rather than endorsements. A useful
|
|
106
|
+
bug report contains version, OS/Python version, command, expected/actual outcome and
|
|
107
|
+
minimal non-sensitive fixture. Never ask reviewers to share private keys or cloud
|
|
108
|
+
credentials. Do not describe ModelSign as proof of AI execution, regulatory
|
|
109
|
+
compliance, prevention of every supply-chain attack, or validation of FinSense's
|
|
110
|
+
financial performance.
|
|
111
|
+
|
|
112
|
+
Recipient selection and sending remain separate actions; this packet is ready for
|
|
113
|
+
review and has not been emailed, posted, or sent as a direct message.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# v1.3.0 release review
|
|
2
|
+
|
|
3
|
+
Scope: combined runtime attestations, optional AWS KMS signing, timestamp composition,
|
|
4
|
+
malformed-input handling, and the key-management paths used by these features.
|
|
5
|
+
|
|
6
|
+
## Findings resolved
|
|
7
|
+
|
|
8
|
+
- Attestation verification accepted signed malformed statements with missing or invalid
|
|
9
|
+
required hashes, nonce, clock syntax, trust label, or non-integer version. These now fail.
|
|
10
|
+
- Lone-surrogate output text escaped the content-error boundary. It now produces a
|
|
11
|
+
controlled error on creation and a failed verification result on checking.
|
|
12
|
+
- Canonicalization of unsigned model-signature metadata could raise after successful
|
|
13
|
+
cryptographic verification. Envelope canonicalization now runs inside the malformed-input handler.
|
|
14
|
+
- Key generation could overwrite one half of an existing pair. Incomplete/mismatched
|
|
15
|
+
pairs now fail without replacement; creation is exclusive, with private mode 0600.
|
|
16
|
+
- Keyring aliases allowed path traversal. Aliases now permit only a leading ASCII
|
|
17
|
+
letter/digit followed by letters/digits, underscore, dot, or hyphen.
|
|
18
|
+
- Keyring writes followed destination symlinks/hardlinks. Symlinks are rejected;
|
|
19
|
+
validated PEMs are atomically replaced, preserving outside hardlinked files.
|
|
20
|
+
|
|
21
|
+
Regression tests reproduced failures before fixes. An independent read-only review
|
|
22
|
+
found the malformed-metadata exception; the follow-up review found no additional
|
|
23
|
+
important issues in the reviewed changes.
|
|
24
|
+
|
|
25
|
+
- Signature-reader field types are checked before use; numeric hashes and malformed
|
|
26
|
+
identity/approval/timestamp containers fail instead of crashing or passing through.
|
|
27
|
+
|
|
28
|
+
## Verification and performance
|
|
29
|
+
|
|
30
|
+
The integrated end-to-end test covers KMS signing and approval (SDK stub with real
|
|
31
|
+
Ed25519 signatures), RFC 3161 timestamps from a local test authority, verified model
|
|
32
|
+
load, output/request attestation, and independent signer checks. Altered content
|
|
33
|
+
and wrong keys are rejected. No model bytes or keys are sent to live AWS.
|
|
34
|
+
|
|
35
|
+
A local Python 3.12 benchmark performed five rounds of 1,000 attest+verify operations
|
|
36
|
+
on a 1 KiB output. Median round-average: 0.113 ms per operation pair. This excludes
|
|
37
|
+
network calls and model inference and is not a cross-platform performance guarantee.
|
|
38
|
+
No cryptographic checks were removed for performance.
|
|
39
|
+
|
|
40
|
+
## Boundaries
|
|
41
|
+
|
|
42
|
+
This is a bounded source/test review, not a claim that all possible bugs are exhausted.
|
|
43
|
+
The AWS backend remains experimental pending live interoperability validation.
|
|
44
|
+
Serving attestations are signed claims, with no execution proof, freshness policy,
|
|
45
|
+
or replay-prevention state. Caller-owned mutable verification results are not a
|
|
46
|
+
security boundary against code already executing in the serving process. No C2PA,
|
|
47
|
+
revocation feed, transparency log, or monotonic rollback policy is added here.
|