Skip to content

Conversation

@javirln
Copy link
Member

@javirln javirln commented Oct 30, 2025

This PR extends the Evidence crafter to automatically parse JSON evidence files and extract structured metadata as material annotations. This matches with the custom policies documentation which recommends JSON format for evidence materials.

Changes

  • Modified evidence.go: Extended the Craft method to intelligently parse evidence files and extract metadata when they follow a specific JSON structure
  • Added tryExtractAnnotations helper: Attempts to parse evidence as JSON and extracts id and schema fields as annotations
  • Defined customEvidence struct: Represents the expected structure with id, schema (optional), and data fields
  • Added annotation constants:
    • chainloop.material.evidence.id - Evidence identifier
    • chainloop.material.evidence.schema - Schema reference URL

Example from an attestation

{
  "annotations": {
    "chainloop.material.cas": true,
    "chainloop.material.evidence.id": "my-awesome-report-id",
    "chainloop.material.name": "material-1761835944639691000",
    "chainloop.material.type": "EVIDENCE"
  },
  "digest": {
    "sha256": "337199c3efb1cf6a579b6f035597ad9a16a178a42a962eb1c32f5f28ce6f770e"
  },
  "name": "report.json"
}

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln self-assigned this Oct 30, 2025
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln merged commit 7b6fbd4 into chainloop-dev:main Oct 31, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants