deploycheck

package
v1.76.10 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 17 Imported by: 0

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 Layout

func Layout(s *config.Secrets) (string, error)

Layout checks the layout a `secrets` section names; empty is v4.

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

type Reader interface {
	Read(ctx context.Context, name string) (Entry, bool, error)
}

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.

func (Report) Describe

func (r Report) Describe() string

Describe is a one-line summary for a log: the counts and no names.

func (Report) Err

func (r Report) Err() error

Err is nil for a report that is OK, and otherwise names every failed address and why.

func (Report) Failed

func (r Report) Failed() []Result

Failed is the results that are not OK.

func (Report) Write

func (r Report) Write(w io.Writer)

Write prints the report for a person: one line per secret, with its address and version.

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.

func (SSM) Read

func (s SSM) Read(ctx context.Context, name string) (Entry, bool, error)

Read implements Reader.

Jump to

Keyboard shortcuts

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