sensitive

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sensitive keeps the values of `sensitive = true` variables out of everything Orchard writes or prints. A Redactor replaces each occurrence of a sensitive string with a marker naming its variable («sensitive:dsn»), wherever the value has travelled: an action's outputs, an undo step, an error message, a component input. The markers are reversible, so teardown, once it has the values again, restores what the run really saw.

ponytail: only string values (and the strings inside lists, maps and objects) are matched; a sensitive number or bool, or a secret used as an object key, isn't.

Index

Constants

View Source
const MinLength = 4

MinLength is the shortest sensitive string New accepts. Every occurrence of the value is replaced, so a secret such as "us" would turn up in unrelated outputs and bury the record in markers.

Variables

This section is empty.

Functions

func Marker

func Marker(name string) string

Marker is what replaces the value of the sensitive variable name.

func Wrap

func Wrap(inner engine.Reporter, r *Redactor) engine.Reporter

Wrap returns inner unchanged when r has nothing to redact.

Types

type Redactor

type Redactor struct {
	// contains filtered or unexported fields
}

Redactor swaps sensitive strings for markers and back. A nil *Redactor, and one with nothing to redact, leaves values alone.

func New

func New(vars map[string]cty.Value, names map[string]bool) (*Redactor, error)

New builds a Redactor for the variables in vars that names marks sensitive. It refuses a sensitive string shorter than MinLength.

func (*Redactor) Error

func (r *Redactor) Error(err error) error

Error redacts err's message, keeping err when nothing changes.

func (*Redactor) Restore

func (r *Redactor) Restore(m map[string]cty.Value) map[string]cty.Value

Restore puts the sensitive values back in place of their markers.

func (*Redactor) String

func (r *Redactor) String(s string) string

String redacts s.

func (*Redactor) Value

func (r *Redactor) Value(v cty.Value) cty.Value

Value redacts every string inside v. A marked value is left as it is: it's already known to be sensitive, and whoever receives it leaves it out.

func (*Redactor) Values

func (r *Redactor) Values(m map[string]cty.Value) map[string]cty.Value

Values redacts each value in m, returning a new map.

type Reporter

type Reporter struct {
	Inner    engine.Reporter
	Redactor *Redactor
}

Reporter redacts every value and error before passing the event on to Inner, so neither the terminal nor the run record sees a sensitive value. It forwards the optional engine.UndoReporter and engine.ComponentVarsReporter events when Inner takes them.

func (*Reporter) ComponentVars

func (s *Reporter) ComponentVars(componentKey string, vars map[string]cty.Value)

ComponentVars implements engine.ComponentVarsReporter.

func (*Reporter) NodeCompleted

func (s *Reporter) NodeCompleted(nodeID string, outputs map[string]cty.Value, d time.Duration)

NodeCompleted implements engine.Reporter.

func (*Reporter) NodeFailed

func (s *Reporter) NodeFailed(nodeID string, err error)

NodeFailed implements engine.Reporter.

func (*Reporter) NodeStarted

func (s *Reporter) NodeStarted(nodeID string)

NodeStarted implements engine.Reporter.

func (*Reporter) NodeUndo

func (s *Reporter) NodeUndo(nodeID string, undo provider.Invocation)

NodeUndo implements engine.UndoReporter.

func (*Reporter) RunCompleted

func (s *Reporter) RunCompleted(summary engine.RunSummary)

RunCompleted implements engine.Reporter.

func (*Reporter) RunStarted

func (s *Reporter) RunStarted(scenario string)

RunStarted implements engine.Reporter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL