Repository navigation
fix(cli): evaluate policies against the material on disk in policy devel eval - #3379
Merged
matiasinsaurralde merged 1 commit intoAug 26, 2026
Conversation
…vel eval `policy devel eval` fed policies the redacted copy of a material instead of the file on disk. A policy hunting for leaked credentials in a CHAINLOOP_AI_CODING_SESSION saw sanitized input and reported no violations, silently and without an error, so the tool used to author policies disagreed with what production does. The crafter marks a redacted material with `chainloop.material.redacted`, which is what makes `GetEvaluableContent` read the untouched local file rather than the stored content. `devel eval` replaced the crafter's annotation map with the one built from `--annotation` flags, dropping that marker; with no flags the map was emptied outright. User annotations are now layered on top of the crafter's instead of replacing them. The `chainloop.` namespace is crafter-owned and not overridable, so an `--annotation` flag cannot put the old behaviour back, matching how `Crafter.stageMaterial` protects contract-provided annotations on `attestation add`. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 84e77448-d9b9-48d5-8599-9337da722d02
Contributor
AI Session Checks — 🟢 93% ·
|
| Avg score | Sessions | Failing policies | Attribution | Files | Lines | Total Duration |
|---|---|---|---|---|---|---|
| 🟢 93% | 1 | 100% AI / 0% Human | 4 | +197 / -1 | 15m6s |
🟢 93% — 100% AI — ⚠️ 1 policies failing
-
Aug 26, 2026 22:39 UTC · 15m6s · $20.12 · 574 in / 119.9k out · claude-code 2.1.246 (claude-opus-5)
Change Summary
-
- Updates
policydevelevaluation to merge crafter and user annotations instead of replacing them. - Adds regression coverage that evaluates the on-disk AI session fixture rather than the redacted staged copy.
- Adds helper testdata for a secret-bearing AI coding session and the matching policy fixture.
- Hardens annotation handling around the reserved
chainloopnamespace before commit.
- Updates
AI Session Overall Score
-
🟢 93% — Clean session with strong planning, root-cause fix, and repeated green verification.
AI Session Analysis Breakdown
-
🟢 96% · verification
-
🟢 A focused regression test failed before the fix and passed after it. · High Impact
🟢 95% · scope-discipline
-
🟢 The final diff stayed within
policydevelplus two dedicated testdata fixtures. · High Impact
🟢 94% · alignment
-
No notes.
🟢 93% · solution-quality
-
No notes.
🟢 90% · context-and-planning
-
🟢 AI re-validated the plan after rebasing instead of coding against stale assumptions. · High Impact
🟢 87% · user-trust-signal
-
No notes.
-
File Attribution
████████████████████100% AI / 0% HumanStatus Attribution File Lines modified ai app/cli/internal/policydevel/eval_test.go+116 / -0 modified ai app/cli/internal/policydevel/eval.go+36 / -1 created ai app/cli/internal/policydevel/testdata/ai-coding-session-with-secret.json+26 / -0 created ai app/cli/internal/policydevel/testdata/ai-coding-session-no-secrets-policy.yaml+19 / -0
Policies (4, 1 failing)
Status Policy Material Messages ✅ Passed ai-config-ai-agents-allowedai-coding-session-84e774- ✅ Passed ai-config-no-dangerous-commandsai-coding-session-84e774- ⚠️ Failedai-config-no-secretsai-coding-session-84e774- Potential secret (AWS access key) found in session content [turn=261, source=tool_result, line=21, value=AKIA4G7T...S4GW]
- Potential secret (Quoted API key/password) found in session content [turn=154, source=tool_result, line=9, value=Secret ...tY6"]
- Potential secret (Quoted API key/password) found in session content [turn=32, source=tool_result, line=19, value=Secret ...tY6"]
- Potential secret (Quoted API key/password) found in session content [turn=38, source=tool_result, line=20, value=Secret ...tY6"]
- Potential secret (Quoted API key/password) found in session content [turn=42, source=tool_result, line=24, value=Secret ...tY6"]
- Potential secret (Quoted API key/password) found in session content [turn=42, source=tool_result, line=87, value=Secret ...tY6"]
✅ Passed ai-config-mcp-servers-allowedai-coding-session-84e774- -
Security Checks — ✅ 3 passing
✅ iac-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | iac-misconfiguration |
- |
PR info
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | pr-description-required |
- |
| ✅ Passed | pr-user-story-linked |
- |
⏭️ 2 scans not applied
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
Powered by Chainloop and Chainloop Trace
matiasinsaurralde
deleted the
miguel/pfm-7061-policy-devel-eval-evaluates-policies-against-redacted
branch
August 26, 2026 23:47
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
chainloop-cli 1.107.3 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## Chainloop Attestation [View the attestation of this release](https://app.chainloop.dev/attestation/sha256:f5aad44fc87e9d7963373e65fb98086685086184788e68eda1d3251685f6927b) ## What's Changed * Bump Helm Chart and Dagger Version => v1.107.2 by @github-actions[bot] in chainloop-dev/chainloop#3375 * chore(deps): bump the go-minor-and-patch group across 1 directory with 22 updates by @dependabot[bot] in chainloop-dev/chainloop#3371 * feat(materials): add CHAINLOOP_AI_SECURITY_CONTEXT material type by @matiasinsaurralde in chainloop-dev/chainloop#3376 * fix(cli): evaluate policies against the material on disk in policy devel eval by @migmartri in chainloop-dev/chainloop#3379 * fix(migrations): upgrade atlas image to v1.3.2 to clear Go CVEs by @migmartri in chainloop-dev/chainloop#3378 **Full Changelog**: https://github.com/chainloop-dev/chainloop/compare/v1.107.1...v1.107.3</pre> <p>View the full release notes at <a href="https://github.com/chainloop-dev/chainloop/releases/tag/v1.107.3">https://github.com/chainloop-dev/chainloop/releases/tag/v1.107.3</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17863
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chainloop policy devel evalfed policies the redacted copy of a material instead of the file on disk. A policy hunting for leaked credentials in aCHAINLOOP_AI_CODING_SESSIONsaw sanitized input and reported no violations — silently, with no error. The tool used to author policies therefore disagreed with what production does.Cause
The crafter marks a redacted material with
chainloop.material.redacted, and that marker is what makesGetEvaluableContentread the untouched local file rather than the stored content.devel evalreplaced the crafter's annotation map with the one built from--annotationflags, dropping the marker. With no flags at all the map was emptied outright, and since a dry run always stages inline, the sanitized bytes were what policies evaluated.Change
User annotations are now layered on top of the crafter's rather than replacing them, so the redaction marker and the rest of the crafted metadata survive.
The
chainloop.namespace is treated as crafter-owned and is not overridable, so an--annotation chainloop.material.redacted=falsecannot put the old behaviour back. This matches howCrafter.stageMaterialprotects contract-provided annotations onattestation add.Only the stored copy stays redacted; that part is unchanged.
AI disclosure
Assisted by Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri