-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add secret masking to step logs #9359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
/kind enhancement |
|
@chmouel: The label(s) DetailsIn response to this:
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/test-infra repository. |
|
/kind feature |
d355cd7 to
4bae1f3
Compare
4bae1f3 to
ac97fde
Compare
ac97fde to
33cd6bd
Compare
33cd6bd to
c08ec75
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
There is a limitation with this, secrets over 32kb (default go chunk size) it would not be able to be properly hidden... |
c08ec75 to
8b0714c
Compare
|
I have made a new implementation and detailled it in the PR, basically we increase the chunk size to the largest secrets, very large secrets (up to 1mb due of kube limitation) will slow down log streaming, this shows a warning when that happen.... I have as well optimized the implemntation by gzipping the passed content as one screen... |
8b0714c to
53b72d1
Compare
|
/retest |
Add alpha secret masking for step stdout/stderr behind the `enable-secret-masking` feature flag. How it works: 1. During pod creation, Tekton collects secret values referenced from step `secretKeyRef`, `envFrom.secretRef`, and secret volumes (including TaskSpec volumes). 2. Collected values are de-duplicated and short values are skipped. 3. The mask payload is prepared as base64-per-secret lines, then wrapped as base64(gzip(payload)) and passed to the init container via `TEKTON_SECRET_MASK_DATA`. 4. The `secret-mask-init` subcommand decodes and uncompresses that env payload and writes the secret-mask file consumed by entrypoint. 5. The runner loads that file and decodes each line back to secret bytes. 6. A stream-safe masking writer redacts matching values to "***" in stdout/stderr (and optional log files), handling split writes without leaking partial secret matches. This commit wires the controller, init subcommand, runner integration, feature-flag surface, CRD/config plumbing, tests, and docs needed for this behavior. Note: This feature will not work on Windows nodes in this initial implementation Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
53b72d1 to
061bfa6
Compare
Summary
Add secret masking for step stdout/stderr behind the
enable-secret-maskingfeature flag.How it works
secretKeyRef,envFrom.secretRef, and secret volumes (including TaskSpec volumes).base64(gzip(payload))and passed to the init container viaTEKTON_SECRET_MASK_DATA.secret-mask-initsubcommand decodes and uncompresses the env payload and writes a secret-mask file consumed by the entrypoint.***in stdout/stderr (and optional log files), handling split writes without leaking partial secret matches.This commit wires the controller, init subcommand, runner integration, feature-flag surface, CRD/config plumbing, tests, and docs needed for this behavior.
Caveats
This is not 100% secure. The secret values are still present in the pod specification. Users with
pods/getpermission can still access them viakubectl get pod -o yaml.This feature will not work on Windows nodes in this initial implementation.
However, this change provides meaningful improvements:
kubectl describe podps aux)kubectl get pod -o yamlDemo
recording-20260204-17h35.mp4
Submitter Checklist
Release Notes