Skip to content

Commit b6cd57e

Browse files
Add Provenza: Agent Manifest issuer (composition-only, hybrid COSE) (#413)
* Add Provenza: Agent Manifest issuer (composition-only, hybrid COSE) * provenza-agent-manifest: require both hybrid signers; pin exit codes --------- Co-authored-by: Rajnish Tiwari <121179385+rajnisht7@users.noreply.github.com>
1 parent 05d1637 commit b6cd57e

9 files changed

Lines changed: 391 additions & 1 deletion

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: provenza-agent-manifest conformance
2+
on:
3+
push:
4+
paths:
5+
- "integrations/provenza-agent-manifest/**"
6+
- ".github/workflows/provenza-agent-manifest-conformance.yml"
7+
pull_request:
8+
paths:
9+
- "integrations/provenza-agent-manifest/**"
10+
- ".github/workflows/provenza-agent-manifest-conformance.yml"
11+
schedule:
12+
- cron: "0 6 * * 1"
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
conformance:
20+
name: ${{ matrix.sdk }} agent-manifest, Python ${{ matrix.python }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python: ["3.11", "3.12", "3.13"]
25+
# tested_against, and the latest release (drift detection)
26+
sdk: ["pinned", "latest"]
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
31+
with:
32+
python-version: ${{ matrix.python }}
33+
- name: Install agent-manifest
34+
run: |
35+
if [ "${{ matrix.sdk }}" = pinned ]; then
36+
v=$(sed -n 's/^ agent-manifest: "\([^"]*\)"$/\1/p' integrations/provenza-agent-manifest/integration.yaml)
37+
test -n "$v"
38+
python -m pip install "agent-manifest==$v" pytest
39+
else
40+
python -m pip install agent-manifest pytest
41+
fi
42+
# This integration verifies Agent Manifests; it emits no TRACE record.
43+
- name: Integration tests against the sample manifest
44+
run: python -m pytest integrations/provenza-agent-manifest/tests -q

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ TRACE only works as a standard if it is genuinely neutral. Integrations are list
7777
| [Parmana](integrations/parmana-server/) | Parmana Systems | trace | verified |
7878
| [PIC Standard MCP Guard](integrations/pic-standard-mcp-guard/) | PIC Standard | trace | verified |
7979
| [Observed-effect references](integrations/probityai-observed-effect/) | probityai | trace | community |
80+
| [Provenza](integrations/provenza-agent-manifest/) | Provenza | agent-manifest | community |
8081
| [ramen-ai cMCP Adapter](integrations/ramen-ai-cmcp/) | ramen-ai | cmcp, trace | verified |
8182
| [SAGE AgenTrust Bridge](integrations/sage-agenttrust/) | SAGE | cmcp, trace | community |
8283
| [Agent Sentinel](integrations/sentinel/) | a1k7 | trace | community |
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Provenza Agent Manifest issuer
2+
3+
[Provenza](https://github.com/kironovlaziz-del/provenza) is a self-hosted AI and agent governance server. It issues an Agent Manifest (specification v0.2) for every agent it governs, and this directory verifies such a manifest offline with the released `agent-manifest` SDK.
4+
5+
## What it does
6+
7+
Provenza builds the manifest from what it governs, signs it with the organization's audit key, and hands it out on the agent's page (**Agent Manifest**) or at `GET /api/v1/agents/{id}/manifest` (JSON: the payload, the COSE envelope, the signing keys) and `GET /api/v1/agents/{id}/manifest.cose`.
8+
9+
| Manifest field | What Provenza binds |
10+
|---|---|
11+
| envelope | `COSE_Sign` with two signers, Ed25519 and ML-DSA-65 (hybrid), `crypto_profile: standard` |
12+
| `profile` | `composition-only`: Provenza is the policy gate, not the agent |
13+
| `agent_id` | the SPIFFE ID the agent attested with, else `spiffe://<server>/org/<org>/agent/<id>` |
14+
| `issuer` | `spiffe://<server>/org/<org>/provenza` |
15+
| `artifacts.tool_manifest` | the approved MCP tools Provenza serves the agent: per tool, the hash of `{input_schema, output_schema}` and of the description (RFC 8785, as cMCP projects its catalog), and the Merkle `catalog_hash`. `rug_pull_policy: require-reapproval` (a definition changed upstream is withheld until re-approved), `allow_dynamic_registration: false` |
16+
| `artifacts.decision_trace` | `merkle-log`: the root of the organization's latest signed audit checkpoint, its size and window, the checkpoint key's fingerprint |
17+
| `hitl_record.required` | `true` when the agent's policies hold actions for a person's approval |
18+
| `previous_manifest_id` | the manifest it replaces; a new one is issued when the tools, the approval requirement or the signing key change, or near expiry (90 days) |
19+
20+
## What it does not claim
21+
22+
- **Not a complete manifest.** System prompt, model identity, RAG corpus, memory, supply chain and delegation chain are declared in `unbound_artifacts`: Provenza does not observe them. The SDK's verdict is `INCOMPLETE`, never `VALID`.
23+
- **No policy bundle.** The specification names Cedar, Rego and AGT YAML; Provenza's policy format is none of them, so `policy_bundle` stays unbound.
24+
- **A partial tool catalog is never bound.** When an agent is registered for tools that Provenza does not serve as approved MCP tools, `tool_manifest` is unbound rather than listing only some tools.
25+
- **No hardware attestation, no transparency log.** The keys are software keys held by the Provenza server (`audit_key_sealed: false`); no `attestation` block, no `transparency_log_entry`. Conformance levels do not apply to a composition-only manifest.
26+
- **No HITL approvals attached.** Provenza signs approvals per held action; the manifest states only whether approvals are required.
27+
28+
## Usage
29+
30+
```bash
31+
pip install agent-manifest==0.15.0
32+
python src/verify_provenza_manifest.py agent-7-manifest.cose --ed25519 <base64> --ml-dsa <base64>
33+
```
34+
35+
`--ed25519` and `--ml-dsa` are the organization's audit public keys as Provenza lists them (`GET /api/v1/audit/keys`, standard base64); `--keys` takes a `{kid hex: base64url key}` JSON instead, as `GET /api/v1/agents/{id}/manifest` returns it. Obtain the keys from a source you trust independently of the manifest file. The `manifest verify` CLI of agent-manifest 0.15.0 takes a single Ed25519 key, so it cannot check both signers of a hybrid envelope; the script calls the SDK directly.
36+
37+
The script verifies the COSE signatures (`verify_cose_manifest`), recomputes the tool catalog root (`build_catalog_tree`) and prints the verification engine's verdict (`verify_manifest`). It exits 0 only when the verified signers include both an Ed25519 signer (algorithm -19, or -8) and an ML-DSA-65 signer (-49), the catalog root matches, and the verdict is `VALID` or `INCOMPLETE`.
38+
39+
The hybrid signature is the conjunction of the two. `COSE_Sign` signers do not cover each other, so an envelope stripped down to one of them still verifies against that key; the script refuses it, whichever half remains, and names the missing family in `missing_signers`. For the same reason it refuses the Ed25519-only `COSE_Sign1` that a Provenza server without ML-DSA-65 issues: such a manifest is not the hybrid one this listing describes.
40+
41+
## Reproduction
42+
43+
```bash
44+
python -m venv .venv && . .venv/bin/activate
45+
pip install agent-manifest==0.15.0 pytest
46+
python src/verify_provenza_manifest.py tests/agent-1-manifest.cose --keys tests/trusted_keys.json
47+
python -m pytest tests -q
48+
```
49+
50+
`tests/agent-1-manifest.cose` was issued by Provenza for an agent with one approved MCP tool (`files.read`); `tests/trusted_keys.json` holds the two public keys that signed it. Expected output: `signatures_verified: true`, `signers: 2`, `algorithms: [-49, -19]`, `hybrid: true`, `catalog_hash_matches: true`, `verdict: INCOMPLETE`, exit code 0. After 2027-01-31 the verdict is `EXPIRED` and the exit code 1. The tests fix the clock for the validity window, so they assert one exit code each, and they show that a changed payload, an unknown key and an envelope with only one of the two signers fail.
51+
52+
To issue one yourself: install Provenza ([self-hosting guide](https://github.com/kironovlaziz-del/provenza/blob/main/docs/self-hosting.md)), register an agent, approve an MCP server's tool for it, and press **Agent Manifest** on the agent's page.
53+
54+
## Source and licence
55+
56+
Provenza and this directory are Apache-2.0. The issuer is `backend/app/services/agent_manifest.py` in the Provenza repository.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Provenza
2+
vendor: Provenza
3+
integrates_with:
4+
- agent-manifest
5+
description: >-
6+
Issues a composition-only Agent Manifest v0.2 per governed agent, signed as a hybrid
7+
Ed25519 + ML-DSA-65 COSE_Sign, binding its approved MCP tool catalog and audit-log root.
8+
maintainer:
9+
github: kironovlaziz-del
10+
repository: https://github.com/kironovlaziz-del/provenza
11+
license: Apache-2.0
12+
tier: community
13+
marketplace:
14+
category: Identity & trust
15+
mark: PVZ
16+
keywords: [agent-governance, mcp, post-quantum, self-hosted, audit]
17+
tested_against:
18+
agent-manifest: "0.15.0"
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
"""Verify an Agent Manifest issued by Provenza, with the agent-manifest SDK.
2+
3+
Provenza issues a composition-only v0.2 manifest per agent, signed as a hybrid
4+
COSE_Sign (Ed25519 + ML-DSA-65) by the organization's audit key. This script
5+
checks, offline:
6+
7+
1. both COSE signatures, against keys you supply (verify_cose_manifest),
8+
and that both are there: the hybrid signature is the conjunction of an
9+
Ed25519 and an ML-DSA-65 signer, so an envelope that verifies with one
10+
of them alone is refused, whichever one remains;
11+
2. the tool catalog root, recomputed from the bound tools (build_catalog_tree);
12+
3. the SDK verification engine's verdict (verify_manifest). For a
13+
composition-only manifest the expected verdict is INCOMPLETE: the
14+
signature is authentic and the unbound artifacts are declared.
15+
16+
Keys: either a JSON object {kid hex: base64url public key} (--keys), or the
17+
organization's audit public keys as Provenza shows them, standard base64
18+
(--ed25519, --ml-dsa; GET /api/v1/audit/keys). Take them from a source you
19+
trust independently of the manifest file.
20+
21+
Exit code 0 when both signatures verify, the catalog root matches and the
22+
verdict is VALID or INCOMPLETE; 1 otherwise.
23+
"""
24+
25+
from __future__ import annotations
26+
27+
import argparse
28+
import base64
29+
import hashlib
30+
import json
31+
import sys
32+
from pathlib import Path
33+
from typing import Any
34+
35+
from agent_manifest import (
36+
OverallResult,
37+
RevocationStore,
38+
VerificationContext,
39+
verify_cose_manifest,
40+
verify_manifest,
41+
)
42+
from agent_manifest._merkle import build_catalog_tree
43+
from agent_manifest.models import ToolEntry
44+
45+
ACCEPTED = (OverallResult.VALID, OverallResult.INCOMPLETE)
46+
47+
# The signer families the hybrid signature consists of, by COSE algorithm.
48+
# -8 (EdDSA) and -19 (Ed25519) both identify Ed25519 (RFC 9864).
49+
REQUIRED_FAMILIES = {
50+
"ed25519": frozenset({-8, -19}),
51+
"ml-dsa-65": frozenset({-49}),
52+
}
53+
54+
55+
def missing_families(algorithms: list[int]) -> list[str]:
56+
"""The required signer families with no verified signature among
57+
``algorithms``."""
58+
return [name for name, algs in REQUIRED_FAMILIES.items() if not algs & set(algorithms)]
59+
60+
61+
def trusted_keys_from_b64(*keys: str | None) -> dict[str, str]:
62+
"""{kid hex: base64url key} from standard-base64 raw public keys. The COSE
63+
kid of each signer is SHA-256 of its raw public key."""
64+
out = {}
65+
for key in keys:
66+
if key:
67+
raw = base64.b64decode(key)
68+
out[hashlib.sha256(raw).hexdigest()] = base64.urlsafe_b64encode(raw).decode().rstrip("=")
69+
return out
70+
71+
72+
def check(envelope: bytes, trusted_keys: dict[str, str]) -> dict[str, Any]:
73+
"""Run the three checks; return a report (raises on a bad signature)."""
74+
cose = verify_cose_manifest(envelope, trusted_keys)
75+
manifest = cose.manifest
76+
report: dict[str, Any] = {
77+
"manifest_id": manifest["manifest_id"],
78+
"agent_id": manifest["agent_id"],
79+
"issuer": manifest["issuer"],
80+
"signatures_verified": bool(cose.verified),
81+
"signers": len(cose.signatures),
82+
"algorithms": sorted(s.algorithm for s in cose.signatures if s.verified),
83+
"profile": manifest.get("profile"),
84+
"unbound_artifacts": manifest.get("unbound_artifacts", []),
85+
}
86+
tm = manifest.get("artifacts", {}).get("tool_manifest")
87+
if tm is not None:
88+
root = build_catalog_tree([ToolEntry.model_validate(t) for t in tm["tools"]])
89+
report["tools"] = [t["tool_name"] for t in tm["tools"]]
90+
report["catalog_hash_matches"] = root == tm["catalog_hash"]
91+
result = verify_manifest(envelope, VerificationContext(trusted_keys=trusted_keys), RevocationStore())
92+
report["verdict"] = result.result.value
93+
report["missing_signers"] = missing_families(report["algorithms"])
94+
report["hybrid"] = report["signatures_verified"] and not report["missing_signers"]
95+
return report
96+
97+
98+
def main(argv: list[str] | None = None) -> int:
99+
p = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
100+
p.add_argument("manifest", help="the .cose file (Provenza: agent page -> Agent Manifest)")
101+
p.add_argument("--keys", help="JSON {kid hex: base64url public key}")
102+
p.add_argument("--ed25519", help="the audit key's Ed25519 public key, base64")
103+
p.add_argument("--ml-dsa", help="the audit key's ML-DSA-65 public key, base64")
104+
args = p.parse_args(argv)
105+
106+
keys = json.loads(Path(args.keys).read_text()) if args.keys else {}
107+
keys.update(trusted_keys_from_b64(args.ed25519, args.ml_dsa))
108+
if not keys:
109+
p.error("give the signing keys: --keys or --ed25519/--ml-dsa")
110+
111+
try:
112+
report = check(Path(args.manifest).read_bytes(), keys)
113+
except Exception as e: # a bad signature, an unknown key, a malformed envelope
114+
print(json.dumps({"error": type(e).__name__, "detail": str(e)}, indent=2))
115+
return 1
116+
print(json.dumps(report, indent=2))
117+
ok = report["hybrid"] and report.get("catalog_hash_matches", True) \
118+
and OverallResult(report["verdict"]) in ACCEPTED
119+
return 0 if ok else 1
120+
121+
122+
if __name__ == "__main__":
123+
sys.exit(main())
5.01 KB
Binary file not shown.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
"""The sample manifest was issued by Provenza (an MCP-served agent with one
2+
approved tool). The tests run offline against it."""
3+
4+
from __future__ import annotations
5+
6+
import json
7+
import sys
8+
from datetime import datetime, timezone
9+
from pathlib import Path
10+
11+
import agent_manifest._verify as sdk_verify
12+
import cbor2
13+
import pytest
14+
15+
SRC = Path(__file__).resolve().parents[1] / "src"
16+
sys.path.insert(0, str(SRC))
17+
18+
import verify_provenza_manifest as v # noqa: E402
19+
20+
HERE = Path(__file__).resolve().parent
21+
ENVELOPE = (HERE / "agent-1-manifest.cose").read_bytes()
22+
KEYS = json.loads((HERE / "trusted_keys.json").read_text())
23+
24+
# The sample's validity window: issued 2026-11-02T05:12:23Z, expires 2027-01-31T05:12:23Z.
25+
WITHIN = datetime(2026, 12, 1, tzinfo=timezone.utc)
26+
AFTER = datetime(2027, 2, 1, tzinfo=timezone.utc)
27+
28+
ED25519, ML_DSA_65 = -19, -49
29+
30+
31+
@pytest.fixture
32+
def clock(monkeypatch):
33+
"""Fix the time the SDK's verification engine checks the validity window
34+
against, so a test does not change meaning when the sample expires."""
35+
36+
def set_now(now: datetime) -> None:
37+
class Frozen(datetime):
38+
@classmethod
39+
def now(cls, tz=None):
40+
return now if tz is None else now.astimezone(tz)
41+
42+
monkeypatch.setattr(sdk_verify, "datetime", Frozen)
43+
44+
return set_now
45+
46+
47+
def _keeping(algorithm: int) -> bytes:
48+
"""The sample envelope with every signer but ``algorithm`` removed. The
49+
remaining signature is untouched and still verifies on its own: COSE_Sign
50+
signers do not cover each other."""
51+
tag = cbor2.loads(ENVELOPE)
52+
protected, unprotected, payload, signatures = tag.value
53+
kept = [s for s in signatures if cbor2.loads(s[0])[1] == algorithm]
54+
assert len(kept) == 1
55+
return cbor2.dumps(cbor2.CBORTag(tag.tag, [protected, unprotected, payload, kept]), canonical=True)
56+
57+
58+
def _run(tmp_path, envelope: bytes, capsys) -> tuple[int, dict]:
59+
path = tmp_path / "manifest.cose"
60+
path.write_bytes(envelope)
61+
keys = tmp_path / "keys.json"
62+
keys.write_text(json.dumps(KEYS))
63+
code = v.main([str(path), "--keys", str(keys)])
64+
return code, json.loads(capsys.readouterr().out)
65+
66+
67+
def test_signatures_catalog_and_profile():
68+
report = v.check(ENVELOPE, KEYS)
69+
assert report["signatures_verified"] and report["signers"] == 2
70+
assert report["algorithms"] == [ML_DSA_65, ED25519] and report["hybrid"] is True
71+
assert report["missing_signers"] == []
72+
assert report["catalog_hash_matches"] and report["tools"] == ["files.read"]
73+
assert report["profile"] == "composition-only"
74+
assert "system_prompt" in report["unbound_artifacts"] and "policy_bundle" in report["unbound_artifacts"]
75+
76+
77+
def test_verdict_is_incomplete_not_valid(clock):
78+
# a composition-only manifest authenticates; it never claims to be complete
79+
clock(WITHIN)
80+
assert v.check(ENVELOPE, KEYS)["verdict"] == "INCOMPLETE"
81+
82+
83+
@pytest.mark.parametrize("kept, missing", [(ED25519, "ml-dsa-65"), (ML_DSA_65, "ed25519")])
84+
def test_one_signer_is_not_the_hybrid_signature(tmp_path, capsys, clock, kept, missing):
85+
# The remaining signature verifies against the supplied key and the verdict
86+
# is unchanged; the envelope is still refused, whichever half is left.
87+
clock(WITHIN)
88+
code, report = _run(tmp_path, _keeping(kept), capsys)
89+
assert report["signatures_verified"] is True and report["signers"] == 1
90+
assert report["algorithms"] == [kept] and report["verdict"] == "INCOMPLETE"
91+
assert report["hybrid"] is False and report["missing_signers"] == [missing]
92+
assert code == 1
93+
94+
95+
def test_a_changed_payload_fails():
96+
tag = cbor2.loads(ENVELOPE)
97+
parts = list(tag.value)
98+
parts[2] = parts[2].replace(b"files.read", b"files.rm!!")
99+
forged = cbor2.dumps(cbor2.CBORTag(tag.tag, parts), canonical=True)
100+
with pytest.raises(Exception):
101+
v.check(forged, KEYS)
102+
103+
104+
def test_unknown_keys_fail():
105+
with pytest.raises(Exception):
106+
v.check(ENVELOPE, {"00" * 32: "AAAA"})
107+
108+
109+
def test_cli_succeeds_within_the_validity_window(tmp_path, capsys, clock):
110+
clock(WITHIN)
111+
code, report = _run(tmp_path, ENVELOPE, capsys)
112+
assert report["hybrid"] is True and report["verdict"] == "INCOMPLETE"
113+
assert code == 0
114+
115+
116+
def test_cli_fails_once_expired(tmp_path, capsys, clock):
117+
clock(AFTER)
118+
code, report = _run(tmp_path, ENVELOPE, capsys)
119+
assert report["hybrid"] is True and report["verdict"] == "EXPIRED"
120+
assert code == 1

0 commit comments

Comments
 (0)