Skip to content

Strip live credentials from presubmit jobs - #1225

Merged
cert-manager-prow[bot] merged 8 commits into
masterfrom
security-presubmit-credentials
Aug 12, 2026
Merged

Strip live credentials from presubmit jobs#1225
cert-manager-prow[bot] merged 8 commits into
masterfrom
security-presubmit-credentials

Conversation

@wallrj

@wallrj wallrj commented Aug 12, 2026

Copy link
Copy Markdown
Member

Presubmits run unreviewed pull-request code, so they should never mount live credentials. This hardens the Prow config so that only periodics and postsubmits (which run merged, reviewed code) carry credential presets.

Changes

  • Strip credential presets at the choke point. addPresubmit() in config/prowgen/pkg/context.go now deletes the preset-venafi-* presets from every presubmit it registers. That is the single point through which every presubmit passes, so a future generator that re-adds a credential label to a presubmit cannot reintroduce the problem. New unit tests in context_test.go assert presubmits are stripped while periodics retain their credentials.
  • Remove the per-issuer Venafi presubmits. The pull-*-issuers-venafi-{tpp,cloud,ngts} jobs were optional, /test-only presubmits that never ran by default; with the presets stripped they could no longer authenticate, so triggering one would only fail. Their generators, label configurers and the now-orphaned per-issuer GINKGO_FOCUS presets are removed too.
  • Censor secrets from job logs. censor_secrets: true in the default decoration config, so the sidecar redacts known secret values before logs and artifacts are uploaded to the public cert-manager-prow-artifacts bucket. Defence in depth alongside removing the presets.

Coverage

Regular Venafi coverage is unaffected: it comes from the ci-*-issuers-venafi periodic, which keeps its credentials. Periodics and postsubmits retain all credential presets.

Validation

  • go test ./config/prowgen/...
  • make prowgen produces no drift
  • make local-checkconfig (checkconfig --strict) passes

Review fixes

  • Mount the Venafi Secrets as volumes in their presets. Prow's censoring only learns the values to redact from Secrets mounted into the Pod, never from env vars, so censor_secrets was not actually covering the env-injected Venafi credentials. Each preset now also mounts its Secret (only the sensitive keys) under /etc/censor/; evidence permalinks pinned to the utility-image version in use are in the preset comment.
  • Repo-wide policy test. config/prowgen/presubmit_policy_test.go forbids secret-bearing presets on any presubmit, hand-written or generated. The forbidden set is derived from the preset definitions (any preset injecting a Secret via env secretKeyRef or a Secret volume), so new credential presets are covered automatically. Runs in the existing pull-testing-test presubmit via make test.

Follow-ups

  • Restore pre-merge Venafi coverage using a vendor-supplied verified fake #1226 — pre-merge Venafi coverage is intentionally gone from this PR (a credentialed presubmit is exactly the vulnerability); the proposed substitute is a vendor-supplied verified fake of the Venafi APIs, which would let credential-free per-issuer presubmits return.
  • Add a dedicated node pool for credentialed Prow jobs infrastructure#89 adds a dedicated tainted node pool for credentialed jobs. Stripping presets stops presubmits mounting the Venafi credentials, but the ci-*-issuers-venafi periodics still share nodes with privileged (dind) presubmit pods, so a node escape could read their secrets via the kubelet. Once that pool exists, a follow-up here will pin the Venafi periodics to it with a nodeSelector and toleration.

with claude opus-4.8 and claude fable-5

wallrj and others added 3 commits August 12, 2026 12:35
Presubmits run unreviewed pull-request code, so they must never mount live
credentials. The e2e generators attach the preset-venafi-* presets to jobs that
are used for both presubmits and periodics, so today those presets reach
presubmits as well.

Remove the credential presets at addPresubmit(), the single point through which
every presubmit passes, rather than at each generator. A future generator that
re-adds a credential label to a presubmit cannot defeat this, and periodics
(which run merged, reviewed code) keep their credentials unchanged.

Regenerate the cert-manager job configs: the credential presets are dropped from
the presubmit e2e jobs on master, release-1.20 and release-1.21 while the
corresponding periodics retain them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
Enable censor_secrets in the default decoration config so the sidecar redacts
known secret values before logs and artifacts are uploaded to the public
cert-manager-prow-artifacts bucket. Defence in depth alongside removing
credential presets from presubmits: it limits accidental leakage into public
logs, though it cannot stop a job from exfiltrating a secret over the network.

Validated with checkconfig --strict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
The pull-*-issuers-venafi-{tpp,cloud,ngts} jobs were optional, /test-only
presubmits that never ran by default. Now that credential presets are stripped
from presubmits they could no longer authenticate against the live Venafi
services, so on the rare occasion a maintainer triggered one it would only
fail.

Regular Venafi coverage is unaffected: it comes from the E2ETestVenafiBoth
periodic (ci-*-issuers-venafi), which focuses on all three Venafi issuers and
keeps its credentials.

Remove the three presubmit registrations along with the generators and label
configurers that existed solely to build them, and drop the now-orphaned
per-issuer GINKGO_FOCUS presets. Validated with checkconfig --strict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
@cert-manager-prow cert-manager-prow Bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 12, 2026
@wallrj
wallrj requested a balanced review from Copilot August 12, 2026 11:41

Copilot AI 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.

Pull request overview

Hardens Prow presubmits against live Venafi credential exposure while retaining trusted periodic coverage.

Changes:

  • Strips Venafi credential labels from all generated presubmits.
  • Removes unusable per-issuer Venafi presubmits and presets.
  • Enables secret censoring for logs and artifacts.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
config/prowgen/prowspecs/specs.go Removes per-issuer presubmit registration.
config/prowgen/pkg/generators.go Removes obsolete Venafi generators.
config/prowgen/pkg/context.go Enforces credential-label stripping.
config/prowgen/pkg/context_test.go Tests presubmit stripping and periodic retention.
config/prowgen/pkg/configurers.go Removes obsolete label configurers.
config/jobs/cert-manager/config.yaml Removes orphaned focus presets.
config/jobs/cert-manager/cert-manager/release-1.21/cert-manager-release-1.21.yaml Regenerates release 1.21 jobs.
config/jobs/cert-manager/cert-manager/release-1.20/cert-manager-release-1.20.yaml Regenerates release 1.20 jobs.
config/jobs/cert-manager/cert-manager/master/cert-manager-master.yaml Regenerates master jobs.
config/config.yaml Enables global secret censoring.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

wallrj and others added 2 commits August 12, 2026 14:11
Prow's censor_secrets only learns the values to redact from Secrets
mounted into the Pod; env vars are never scanned. The venafi-* presets
inject credentials exclusively via secretKeyRef env vars, so nothing
was actually being censored. Mount each Secret as a volume, projecting
only the sensitive keys so that non-secret values (URLs, zones) remain
readable in the logs. Evidence permalinks, pinned to the utility-image
version in use, are in the preset comment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
The strip in addPresubmit only covers prowgen-generated jobs, and its
presubmitForbiddenLabels list is hardcoded, so a hand-written presubmit
or a future credential preset could reintroduce live credentials on
unreviewed PR code without any check failing.

This test derives the forbidden label set from the preset definitions
themselves (any preset injecting a Secret via env secretKeyRef or a
Secret volume) and walks every job file in the repository, covering
hand-written and generated presubmits alike. It runs in the existing
pull-testing-test presubmit via make test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
wallrj and others added 3 commits August 12, 2026 14:44
Silently stripping the forbidden labels was fail-silent: a future
generator wiring a Venafi job into a presubmit would emit a job with a
Venafi GINKGO_FOCUS but no credentials, which would either perma-fail
against the live services or pass vacuously, with verify-prowgen and
the unit tests all green. Fail generation loudly instead, so the
developer must remove the preset or make the job a periodic.

Also correct the comment: prowgen has no postsubmit support, so only
periodics may carry credentials.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
The specs.go comment narrated the removal and was already stale (it
described stripping, which is now a panic); git log records the why.
Point the E2ETestVenafiBoth comment at the issue tracking credential-free
pre-merge coverage instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>
Fixes the pull-testing-verify failure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Richard Wall <richard@the-moon.net>

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

I can't see any reason to not merge!

@inteon

inteon commented Aug 12, 2026

Copy link
Copy Markdown
Member

/approve
/lgtm

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon, SgtCoDFish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit cce35e2 into master Aug 12, 2026
6 checks passed
@cert-manager-prow

Copy link
Copy Markdown
Contributor

@wallrj: Updated the following 2 configmaps:

  • job-config configmap in namespace default at cluster default using the following files:
    • key cert-manager-master.yaml using file config/jobs/cert-manager/cert-manager/master/cert-manager-master.yaml
    • key cert-manager-release-1.20.yaml using file config/jobs/cert-manager/cert-manager/release-1.20/cert-manager-release-1.20.yaml
    • key cert-manager-release-1.21.yaml using file config/jobs/cert-manager/cert-manager/release-1.21/cert-manager-release-1.21.yaml
    • key config.yaml using file config/jobs/cert-manager/config.yaml
  • config configmap in namespace default at cluster default using the following files:
    • key config.yaml using file config/config.yaml
Details

In response to this:

Presubmits run unreviewed pull-request code, so they should never mount live credentials. This hardens the Prow config so that only periodics and postsubmits (which run merged, reviewed code) carry credential presets.

Changes

  • Strip credential presets at the choke point. addPresubmit() in config/prowgen/pkg/context.go now deletes the preset-venafi-* presets from every presubmit it registers. That is the single point through which every presubmit passes, so a future generator that re-adds a credential label to a presubmit cannot reintroduce the problem. New unit tests in context_test.go assert presubmits are stripped while periodics retain their credentials.
  • Remove the per-issuer Venafi presubmits. The pull-*-issuers-venafi-{tpp,cloud,ngts} jobs were optional, /test-only presubmits that never ran by default; with the presets stripped they could no longer authenticate, so triggering one would only fail. Their generators, label configurers and the now-orphaned per-issuer GINKGO_FOCUS presets are removed too.
  • Censor secrets from job logs. censor_secrets: true in the default decoration config, so the sidecar redacts known secret values before logs and artifacts are uploaded to the public cert-manager-prow-artifacts bucket. Defence in depth alongside removing the presets.

Coverage

Regular Venafi coverage is unaffected: it comes from the ci-*-issuers-venafi periodic, which keeps its credentials. Periodics and postsubmits retain all credential presets.

Validation

  • go test ./config/prowgen/...
  • make prowgen produces no drift
  • make local-checkconfig (checkconfig --strict) passes

Review fixes

  • Mount the Venafi Secrets as volumes in their presets. Prow's censoring only learns the values to redact from Secrets mounted into the Pod, never from env vars, so censor_secrets was not actually covering the env-injected Venafi credentials. Each preset now also mounts its Secret (only the sensitive keys) under /etc/censor/; evidence permalinks pinned to the utility-image version in use are in the preset comment.
  • Repo-wide policy test. config/prowgen/presubmit_policy_test.go forbids secret-bearing presets on any presubmit, hand-written or generated. The forbidden set is derived from the preset definitions (any preset injecting a Secret via env secretKeyRef or a Secret volume), so new credential presets are covered automatically. Runs in the existing pull-testing-test presubmit via make test.

Follow-ups

  • Restore pre-merge Venafi coverage using a vendor-supplied verified fake #1226 — pre-merge Venafi coverage is intentionally gone from this PR (a credentialed presubmit is exactly the vulnerability); the proposed substitute is a vendor-supplied verified fake of the Venafi APIs, which would let credential-free per-issuer presubmits return.
  • Add a dedicated node pool for credentialed Prow jobs infrastructure#89 adds a dedicated tainted node pool for credentialed jobs. Stripping presets stops presubmits mounting the Venafi credentials, but the ci-*-issuers-venafi periodics still share nodes with privileged (dind) presubmit pods, so a node escape could read their secrets via the kubelet. Once that pool exists, a follow-up here will pin the Venafi periodics to it with a nodeSelector and toleration.

with claude opus-4.8 and claude fable-5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@SgtCoDFish
SgtCoDFish deleted the security-presubmit-credentials branch August 12, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants