40 Recipe: Sign and verify model artefacts
| Field | Value |
|---|---|
| Tool | model_signing (sigstore/model-transparency; the manifest modelsign row) + cosign — the pre-#210 helper-pack row was phantom-upstream (removed; registry: os#210) |
| Section | Administrator |
| Level | medium |
| Time | ~25 min (+ OIDC first run) |
| Layer/Category | DEFENCE / d-04-provenance-signing-trust |
| Tags | admin, signing, models, sigstore, rekor, fulcio |
40.1 Problem
The lab serves fine-tuned or downloaded model artefacts: an HF checkpoint, a local GGUF, a trained adapter directory. “We think this came from us last Tuesday” is not a trust statement. Models move as directories of files; a file-hash in a README is unauthenticated. The task: an identity-bound, tamper-evident signature over the model directory. A verifier checks it WITHOUT a key-distribution ceremony: exactly the Sigstore model-signing flow. The D-4 manifest row carries it (modelsign, wrapping the real sigstore/model-transparency project — post-os#210 URL correction).
40.2 Solution
Sign with Sigstore keyless (the OIDC identity is the trust anchor), or with a plain key pair when the box is offline. Verify the same identity back:
# 1. Confirm the rows + the CLI surface at your pin
kailash info modelsign # d-04 row: wraps sigstore/model-transparency
# 2. Sign a model directory, keyless (Sigstore default; opens an OIDC
# flow — browser or device-code — and records the event to Rekor)
modelsign sign ./path/to/model-dir --signature <model>.sig
# (the wrapping CLI's shape; sigstore/model-signing's canonical CLI is
# `model_signing` — the flags it carries below are its verified surface)
# 3. Verify before you USE a downloaded model — identity must be a
# value you EXPECT (from the trainer's published verification
# instructions, never "whatever signed it"):
model_signing verify ./path/to/model-dir \
--signature <model>.sig \
--identity "<signer-identity>" --identity_provider "<oidc-provider>"
# -> signature valid + recomputed per-file digests match the bundle's
# signed subject list
# 4. Negative case (the proof it is doing something): ANY file in the
# directory changed since signing?
echo x >> ./path/to/model-dir/some-file
model_signing verify ./path/to/model-dir --signature <model>.sig \
--identity "<signer-identity>" --identity_provider "<oidc-provider>"
# -> verification FAILS (digest mismatch). Restore the file.
# 5. Offline/lab-closed alternative — plain key pair signing:
openssl ecparam -name prime256v1 -genkey -noout -out key.priv
openssl ec -in key.priv -pubout > key.pub
model_signing sign key ./model-dir --private_key key.priv --signature model.sig
model_signing verify key ./model-dir --signature model.sig --public_key key.pub
# 6. Transparency-log side-quest: WHO signed WHAT, WHEN (the Rekor
# log itself + cosign's container view for comparison):
cosign verify <registry>/<image>:<tag> \
--certificate-identity "<identity>" --certificate-oidc-issuer "<issuer>"
# -> container images verify against the registry; model dirs verify
# against the local bundle — know which world your artefact is inExpected output shape (abridged):
$ model_signing verify ./bert-base-uncased --signature model.sig \
--identity "user@example.com" --identity_provider "https://github.com/login/oauth"
Verification succeeded. # signature checks; per-file digests match
$ (file modified)
Verification failed: <file> digest mismatch
What success looks like:
- signing produced a signature bundle/JSON file
- the Sigstore bundle carries the DSSE envelope, the certificate, and the Rekor inclusion proof — not a bare detached hash
- verification names the PREDICTED identity (not merely “any valid chain”) and fails on a single-file tamper
- the keyless path’s first run opened an OIDC flow
- the key path worked with no network beyond the local box
- model-card metadata that matters to the governance story sits inside the signed statement (the predicate carries the metadata payload per the upstream format)
- so “who says What about this model” is itself covered
40.3 Discussion
- Why Sigstore and not “just sign with GPG”: model directories are big (multi-GB) and multi-file; hashing is per-file-shard work upstream. The model-signing approach gives a per-file digest set bound into a DSSE-signed in-toto statement — so the verifier gets file-level granularity and identity binding via the OIDC provider (Google / GitHub / Microsoft / CI workload identities supported upstream), and a Transparency-log record of the signing event (verifiers get proof of inclusion in Rekor from the bundle itself). Signers should monitor the log for unexpected signing events under their identity — that is exactly the discovery the transparency log buys.
- Where the kailash row stands: the manifest row
modelsignpins sigstore/model-signing (Apache-2.0, safety: safe — this is pure signature work, no firing, no target). The signature produced by the pinned upstream CLI is the format contract. This recipe is the canonical check that the packaged wrapper agrees with the upstream surface at the lock’s pin. - Cosign and model_signing are two ends of the same design: cosign covers containers and blobs (signature attached to registry or bundle next to file); model_signing covers model directories with per-file semantics. A model loaded INTO a container is in both worlds — sign the container AND the model directory. The two signatures together cover the artefact and its contents.
- Private Sigstore instances: labs that run their own Fulcio/Rekor (the air-gapped/enterprise shape) pass
--trust_configon both sign and verify. The identity/provider flags still bind the human claim, the trust config binds the infrastructure claim. Keep both in the SAME story when citing a verification downstream. - CI-shaped signing: an automated pipeline signs with its workload identity (GitHub Actions’ token identity
https://<org>/<repo>/.github/workflows/<wf>.yml@refs/heads/mainper the upstream’s supported provider list). A verifier can then demand exactly that identity — provenance without a human in the loop but with a nameable one. - SLSA for models: sigstore’s model-transparency README names the SLSA-for-ML extension as the statement’s predicate lineage. That provenance story (Prove what an installed artefact is) and this recipe’s signature statement share the same in-toto machinery. The two aim at different artefact classes. Use both; cite each for what it covers.
40.4 See also
- Prove what an installed artefact is: SBOM + provenance — the artefact-side of the same chain
- Boot a verified release image
- The D-4 manifest rows (modelsign, cosign — kailash packages manifest, single source of truth; the pre-#210 the helper pack row was phantom-upstream, removed per os#210): https://github.com/kailash-os/kailash-packages/blob/main/manifest/tools.yaml
- sigstore/model-transparency upstream (CLI + format spec; the project renamed from ‘model-signing’ — the manifest row’s pre-#210 URL was corrected in the os#210 purge): https://github.com/sigstore/model-transparency · https://pypi.org/project/model-signing/
- Sigstore transparency log + Fulcio explainer: https://docs.sigstore.dev/about/bundle/
- Recipe directory
ref: D-4 manifest rows (modelsign → sigstore/model-transparency; cosign) + the upstream model_signing CLI surface at current docs (sign/verify, sigstore|key|certificate, –signature, –identity/–identity_provider, –trust_config) — manifest + upstream README/Pypi at 1.1.1 - verified 2026-10-14. CLI shapes verified against upstream docs at the pin; the kailash packaged modelsign wrapper’s own flags: PENDING vs the upstream model_signing — read the derivation’s help at your pin and hold the recipe to THAT surface; flag drift is a re-work (the recipe-provenance rule), not a workaround.
Recipe provenance. Command shapes above are grounded in the manifest row and the pinned upstream CLI at the packaging pin; expected output renders as shapes, never transcripts. ref: manifest of record - verified 2026-10-14. Hands-on verification: PENDING - tracked by the standing upkeep lane (kailash-book#12).