* `-e [REDACTED]` → `-e SOME_SECRET=[REDACTED]` * Replaces `Utils.redact` with `Utils.sensitive` to clarify that we're indicating redactability, not actually performing redaction. * Redacts from YAML output, including `mrsk config` (fixes #96)
20 lines
494 B
Ruby
20 lines
494 B
Ruby
require "active_support/core_ext/module/delegation"
|
|
|
|
class Mrsk::Utils::Sensitive
|
|
# So SSHKit knows to redact these values.
|
|
include SSHKit::Redaction
|
|
|
|
attr_reader :unredacted, :redaction
|
|
delegate :to_s, to: :unredacted
|
|
delegate :inspect, to: :redaction
|
|
|
|
def initialize(value, redaction: "[REDACTED]")
|
|
@unredacted, @redaction = value, redaction
|
|
end
|
|
|
|
# Sensitive values won't leak into YAML output.
|
|
def encode_with(coder)
|
|
coder.represent_scalar nil, redaction
|
|
end
|
|
end
|