feat: redact runner environment variables by organization setting

Merged
MI
13d ago
+2456-359

Adds an organization setting that redacts runner environment variables in new attestations, with its design spec and implementation plan.

Summary

Each attestation stores the environment variables that the CLI finds in the CI runner. Some of these variables identify a person, for example the user who started the pipeline. The new setting replaces the values of those variables with [REDACTED] and keeps the names. It has three modes:

  • none (default): no redaction.
  • known-identity: the variables that each runner integration marks as identity: BUILD_REQUESTEDFOR, BUILD_REQUESTEDFOREMAIL, GITHUB_ACTOR, GITLAB_USER_EMAIL, GITLAB_USER_LOGIN, HOME, USER.
  • custom: an explicit list of variable names.

Changes

  • Runner integrations mark their identity variables next to the existing Optional flag. The known identity list is the union of these marks (R-004, D-001).
  • chainloop org update --env-var-redaction none|known-identity|custom and the repeatable --redacted-env-var NAME set the mode (R-001). The help text lists the known identity variables, and org describe shows the setting.
  • The control plane resolves the names and sends them in the attestation init response (D-003). The CLI redacts the runner variables and the env allow list of the contract before it writes the attestation state. Thus a contract cannot show a redacted value (R-002, R-005, R-006).
  • At push, the control plane rejects an attestation that has a clear value for a redacted variable. It runs this check before it stores the attestation, also when the bundle goes to a CAS backend. The error names the variables and tells the user to update the CLI (R-003, D-002).

Spec: docs/specs/issue-3841-runner-env-var-redaction.md. Plan: docs/plans/issue-3841-runner-env-var-redaction.md.

The commit author and the pull request logins are out of scope and tracked in #3842.

We would like two reviewers to approve this spec before it merges.

AI assistance: Claude Code helped write the spec, the plan and the implementation.

Closes #3841

šŸ¤– Posted by Maximus bot (Claude Code) on behalf of @migmartri