Skip to content

fly commands do not fully redact secrets from build logs #8477

Closed

Description

@aliculPix4D

Summary

fly commands do not fully redact secrets, even though secrets are correctly redacted in the WebUI.
The issue was encountered with following commands:

  • fly watch
  • fly execute
  • fly trigger-job --watch

Similar, but stale and closed issue: #5064

Steps to reproduce

Example 1: task.yml used with fly execute

---
platform: linux

image_resource:
  type: registry-image
  source: {repository: busybox}

run:
  path: sh
  args: 
  - -c
  - |
   env # GOOD
   echo $SECRET # GOOD
   echo ((test_parameter)) # BAD
params:
  SECRET: ((test_parameter))

Example 2: pipeline.yml used in combination with fly watch and fly trigger-job --watch

---
jobs:
- name: redact-secrets
  plan:
  - task: secrets
    config:
      platform: linux
      image_resource:
        type: registry-image
        source: {repository: busybox}
      run:
        path: sh
        args: 
        - -c
        - |
        env # GOOD
        echo $SECRET # GOOD
        echo ((test_parameter)) # BAD
    params:
      SECRET: ((test_parameter))

Both examples will result in leaked secret in your terminal:

selected worker: wrk-lin-0
running sh -c env # GOOD
echo $SECRET # GOOD
echo **LEAKED_SECRET_VALUE** # BAD
....
SECRET=((redacted))
....
((redacted))
((redacted))
succeeded

Expected results

  • all secrets are redacted from build logs, even when using fly commands

Actual results

Secrets from credential manager are leaking in build logs when using some fly commands

Triaging info

  • Concourse version: v7.8.1
  • Browser (if applicable): N/A
  • Did this used to work? No.

Activity

  1. dmarmugi commented on Jul 25, 2024

    @dmarmugi

    from the linked ticket #5064 (comment)

    I am torn on if this issue is just an example of dumb usage echoing a secret (compared to putting the secret in a param) or a real thing. Feel free to close if you feel it is the former.

    Note that the use of echo is a red herring -- the secrets are leaked in the log message "running <dumps script>" (maybe here?), not during the actual script execution

  2. taylorsilva commented on Mar 25, 2026

    @taylorsilva
    Member

    Clarifying for myself later: the issue is that when you run fly watch/execute/trigger-job, it'll print running... and then print out the task's run.path and run.args with all vars interpolated and NOT redacted.

    We could either:

    1. Redact the secrets, or
    2. Show the original command before var interpolation

    I think the leak comes from the task delegate:

    func (d *taskDelegate) SetTaskConfig(config atc.TaskConfig) {
    d.config = config
    }
    func (d *taskDelegate) Initializing(logger lager.Logger) {
    err := d.build.SaveEvent(event.InitializeTask{
    Origin: d.eventOrigin,
    Time: d.clock.Now().Unix(),
    TaskConfig: event.ShadowTaskConfig(d.config),
    })
    if err != nil {
    logger.Error("failed-to-save-initialize-task-event", err)
    return
    }
    logger.Info("initializing")
    }
    func (d *taskDelegate) Starting(logger lager.Logger) {
    err := d.build.SaveEvent(event.StartTask{
    Origin: d.eventOrigin,
    Time: d.clock.Now().Unix(),
    TaskConfig: event.ShadowTaskConfig(d.config),
    })
    if err != nil {
    logger.Error("failed-to-save-initialize-task-event", err)
    return
    }
    logger.Debug("starting")
    }

    This could be an issue with all build.SaveEvent() calls in the other delegates as well.

  3. added a commit that references this issue on Apr 28, 2026
    cdc3bc2
  4. aliculPix4D commented on Apr 29, 2026

    @aliculPix4D
    ContributorAuthor

    Thanks @pierluigilenoci for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions