Skip to content

fix: redact secrets from task config in build events - #9551

Merged
taylorsilva merged 2 commits into
concourse:masterfrom
pierluigilenoci:fix/fly-redact-secrets
Apr 28, 2026
Merged

taylorsilva merged 2 commits into
concourse:masterfrom
pierluigilenoci:fix/fly-redact-secrets

Conversation

@pierluigilenoci

Copy link
Copy Markdown
Contributor

Summary

Fixes #8477

fly watch, fly execute, and fly trigger-job --watch leak interpolated secret values in the running <command> output line. The root cause is that InitializeTask and StartTask build events include the task config's Run.Path and Run.Args after credential interpolation, without applying the same redaction filter used for stdout/stderr log output.

This PR applies buildOutputFilter (the existing credential redaction mechanism) to the task config's run command before saving these events. The DisableRedactSecrets flag is respected for consistency with the existing behavior.

Before

running sh -c echo ACTUAL_SECRET_VALUE

After

running sh -c echo ((redacted))

Changes

  • atc/engine/task_delegate.go: Add redactedConfig() method that filters Run.Path and Run.Args through the existing buildOutputFilter. Use it in Initializing() and Starting() before calling ShadowTaskConfig.
  • atc/engine/task_delegate_test.go: Add test cases for both Initializing and Starting verifying that secrets in run args are redacted to ((redacted)).

Test plan

  • Existing engine test suite passes (197 specs)
  • New redaction tests for Initializing and Starting events pass
  • Manual verification with fly execute using a task with ((var)) references

When a task config's run args contain interpolated credential values,
the InitializeTask and StartTask events previously included the raw
secret values. This caused fly commands (watch, execute, trigger-job
--watch) to leak secrets in the "running <command>" output, even though
the Web UI correctly redacted them.

Apply buildOutputFilter to the task config's Run.Path and Run.Args
before saving these events, using the same credential tracking and
redaction mechanism already used for stdout/stderr log output. The
DisableRedactSecrets flag is respected for consistency.

Fixes #8477

Signed-off-by: Pierluigi Lenoci <[email protected]>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pierluigilenoci / name: Pierluigi Lenoci (cdc3bc2)
  • ✅ login: taylorsilva / name: Taylor Silva (9a163d7)

@pierluigilenoci

Copy link
Copy Markdown
Contributor Author

/retest

The concourse-ci/testflight check appears to be a systemic infrastructure issue — the same check is also failing on other open PRs (#9342, #9259). All code-level checks pass (unit, integration, containerd-integration, compile-check, watsjs, go-format-check, CodeQL, DeepSource). Requesting a retest.

@taylorsilva

Copy link
Copy Markdown
Member

Yeah that one is flaky if under pressure. Will re-run it.

@taylorsilva

taylorsilva commented Apr 27, 2026 •

Copy link
Copy Markdown
Member

I think the test failures are actually valid. The same three tests are failing in each run of the test suite:

Summarizing 3 Failures:
  [FAIL] External Tasks when external task relies on template variables when task vars are not used, task should get vars from var_sources [It] successfully runs pipeline job with external task
  github.com/concourse/concourse/testflight/task_vars_test.go:156
  [FAIL] A pipeline containing idtoken var sources [It] creates valid custom idtoken
  github.com/concourse/concourse/testflight/idtoken_test.go:61
  [FAIL] External Tasks when external task relies on template variables when vars are from load_var [It] successfully runs pipeline job with external task
  github.com/concourse/concourse/testflight/task_vars_test.go:136

I've invited you to the all team in the Concourse github org. That'll allow you to login and see the errors in our CI.

You can run testflight locally to see the errors: https://github.com/concourse/concourse/blob/master/CONTRIBUTING.md#running-the-acceptance-tests-testflight

docker compose up -d
go install github.com/onsi/ginkgo/v2/ginkgo@latest
export RUNTIME=containerd
ginkgo -r -p ./testflight

I get the same three failures when I checkout your PR.

@taylorsilva

taylorsilva commented Apr 28, 2026 •

Copy link
Copy Markdown
Member

Dug into the test failures this morning. I'll push a commit in a bit updating them to work with this fixed behaviour.

these tests were relying on secrets being leaked via build events. That
no longer happens, so we leak the secrets by splitting them in half and
printing each half separately.

Signed-off-by: Taylor Silva <[email protected]>
@taylorsilva

Copy link
Copy Markdown
Member

Looks like this is working as expected. I've updated the failing testflight tests and got them passing locally. I think I've done the last item in your "Test Plan" as well. I updated one of the tests to look for the ((redacted)) string now (as well as still verifying what it originally was).

Is this PR ready for code review or do you have any other changes you plan to make?

@taylorsilva taylorsilva moved this to Waiting on Contributor in Pull Requests Apr 28, 2026
@pierluigilenoci

Copy link
Copy Markdown
Contributor Author

Yes, this is ready for code review! The fix adds a nil check for the scope before accessing TeamID in the check step, preventing a potential panic when scope is nil. Let me know if you'd like any changes.

@taylorsilva
taylorsilva marked this pull request as ready for review April 28, 2026 19:08
@taylorsilva
taylorsilva requested a review from a team April 28, 2026 19:08

@taylorsilva taylorsilva 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 - TY for the PR!

@taylorsilva
taylorsilva merged commit 9c64e5a into concourse:master Apr 28, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting on Contributor to Done in Pull Requests Apr 28, 2026
taylorsilva added a commit that referenced this pull request May 4, 2026
due to #9551 now redacting
secrets from build events

Signed-off-by: Taylor Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

fly commands do not fully redact secrets from build logs

2 participants