Documentation
¶
Overview ¶
Package deploycheck verifies, at deploy time, that every secret a service document and its policy declare is in the installation's SSM, so that a missing or mistyped one is found by the deploy and not by the first person to sign in (secrets are read when first used, not at start).
config.DeclaredSecrets says WHAT is declared; this package says WHERE each is on the layout the installation uses (v4 or v5), reads it, and judges it: present, not empty, and for the state secret of the right format. The report holds names, versions and fixed reasons. It never holds a value, and no error it returns wraps one.
What sluis makes at run time is not checked: a name no document gives cannot be declared before it exists (the console's session key, an App's credential).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Address ¶
func Address(s config.DeclaredSecret, layout string) string
Address is the address below the installation's root where layout puts the secret, or "" when the document does not give enough to say (a v5 workspace key needs the workspace's id, a v4 name needs the name).
func Own ¶ added in v1.76.0
func Own(declared []config.DeclaredSecret, kinds ...string) []config.DeclaredSecret
Own keeps the declared secrets of the given kinds. Unlike Check's `only`, no kinds is none: a module that declares no secret of its own checks none.
Types ¶
type Entry ¶
type Entry struct {
// Value is the parameter's content. It is judged and dropped.
Value []byte
// Version is the parameter's version.
Version int64
}
Entry is one parameter as the reader returns it.
type Reader ¶
Reader reads one parameter by its absolute name. An absent one is (Entry{}, false, nil).
type Report ¶
type Report struct {
Layout string `json:"layout"`
Root string `json:"root"`
Results []Result `json:"results"`
OK bool `json:"ok"`
}
Report is the verdict on every declared secret.
func Check ¶
func Check(ctx context.Context, doc *config.Serve, pol *config.PolicyDocument, only ...string) (Report, error)
Check is the whole check for a loaded service document: the layout and root its `secrets` section names, the declared set of the document and its policy, and one read of each from the SSM the section names. only, when given, keeps the kinds a function's own module reads (a function checks its own paths and no other module's).
func CheckDeclared ¶ added in v1.76.0
func CheckDeclared(ctx context.Context, s *config.Secrets, declared []config.DeclaredSecret) (Report, error)
CheckDeclared reads each declared secret from the SSM the `secrets` section names. The section is held to the same rules whatever is declared; with nothing declared no read is made, and the report is empty and OK.
func Run ¶
func Run(ctx context.Context, rd Reader, root, layout string, declared []config.DeclaredSecret) Report
Run reads every declared secret under root and judges it. It makes one read per secret and stops for none: the report is the whole picture, so one deploy shows every name to fix.
type Result ¶
type Result struct {
Kind string `json:"kind"`
Subject string `json:"subject,omitempty"`
// Address is the parameter's absolute name.
Address string `json:"address"`
Version int64 `json:"version,omitempty"`
OK bool `json:"ok"`
// Problem is one of a fixed set of phrases; never a value.
Problem string `json:"problem,omitempty"`
}
Result is one declared secret's verdict.
type SSM ¶
type SSM struct {
API secrets.ParametersAPI
}
SSM reads parameters with one GetParameter each.
The read decrypts: whether a SecureString's content is empty, or is a state secret of the right shape, is not in its ciphertext. The content is judged and dropped; nothing here logs, returns or wraps it.