Documentation
¶
Overview ¶
Package backend is lockfile on lockkit's console: the Backend that connects a profile's source, validates and shows plans for approval, runs the approved ones and returns only the closed result of docs/security-model.md.
Index ¶
- func Sanitizer() *sanitize.Sanitizer
- type Backend
- func (b *Backend) Checks(ctx context.Context, s console.Session) []console.Finding
- func (b *Backend) Close() error
- func (b *Backend) Connect(ctx context.Context, c console.Credentials) (console.Session, error)
- func (b *Backend) LoadPolicy() (console.Policy, error)
- func (b *Backend) Methods() map[string]console.Handler
- func (b *Backend) OnHub(h *console.Hub)
- func (b *Backend) Sanitizer() *sanitize.Sanitizer
- func (b *Backend) Status(console.Session) any
- type Options
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements console.Backend for one profile.
func New ¶
New prepares the backend: plugin store, workspace (its orphans swept), runner. Close removes the workspace.
func (*Backend) LoadPolicy ¶
LoadPolicy implements console.Backend.
func (*Backend) OnHub ¶ added in v0.5.0
OnHub is console.Options.OnHub: the console's hub, before any request, gets the recompute, so a renewal asked from the hub right after a start is checked too.
type Options ¶
type Options struct {
// ConfigPath is the config file; Profile the profile served.
ConfigPath string
Profile string
// StateDir is lockkit's state base (kit.StateBase() when empty): the
// approved policy, the audit log, and by default the plugins and the
// workspace live under <StateDir>/lockfile.
StateDir string
// PluginDir and WorkDir override the defaults (tests).
PluginDir, WorkDir string
// Run replaces sandbox.Run, Probe sandbox.Probe (tests).
Run func(context.Context, sandbox.Spec) (pluginspec.Outcome, sandbox.Report, error)
Probe func() (int, bool, error)
// ProcHidden replaces procmount.CheckSystem: nil when /proc hides the
// plugins' processes from other accounts. Set only by tests (CI
// runners do not mount /proc with hidepid); no flag or config reaches
// it.
ProcHidden func() error
Now func() time.Time
// ExpireEvery is how often expired handles are removed (30 s).
ExpireEvery time.Duration
}
Options configure a Backend.
type Record ¶
type Record struct {
audit.Base
PlanID string `json:"plan_id,omitempty"`
Handle string `json:"handle,omitempty"`
Key string `json:"key,omitempty"`
Plugins []string `json:"plugins,omitempty"`
Size int64 `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
FetchCause string `json:"fetch_cause,omitempty"`
Plugin string `json:"plugin,omitempty"`
Version string `json:"version,omitempty"`
BinarySHA256 string `json:"binary_sha256,omitempty"`
Result *int `json:"result,omitempty"`
Cause string `json:"cause,omitempty"`
ConsoleError string `json:"console_error,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Signal string `json:"signal,omitempty"`
StderrBytes int64 `json:"stderr_bytes,omitempty"`
DurationMS int64 `json:"duration_ms,omitempty"`
}
Record is lockfile's audit record: lockkit's base fields and the plan's. The audit file is the lockfile account's (0600): the one place where file metadata (key, size, sha256, failure causes) is kept (docs/security-model.md, "Data at rest"). Never file bytes; error text is sanitized first.