capistrano / capistrano/sshkit

No redaction for with values

Open
#562 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

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
```ruby
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.