Skip to content

feat: redact personal data with an organization PII redaction setting - #3884

Open
migmartri wants to merge 4 commits into
chainloop-dev:mainfrom
migmartri:issue-3842-spec-scm-identity-redaction
Open

migmartri wants to merge 4 commits into
chainloop-dev:mainfrom
migmartri:issue-3842-spec-scm-identity-redaction

Conversation

@migmartri

@migmartri migmartri commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Adds a PII redaction organization setting, and the spec and plan that describe it.

Summary

The env var redaction setting of #3841 hides the runner environment variables that identify a person. Attestations also store the name and email of the head commit author, and the logins of the PR/MR author and reviewers. This PR replaces the known identity mode of env var redaction with one on/off PII redaction setting that covers all of them.

  • chainloop org update --pii-redaction=true turns it on, and org describe shows it.
  • With the setting on, the CLI stores [REDACTED] for the known identity env vars, the commit author (after the platform verifies the commit), and the PR/MR author and reviewer logins. The PR info material keeps its other fields and the form of its schema, and gets a redaction marker annotation.
  • The custom env var list now adds to PII redaction instead of replacing the known identity list.
  • Migration: organizations with the known identity mode get PII redaction on and no custom list. An update with the known identity mode, from an older CLI, turns PII redaction on.
  • At push, the control plane rejects a clear commit author and a PR info material without the marker, next to the existing env var check.

Spec: docs/specs/issue-3842-pii-redaction.md (R-001 to R-006). It supersedes R-001 and R-005 of docs/specs/issue-3841-runner-env-var-redaction.md.
Plan: docs/plans/issue-3842-pii-redaction.md.

Decisions to challenge

D-001 (one PII setting replaces the known identity mode), D-002 (a marker annotation, not a CAS read at push), D-003 ([REDACTED], not a pseudonym), and D-004 (known identity organizations move to PII redaction on, so pipelines with an older CLI in those organizations fail at push after the upgrade).

We would like two reviewers to approve the spec.

Closes #3842

This contribution was written with AI assistance (Claude Code).

Add the design spec and the implementation plan for redacting the head
commit author and the PR/MR author and reviewer logins in new
attestations, behind an organization setting enforced at push.

Refs chainloop-dev#3842

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: aea68fca-750b-4640-b6a9-3a04fb5c8585
@migmartri migmartri added the spec Design spec label Dec 4, 2026
@chainloop-platform

chainloop-platform Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 1 failing

Status Policy Material Messages
⚠️ Failed pr-min-approvals pr-info PR/MR #3884 has 0 approving reviews, 1 required.
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟡 60% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟡 60% 1 ✅ 0 99% AI / 1% Human 37 +1009 / -53 38h12m58s

🟡 60% — 99% AI — ✅ All policies passing

Dec 3, 2026 11:01 UTC · 38h12m58s · $54.70 · 1.3k in / 558.6k out · claude-code 2.1.335 (claude-opus-5-5)

View session details ↗

Change Summary

Adds an organization PII redaction toggle for known identity variables, commit authors, and PR/MR identities, alongside additive custom environment redaction. Adds legacy-setting migration and push enforcement, and updates the spec, implementation plan, generated interfaces, and tests.

AI Session Overall Score

🟡 60% — Implementation expanded beyond the design revision request; live acceptance checks remain unverified.

AI Session Analysis Breakdown

🟢 90% · context-and-planning

🟢 Before drafting, the AI researched commit and PR data paths and proposed a milestone with named surfaces. · High Impact

🟢 90% · user-trust-signal

No notes.

🟢 88% · solution-quality

🟢 Raw-field rewriting preserves unrelated PR data, while parsing errors propagate instead of being swallowed. · High Impact

🟡 72% · alignment

🟠 The report claimed validation after every edit round while admitting the last plan fix was not reviewed. · Medium Severity

💡 Distinguish completed validation from edits made after the final review.

🟡 70% · verification

🟢 Organization and push integration tests passed after correcting a test-name filter that previously selected no tests. · High Impact

🟠 Fixture-based PR tests passed; real pull-request acceptance and existing-organization upgrade exercises were not demonstrated. · Medium Severity

💡 Exercise a real pull request and an existing known-identity organization before release.

🟡 The engaged user never explicitly confirmed runtime behavior; the final test command has no captured result. · Low Severity

🔴 35% · scope-discipline

🔴 AI originated full implementation after the user requested updating the spec and plan, materially expanding the PR. · High Severity

💡 Keep design revisions separate from implementation until the user authorizes building the feature.


File Attribution

███████████████████░ 99% AI / 1% Human

Status Attribution File Lines
created ai app/controlplane/pkg/biz/redaction_test.go +193 / -0
created ai pkg/prinfo/redact.go +134 / -0
created ai pkg/prinfo/redact_test.go +81 / -0
modified ai pkg/attestation/crafter/crafter_test.go +73 / -0
modified ai app/controlplane/pkg/biz/workflowrun.go +64 / -7
modified ai app/controlplane/pkg/biz/organization_integration_test.go +51 / -17
renamed ai docs/specs/issue-3842-pii-redaction.md +57 / -0
renamed ai docs/plans/issue-3842-pii-redaction.md +56 / -0
modified ai pkg/attestation/renderer/chainloop/chainloop.go +51 / -3
modified ai pkg/attestation/crafter/materials/chainloop_pr_info_test.go +51 / -0
modified ai pkg/attestation/crafter/materials/chainloop_pr_info.go +35 / -6
modified ai app/controlplane/pkg/biz/organization.go +38 / -0
modified ai app/controlplane/pkg/biz/workflowrun_contract_integration_test.go +18 / -8
modified ai pkg/attestation/crafter/crafter.go +24 / -0
modified ai app/cli/cmd/organization_update.go +10 / -3
modified ai app/cli/cmd/organization_describe.go +9 / -0
modified ai app/controlplane/api/controlplane/v1/response_messages.proto +6 / -2
modified ai pkg/attestation/envredaction/envredaction.go +7 / -1
modified ai app/controlplane/api/controlplane/v1/organization.proto +5 / -0
modified ai pkg/attestation/crafter/api/attestation/v1/crafting_state.go +5 / -0
modified ai pkg/attestation/crafter/materials/materials.go +4 / -1
created ai app/controlplane/pkg/data/ent/migrate/migrations/20261205004604.sql +4 / -0
modified ai pkg/attestation/crafter/api/attestation/v1/crafting_state.proto +4 / -0
modified ai pkg/attestation/renderer/chainloop/v02.go +2 / -2
modified ai app/cli/documentation/cli-reference.md +2 / -1

…and 12 more file(s).


Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-aea68f -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-aea68f -
✅ Passed ai-config-no-secrets ai-coding-session-aea68f -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-aea68f -

Security Checks — ⚠️ 1 failing

⚠️ AI Security Analysis

The per-PR audit did not finish: 58 concerns went unreviewed (spend ceiling or time). No introduced risk was found in what it reviewed, but treat this as incomplete, not clean.

View in Chainloop ↗ · How this works ↗

✅ Secret Scan

Status Policy Messages
✅ Passed secrets-detection -

✅ SAST Scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -

✅ IaC Scan

Status Policy Messages
✅ Passed iac-misconfiguration -
Scans not applied (2)
Scan Reason
Vulnerability Scan no manifest/lockfile changed
GitHub Actions Scan no workflow files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/specs/issue-3842-scm-identity-redaction.md">

<violation number="1" location="docs/specs/issue-3842-scm-identity-redaction.md:120">
P1: The marker is client-controlled, so the control plane accepts unredacted PR logins when a client adds it; the plan explicitly documents this bypass. Validate the material at push, or narrow this guarantee to detecting older clients rather than enforcing redaction.</violation>
</file>

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

View guided diff | Re-trigger cubic

- Source: drafting

### D-002: The control plane checks a redaction marker on the PR info material
The CLI adds a marker to each PR info material that it redacted. At push, the control plane rejects a PR info material without the marker. It does not read the content of the material.

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.

P1: The marker is client-controlled, so the control plane accepts unredacted PR logins when a client adds it; the plan explicitly documents this bypass. Validate the material at push, or narrow this guarantee to detecting older clients rather than enforcing redaction.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/specs/issue-3842-scm-identity-redaction.md, line 120:

<comment>The marker is client-controlled, so the control plane accepts unredacted PR logins when a client adds it; the plan explicitly documents this bypass. Validate the material at push, or narrow this guarantee to detecting older clients rather than enforcing redaction.</comment>

<file context>
@@ -0,0 +1,144 @@
+- Source: drafting
+
+### D-002: The control plane checks a redaction marker on the PR info material
+The CLI adds a marker to each PR info material that it redacted. At push, the control plane rejects a PR info material without the marker. It does not read the content of the material.
+- Why: with a CAS backend that is not inline, the control plane sees only the digest of the material. The marker catches an older CLI, which is the threat of #3841, with no CAS read at push. A modified client can add a false marker, but such a client can also forge other data that the control plane does not check.
+- Alternatives considered:
</file context>

Add a PII redaction organization setting. When it is on, new attestations
store [REDACTED] for the known identity env vars, the head commit author,
and the PR/MR author and reviewer logins. The control plane rejects a push
that does not obey it.

The known identity mode of env var redaction is replaced by this setting:
the custom env var list now adds to PII redaction, an update with the known
identity mode turns PII redaction on, and a migration moves the
organizations that use it.

Implements R-001 to R-006 of docs/specs/issue-3842-pii-redaction.md, which
supersedes R-001 and R-005 of the issue-3841 spec.

Refs chainloop-dev#3842

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: aea68fca-750b-4640-b6a9-3a04fb5c8585
@migmartri migmartri changed the title spec: issue-3842 Redaction of source control identities feat: redact personal data with an organization PII redaction setting Dec 5, 2026

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 60 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/specs/issue-3842-pii-redaction.md">

<violation number="1" location="docs/specs/issue-3842-pii-redaction.md:149">
P2: D-004 assumes the known identity admins wanted commit-author and PR/MR redaction. The migration turns that on automatically and makes older-CLI pipelines fail at push on upgrade. The spec should justify this for those admins, or offer an opt-out or a staged rollout before the migration goes ahead.</violation>
</file>

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

View guided diff | Re-trigger cubic

- A stable hash for each identity: policies can still compare people, for example "the approver is not the author". But a reader can reverse the hash from the list of public logins.
- Source: drafting

### D-004: Organizations with the known identity mode move to PII redaction on

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.

P2: D-004 assumes the known identity admins wanted commit-author and PR/MR redaction. The migration turns that on automatically and makes older-CLI pipelines fail at push on upgrade. The spec should justify this for those admins, or offer an opt-out or a staged rollout before the migration goes ahead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/specs/issue-3842-pii-redaction.md, line 149:

<comment>D-004 assumes the known identity admins wanted commit-author and PR/MR redaction. The migration turns that on automatically and makes older-CLI pipelines fail at push on upgrade. The spec should justify this for those admins, or offer an opt-out or a staged rollout before the migration goes ahead.</comment>

<file context>
@@ -126,11 +141,18 @@ The CLI adds a marker to each PR info material that it redacted. At push, the co
   - A stable hash for each identity: policies can still compare people, for example "the approver is not the author". But a reader can reverse the hash from the list of public logins.
 - Source: drafting
 
+### D-004: Organizations with the known identity mode move to PII redaction on
+The migration turns on PII redaction for each organization with the known identity mode. Thus these organizations also get commit and PR/MR redaction, and its push check.
+- Why: the admin of such an organization turned on redaction to hide personal data. The known identity mode no longer exists, and PII redaction is its replacement.
</file context>

Comment thread pkg/prinfo/redact.go Resolved
- The push check reads the author of every git.head subject, and treats an
  author value that is not a string as data.
- The PR info redaction matches keys in any letter case, as the validation
  before it does.
- RedactedEnvVars no longer sorts the stored custom list in place.

Refs chainloop-dev#3842

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: aea68fca-750b-4640-b6a9-3a04fb5c8585

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files (changes from recent commits).

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

View guided diff | Re-trigger cubic

Comment thread pkg/prinfo/redact.go Resolved
The schema requires the login field, so the redacted PR info stays valid.

Refs chainloop-dev#3842

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: aea68fca-750b-4640-b6a9-3a04fb5c8585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spec Design spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: redact commit author and PR identities in attestations

1 participant