vouch-mlflow 0.1.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.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: vouch-mlflow
3
+ Version: 0.1.0
4
+ Summary: Sign MLflow model artifacts with Vouch Credentials for verifiable model lineage.
5
+ Author: Ramprasad Gaddam
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://vouch-protocol.com
8
+ Project-URL: Source, https://github.com/vouch-protocol/vouch
9
+ Keywords: mlflow,vouch,model-provenance,model-signing,verifiable-credentials,mlops
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: vouch-protocol>=1.6.2
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=7.0; extra == "dev"
19
+
20
+ # vouch-mlflow
21
+
22
+ Sign [MLflow](https://mlflow.org/) model artifacts with
23
+ [Vouch](https://vouch-protocol.com) Credentials, so a registered model carries
24
+ verifiable lineage: who registered it, on whose authority, and a content digest
25
+ that breaks if the weights are tampered with.
26
+
27
+ This complements OpenSSF Model Signing. OMS proves an artifact is intact and
28
+ signed by a key; Vouch adds the agent and delegation dimension, which principal
29
+ or pipeline registered the model, traceable back to an accountable human.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install vouch-mlflow
35
+ ```
36
+
37
+ It has no hard dependency on MLflow. The helpers work on any file or directory
38
+ path, so they fit any artifact store.
39
+
40
+ ## Sign at registration time
41
+
42
+ ```python
43
+ from vouch import Signer
44
+ from vouch_mlflow import sign_model
45
+
46
+ signer = Signer(private_key=PRIV_JWK, did="did:web:ml.acme.com")
47
+
48
+ # After mlflow.log_model(...) wrote the model to a local path:
49
+ credential = sign_model(signer, "runs:/abc/model_local_path", name="fraud-detector")
50
+
51
+ # Attach to the run so it travels with the model:
52
+ import mlflow, json
53
+ mlflow.set_tag("vouch_credential", json.dumps(credential, separators=(",", ":")))
54
+ ```
55
+
56
+ ## Verify on load
57
+
58
+ ```python
59
+ from vouch_mlflow import verify_model
60
+
61
+ ok, passport = verify_model(model_path, credential, public_key=registrant_pubkey)
62
+ if not ok:
63
+ raise RuntimeError("Model signature invalid or weights changed since signing")
64
+ ```
65
+
66
+ `verify_model` checks both the signature and that the on-disk content still
67
+ matches the digest the credential was bound to.
68
+
69
+ ## License
70
+
71
+ Apache-2.0.
@@ -0,0 +1,52 @@
1
+ # vouch-mlflow
2
+
3
+ Sign [MLflow](https://mlflow.org/) model artifacts with
4
+ [Vouch](https://vouch-protocol.com) Credentials, so a registered model carries
5
+ verifiable lineage: who registered it, on whose authority, and a content digest
6
+ that breaks if the weights are tampered with.
7
+
8
+ This complements OpenSSF Model Signing. OMS proves an artifact is intact and
9
+ signed by a key; Vouch adds the agent and delegation dimension, which principal
10
+ or pipeline registered the model, traceable back to an accountable human.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install vouch-mlflow
16
+ ```
17
+
18
+ It has no hard dependency on MLflow. The helpers work on any file or directory
19
+ path, so they fit any artifact store.
20
+
21
+ ## Sign at registration time
22
+
23
+ ```python
24
+ from vouch import Signer
25
+ from vouch_mlflow import sign_model
26
+
27
+ signer = Signer(private_key=PRIV_JWK, did="did:web:ml.acme.com")
28
+
29
+ # After mlflow.log_model(...) wrote the model to a local path:
30
+ credential = sign_model(signer, "runs:/abc/model_local_path", name="fraud-detector")
31
+
32
+ # Attach to the run so it travels with the model:
33
+ import mlflow, json
34
+ mlflow.set_tag("vouch_credential", json.dumps(credential, separators=(",", ":")))
35
+ ```
36
+
37
+ ## Verify on load
38
+
39
+ ```python
40
+ from vouch_mlflow import verify_model
41
+
42
+ ok, passport = verify_model(model_path, credential, public_key=registrant_pubkey)
43
+ if not ok:
44
+ raise RuntimeError("Model signature invalid or weights changed since signing")
45
+ ```
46
+
47
+ `verify_model` checks both the signature and that the on-disk content still
48
+ matches the digest the credential was bound to.
49
+
50
+ ## License
51
+
52
+ Apache-2.0.
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vouch-mlflow"
7
+ version = "0.1.0"
8
+ description = "Sign MLflow model artifacts with Vouch Credentials for verifiable model lineage."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "Ramprasad Gaddam" }]
13
+ keywords = ["mlflow", "vouch", "model-provenance", "model-signing", "verifiable-credentials", "mlops"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "License :: OSI Approved :: Apache Software License",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: Security :: Cryptography",
19
+ ]
20
+ dependencies = ["vouch-protocol>=1.6.2"]
21
+
22
+ [project.optional-dependencies]
23
+ dev = ["pytest>=7.0"]
24
+
25
+ [project.urls]
26
+ Homepage = "https://vouch-protocol.com"
27
+ Source = "https://github.com/vouch-protocol/vouch"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ """vouch-mlflow: sign MLflow model artifacts with Vouch Credentials.
2
+
3
+ Thin distribution wrapping vouch.integrations.mlflow. It exists so the MLflow
4
+ signing helpers can be installed and listed on their own while the
5
+ implementation stays single-sourced in the vouch-protocol package.
6
+ """
7
+
8
+ from vouch.integrations.mlflow import compute_model_digest, sign_model, verify_model
9
+
10
+ __all__ = ["sign_model", "verify_model", "compute_model_digest"]
11
+ __version__ = "0.1.0"
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: vouch-mlflow
3
+ Version: 0.1.0
4
+ Summary: Sign MLflow model artifacts with Vouch Credentials for verifiable model lineage.
5
+ Author: Ramprasad Gaddam
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://vouch-protocol.com
8
+ Project-URL: Source, https://github.com/vouch-protocol/vouch
9
+ Keywords: mlflow,vouch,model-provenance,model-signing,verifiable-credentials,mlops
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: vouch-protocol>=1.6.2
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=7.0; extra == "dev"
19
+
20
+ # vouch-mlflow
21
+
22
+ Sign [MLflow](https://mlflow.org/) model artifacts with
23
+ [Vouch](https://vouch-protocol.com) Credentials, so a registered model carries
24
+ verifiable lineage: who registered it, on whose authority, and a content digest
25
+ that breaks if the weights are tampered with.
26
+
27
+ This complements OpenSSF Model Signing. OMS proves an artifact is intact and
28
+ signed by a key; Vouch adds the agent and delegation dimension, which principal
29
+ or pipeline registered the model, traceable back to an accountable human.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install vouch-mlflow
35
+ ```
36
+
37
+ It has no hard dependency on MLflow. The helpers work on any file or directory
38
+ path, so they fit any artifact store.
39
+
40
+ ## Sign at registration time
41
+
42
+ ```python
43
+ from vouch import Signer
44
+ from vouch_mlflow import sign_model
45
+
46
+ signer = Signer(private_key=PRIV_JWK, did="did:web:ml.acme.com")
47
+
48
+ # After mlflow.log_model(...) wrote the model to a local path:
49
+ credential = sign_model(signer, "runs:/abc/model_local_path", name="fraud-detector")
50
+
51
+ # Attach to the run so it travels with the model:
52
+ import mlflow, json
53
+ mlflow.set_tag("vouch_credential", json.dumps(credential, separators=(",", ":")))
54
+ ```
55
+
56
+ ## Verify on load
57
+
58
+ ```python
59
+ from vouch_mlflow import verify_model
60
+
61
+ ok, passport = verify_model(model_path, credential, public_key=registrant_pubkey)
62
+ if not ok:
63
+ raise RuntimeError("Model signature invalid or weights changed since signing")
64
+ ```
65
+
66
+ `verify_model` checks both the signature and that the on-disk content still
67
+ matches the digest the credential was bound to.
68
+
69
+ ## License
70
+
71
+ Apache-2.0.
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/vouch_mlflow/__init__.py
4
+ src/vouch_mlflow.egg-info/PKG-INFO
5
+ src/vouch_mlflow.egg-info/SOURCES.txt
6
+ src/vouch_mlflow.egg-info/dependency_links.txt
7
+ src/vouch_mlflow.egg-info/requires.txt
8
+ src/vouch_mlflow.egg-info/top_level.txt
9
+ tests/test_smoke.py
@@ -0,0 +1,4 @@
1
+ vouch-protocol>=1.6.2
2
+
3
+ [dev]
4
+ pytest>=7.0
@@ -0,0 +1 @@
1
+ vouch_mlflow
@@ -0,0 +1,70 @@
1
+ """Smoke tests for the vouch-mlflow package."""
2
+
3
+ import json
4
+ import os
5
+
6
+ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
7
+ from jwcrypto.common import base64url_decode
8
+
9
+ from vouch import Signer, generate_identity
10
+
11
+
12
+ def _pub(kp):
13
+ return Ed25519PublicKey.from_public_bytes(base64url_decode(json.loads(kp.public_key_jwk)["x"]))
14
+
15
+
16
+ def test_package_exports():
17
+ import vouch_mlflow
18
+
19
+ assert vouch_mlflow.sign_model is not None
20
+ assert vouch_mlflow.verify_model is not None
21
+ assert vouch_mlflow.compute_model_digest is not None
22
+
23
+
24
+ def test_sign_and_verify_model(tmp_path):
25
+ from vouch_mlflow import sign_model, verify_model
26
+
27
+ model = tmp_path / "model.bin"
28
+ model.write_bytes(b"fake model weights v1")
29
+
30
+ kp = generate_identity()
31
+ signer = Signer(private_key=kp.private_key_jwk, did="did:web:ml.acme.com")
32
+
33
+ cred = sign_model(signer, str(model), name="fraud-detector")
34
+ assert cred["proof"]["cryptosuite"] == "eddsa-jcs-2022"
35
+
36
+ ok, _ = verify_model(str(model), cred, public_key=_pub(kp))
37
+ assert ok is True
38
+
39
+
40
+ def test_tampered_model_fails(tmp_path):
41
+ from vouch_mlflow import sign_model, verify_model
42
+
43
+ model = tmp_path / "model.bin"
44
+ model.write_bytes(b"fake model weights v1")
45
+
46
+ kp = generate_identity()
47
+ signer = Signer(private_key=kp.private_key_jwk, did="did:web:ml.acme.com")
48
+ cred = sign_model(signer, str(model))
49
+
50
+ # Tamper with the weights after signing.
51
+ model.write_bytes(b"poisoned weights")
52
+
53
+ ok, _ = verify_model(str(model), cred, public_key=_pub(kp))
54
+ assert ok is False
55
+
56
+
57
+ def test_directory_model(tmp_path):
58
+ from vouch_mlflow import sign_model, verify_model
59
+
60
+ d = tmp_path / "model"
61
+ d.mkdir()
62
+ (d / "weights.bin").write_bytes(b"w")
63
+ (d / "config.json").write_bytes(b"{}")
64
+
65
+ kp = generate_identity()
66
+ signer = Signer(private_key=kp.private_key_jwk, did="did:web:ml.acme.com")
67
+ cred = sign_model(signer, str(d), name="dir-model")
68
+
69
+ ok, _ = verify_model(str(d), cred, public_key=_pub(kp))
70
+ assert ok is True