capistrano / capistrano/sshkit
No redaction for with values
- 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
Assessment
This issue has not been assessed yet.