Documentation
¶
Overview ¶
Package secrets holds a run's resolved credentials.
This package resolves nothing: mamori does, before senro.Run is called, and this package takes the values out of the struct mamori.Load returned. senro defines no provider interface, hence no registry, pinning or watch loop anywhere.
A value is unexported inside a Secret and leaves this package through exactly one accessor, Value, so every route to a plaintext credential is one grep away.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identity ¶
type Identity struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
}
Identity is a Secret with no value at all: the form that leaves this package for an event payload or a cache key, making "no value here" a property of the type rather than of a caller's discipline.
type Secret ¶
type Secret struct {
// Name is the Go struct field a step references with SecretEnv. A field
// inside a named nested struct is qualified with a dot ("Registry.Token");
// a field promoted from an embedded struct keeps its bare name, matching
// Go's own promotion.
Name string
// Source is the mamori source: tag with any userinfo and any query
// removed (see sourceIdentity). It is identity, never content, and it is
// what reaches a secret.resolved event and a cache key's Secrets
// component.
Source string
// Version is the provider's version for this value. Always "": mamori
// surfaces Value.Version to a provider, not to Load's caller. Declared
// because the cache key's secret identity keys on it and
// api.SecretResolvedBody already publishes the field.
Version string
// contains filtered or unexported fields
}
Secret is one resolved credential and the identity of where it came from.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a run's resolved secrets. The nil *Set is a run with none, and every method treats it as empty so the engine's call sites never branch.
func FromConfig ¶
FromConfig walks the struct mamori.Load returned and collects every secret in it: the whole seam between mamori and senro's redaction. This is the only place Reveal() should appear; reveal_static_test.go at the repository root mechanises that grep and fails the build on a second call site.
cfg may be a struct or a pointer to one; anything else is refused by name, rather than a run that starts with an empty set and delivers nothing.
func (*Set) Has ¶
Has reports whether name resolved to a value, which is what the engine's reference check asks before a step declares it needs one.
func (*Set) Identities ¶
Identities is every secret's identity, sorted by name. This is what the engine emits as secret.resolved and what the cache key builder folds in.
func (*Set) Identity ¶
Identity looks one secret's identity up by name, for the cache key builder, which needs source and version beside a digest of the value and must never hold the two in one struct.
func (*Set) Names ¶
Names is every resolved secret's name, sorted, so an error message that lists them is stable.
func (*Set) RedactValues ¶
RedactValues is the seed for the run's redactor: every value labelled by name, so redact.Set.Match can say which secret it found without printing it. Called once in engine.Run, before the first event, so redaction is live before anything can write to the ledger.
func (*Set) Value ¶
Value is the one accessor that hands back a plaintext credential.
It has THREE callers, all in package engine, none keeping a copy beyond immediate use; TestSetValueCallSitesAreAllowlisted (reveal_static_test.go at the repository root) pins them by name, so a fourth caller fails the build. It returns a copy, so a caller that mutates or retains the slice cannot reach back into this Set.