Repository navigation
Conversation
…gentrust-io#483) Add the optional top-level manifest {id, digest, media_type} object to schema/trace-claim-v0.3-draft.json per the reference-only ruling on agentrust-io#483, preserve properties.manifest in scripts/gen_v03_draft_schema.py, and validate the agentrust-io#487 fixtures and malformed manifest shapes in tests/test_v03_draft_schema.py. Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
imran-siddique
left a comment
There was a problem hiding this comment.
Approving 75b5fbb. gen_v03_draft_schema.py --check passes and test_v03_draft_schema.py runs 27 of 27. I broke seven constraints in the manifest block one at a time (type on id, minLength on media_type, the digest pattern twice, additionalProperties, required, the whole member) and a targeted test failed for each. The shape matches the reference-only ruling on #483 and agent-manifest §6.3.2 as merged in 3c02529.
Two follow-ups, not blocking. §6.3.2 names the digest as sha256 only, and ManifestRef in trace-token-experimental-v1.json still requires version; #483 asked for one shape. Please change "Fixes: #483" to "Refs": no conformance module reads the reference yet.
| }, | ||
| "digest": { | ||
| "type": "string", | ||
| "pattern": "^sha(256:[0-9a-f]{64}|384:[0-9a-f]{96})$", |
There was a problem hiding this comment.
sha384 is accepted here, while agent-manifest §6.3.2 says sha256:<64-hex-chars>. Fine for TRACE, but a sha384 reference will not satisfy a §6.3.2 verifier. Worth a sentence in the description.
What this changes
Refs #483
Contributor: Raghuvar Durga (@drk-ram)
Adds the optional top-level
manifestobject ({id, digest, media_type}) toschema/trace-claim-v0.3-draft.jsonper the reference-only ruling on #483 and updatesscripts/gen_v03_draft_schema.pyto preserveproperties.manifestalongsideproperties.eat_profileandproperties.runtime.properties.evidence:schema/trace-claim-v0.3-draft.json:manifestobject with"required": ["id", "digest", "media_type"]and"additionalProperties": false:id:{"type": "string", "minLength": 1}digest:{"type": "string", "pattern": "^sha(256:[0-9a-f]{64}|384:[0-9a-f]{96})$"}, matching the digest pattern acrossschema/trace-claim.jsonand serving as the target ofruntime.evidence.binds: "manifest-digest"media_type:{"type": "string", "minLength": 1}manifest_verification_resultout of the schema per v0.3: let a record name the agent manifest it ran under #483 andagentrust-io/agent-manifest#498(reference-only: a producer-asserted verification result is not carried in the record).scripts/gen_v03_draft_schema.py:_copy_member()sobuild(canonical, draft)preserves bothproperties.runtime.properties.evidenceandproperties.manifestat their declared positions inschema/trace-claim-v0.3-draft.json.tests/test_v03_draft_schema.py:test_draft_differs_from_canonical_only_in_its_declared_membersto stripproperties.manifest.01,02,04,05, and06fromconformance/tests/vectors/manifest-ref-v0.3-draft/(conformance: v0.3 draft fixtures for the manifest reference (#483) #487) validate againstschema/trace-claim-v0.3-draft.jsonunder the v0.3 profile whileschema/trace-claim.jsoncontinues to rejectmanifeston v0.2 records.03-mismatch-with-asserted-result.jsonis rejected byschema/trace-claim-v0.3-draft.jsononmanifest_verification_resultand validates oncemanifest_verification_resultis removed.manifest(type: "object", requiredid/digest/media_type,type: "string",minLength: 1,sha256/sha384lowercase hex digest patterns, andadditionalProperties: false).Cold-reader review:
A separate
code-reviewagent inspected the initial diff against #483,conformance/tests/vectors/manifest-ref-v0.3-draft/, andCONTRIBUTING.mdand found four items that we updated before opening this PR:test_draft_rejects_malformed_manifestinitially omitted non-string test cases forid,digest, andmedia_type; because JSON SchemaminLengthandpatternignore non-strings, removing"type": "string"from any of those three properties would not have failed the test. Addednon-string-id,non-string-digest, andnon-string-media-typecases.test_draft_rejects_malformed_manifesttestedsha384:positively (test_draft_accepts_sha384_manifest_digest) but only tested negative digest patterns onsha256:andsha512:. Addedsha384-uppercaseandsha384-wrong-lengthcases so weakening the384:[0-9a-f]{96}alternation branch fails the test.test_draft_accepts_manifest_reference_fixturesandtest_draft_rejects_malformed_manifest, tightened assertions to verify that06-control-no-manifest.jsonpassescanonical(schema/trace-claim.json), thatcanonicalerrors on01/02/04/05specifically namemanifest, and thatdrafterrors on malformedmanifestinputs occur atabsolute_path[:1] == ["manifest"], with explicitpytest.param(..., id=...)names.manifest.properties.digest.descriptionwithmanifest.descriptionandmanifest.properties.id.description("the manifest bytes this execution ran under").Type of change
Spec section
None in
spec/trace-v0.2.md. Targetsschema/trace-claim-v0.3-draft.jsonfor #483 alongside the #487 draft fixtures inconformance/tests/vectors/manifest-ref-v0.3-draft/.Tests for a fix
Each constraint in
schema/trace-claim-v0.3-draft.jsonunderproperties.manifest(and the top-level refusal ofmanifest_verification_result) has a corresponding test intests/test_v03_draft_schema.pythat fails when switched off:manifest {id, digest, media_type}on v0.3 records (fails ifproperties.manifestis removed):tests/test_v03_draft_schema.py::test_draft_accepts_manifest_reference_fixtures[01-digest-matches.json]tests/test_v03_draft_schema.py::test_draft_accepts_manifest_reference_fixtures[02-digest-mismatch.json]tests/test_v03_draft_schema.py::test_draft_accepts_manifest_reference_fixtures[04-unresolvable.json]tests/test_v03_draft_schema.py::test_draft_accepts_manifest_reference_fixtures[05-added-after-signing.json]tests/test_v03_draft_schema.py::test_draft_accepts_sha384_manifest_digestmanifest_verification_resulton v0.3 records:tests/test_v03_draft_schema.py::test_draft_rejects_asserted_manifest_verification_resultmanifestvalues (each fails if the corresponding constraint inproperties.manifestis switched off):manifest.type: "object":tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[non-object]manifest.required(id):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[missing-id]manifest.required(digest):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[missing-digest]manifest.required(media_type):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[missing-media-type]manifest.properties.id.type: "string":tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[non-string-id]manifest.properties.digest.type: "string":tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[non-string-digest]manifest.properties.media_type.type: "string":tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[non-string-media-type]manifest.properties.id.minLength: 1:tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[empty-id]manifest.properties.media_type.minLength: 1:tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[empty-media-type]manifest.properties.digest.pattern(sha256lowercase hex and 64-char length):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[sha256-uppercase],tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[sha256-wrong-length]manifest.properties.digest.pattern(sha384lowercase hex and 96-char length):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[sha384-uppercase],tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[sha384-wrong-length]manifest.properties.digest.pattern(supported algorithm prefix):tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[unsupported-digest-algorithm]manifest.additionalProperties: false:tests/test_v03_draft_schema.py::test_draft_rejects_malformed_manifest[unexpected-property]Validation commands run:
python scripts/gen_v03_draft_schema.py --check-> passed (exit 0)pytest tests/test_v03_draft_schema.py tests/test_runtime_evidence_vectors.py tests/test_safe_integer_range.py -v-> passed (182 passed)pytest conformance/tests -q --no-cov-> passed (778 passed, 5 xpassed)ruff check src tests scripts-> passed (All checks passed!)python tools/check_dashes.py-> passed (no dashes outside examples/, spec/trace-v0.1.md)mypy src/agentrust_trace-> passed (Success: no issues found in 15 source files)Checklist
git commit -s)CHANGELOG.mdupdated (for any normative change)<!-- CHANGED: #NNN: description -->in spec textRefs: #483