Documentation
¶
Overview ¶
Package redact masks the values of secret flow inputs in everything the runner reports back — node results, the flow result, and progress events. It is applied once, at the boundary where results leave the runner, so the engine keeps working with the real values while a flow runs.
Index ¶
- Constants
- type Redactor
- func (r *Redactor) Error(err error) error
- func (r *Redactor) FlowResult(result *spi.FlowExecutionResult) *spi.FlowExecutionResult
- func (r *Redactor) Map(values map[string]any) map[string]any
- func (r *Redactor) Result(result spi.AnyResult) spi.AnyResult
- func (r *Redactor) Text(s string) string
- func (r *Redactor) Value(v any) any
Constants ¶
const Mask = "***"
Mask is what a secret value is replaced with.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Redactor ¶
type Redactor struct {
// contains filtered or unexported fields
}
Redactor masks a fixed set of secret values. A nil Redactor is a valid no-op.
func New ¶
New returns a Redactor for the values of the inputs named by secretKeys, or nil when none of them holds a non-empty value.
func (*Redactor) Error ¶
Error returns err with its message masked, preserving a UserError's code so the engine's user-fault classification survives.
func (*Redactor) FlowResult ¶
func (r *Redactor) FlowResult(result *spi.FlowExecutionResult) *spi.FlowExecutionResult
FlowResult returns a masked copy of the flow result and of every node result it carries.
func (*Redactor) Map ¶
Map is Value for a map, keeping the map type. A value that cannot be normalized yields an empty map rather than the original.
func (*Redactor) Result ¶
Result returns a masked copy of result. The original is left untouched: while a flow runs it is still the engine's live value, feeding downstream nodes.
func (*Redactor) Value ¶
Value returns a masked copy of v.
v is first normalized to the JSON shape it reports on the wire, then every string leaf of that tree is masked. Scanning the decoded tree rather than the encoded text is what makes the scan sound: json.Marshal escapes &, <, >, " and \, so a secret holding any of them has no literal form in the encoded bytes. Object keys are left alone, so no contract field can be renamed or dropped, and the result is always valid JSON.
A value that cannot be normalized is replaced by the mask. This is a security seam: it fails closed.