Skip to content

feat(materials): add TruffleHog and Cobertura material types#3285

Merged
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6660-6661-material-types
Jul 14, 2026
Merged

feat(materials): add TruffleHog and Cobertura material types#3285
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6660-6661-material-types

Conversation

@javirln

@javirln javirln commented Jul 14, 2026

Copy link
Copy Markdown
Member

What

Add two native material types to the attestation crafter so their evidence can be attested and policy-evaluated:

  • TRUFFLEHOG_JSON — TruffleHog secret-scan output (JSONL). Projected to policy input as a findings list so secret-detection policies can evaluate it. A clean scan (no secrets, zero-byte output) is crafted as a canonical empty report, so a passing scan stays attestable and projects to an empty findings list.
  • COBERTURA_XML — Cobertura code-coverage reports. Projected to policy input; a non-finite line-rate (an empty report's 0/0) is serialized as null so an empty report stays evaluable and remains distinguishable from genuine 0% coverage.

Both follow the existing crafter pattern: proto enum, crafter and parser, dispatch in Craft, policy-input projection in ingestMaterialToJSON, and auto-detection ordering (Cobertura only; TruffleHog is intentionally excluded from auto-detection since JSONL validation is weak).

AI disclosure

AI assisted in producing this contribution (Claude Code). Each commit carries an Assisted-by: Claude Code trailer.

Review in cubic

@chainloop-platform

Copy link
Copy Markdown
Contributor

AI Session Analysis

Missing AI Coding Sessions

We detected commits in this PR that were AI-assisted, but the matching Chainloop Trace session(s) could not be found in Chainloop.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.


Powered by Chainloop and Chainloop Trace

@javirln javirln requested a review from a team July 14, 2026 13:53

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 38 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/materials/trufflehog.go">

<violation number="1" location="pkg/attestation/crafter/materials/trufflehog.go:56">
P1: A report beginning with `[]` can hide appended findings because the array parser ignores remaining bytes. The crafter then accepts and attests it as zero findings, so policy evaluation misses those findings; have `Parse` reject non-whitespace content after the array.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread pkg/attestation/crafter/materials/trufflehog.go
Add native support for two evidence material types so they can be
attested and policy-evaluated:

- TRUFFLEHOG_JSON: TruffleHog secret-scan output (JSONL), projected to
  policy input as findings so secret-detection policies can evaluate it.
  A clean scan (no secrets, zero-byte output) is crafted as a canonical
  empty report so a passing scan stays attestable and projects to an
  empty findings list.
- COBERTURA_XML: Cobertura code-coverage reports, projected to policy
  input. A non-finite line-rate (an empty report's 0/0) is serialized as
  null so an empty report stays evaluable and remains distinguishable
  from genuine 0% coverage.

Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>

Chainloop-Trace-Sessions: 1abd9936-0822-465f-ac3b-2694450852b7
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln force-pushed the javier/pfm-6660-6661-material-types branch from b965a78 to 8ca737a Compare July 14, 2026 15:12
@javirln javirln enabled auto-merge (squash) July 14, 2026 15:20

@matiasinsaurralde matiasinsaurralde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@javirln javirln merged commit 90f5c1f into chainloop-dev:main Jul 14, 2026
14 of 15 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.

2 participants