Skip to content

No redaction for with values #562

Description

@emirikol

Since it's common for tools to use credentials from env variables rather than inline in commands it seems generally useful to support redaction for them as well.

I accomplished that with

  def with_redaction
    new_args = args.map{|arg| arg.is_a?(Redaction) ? '[REDACTED]' : arg }
    redacted_cmd = dup
    redacted_cmd.instance_variable_set(:@args, new_args)
    if (env = redacted_cmd.options[:env])
      redacted_env = env.transform_values { |v| v.is_a?(SSHKit::Redaction) ? '[REDACTED]' : v }
      redacted_cmd.instance_variable_set(:@options, redacted_cmd.options.merge(env: redacted_env))
    end
    redacted_cmd
  end

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions