Documentation
¶
Overview ¶
Package compose is the §5.6 allowlist validator — the ONE chokepoint every compose document passes before it can reach `docker compose` (plan §5.6). It resolves ${VAR}/.env interpolation FIRST (validating before interpolation is a known bypass), then rejects any unknown top-level/service key and the dangerous set, and confines every bind mount under the app's run_dir.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interpolate ¶
Interpolate resolves docker-compose-style ${VAR} references in raw text BEFORE YAML parsing (plan §5.6 step 1). Supported forms: $VAR, ${VAR}, ${VAR:-def}, ${VAR-def}, ${VAR:?msg}, ${VAR?msg}; $$ is a literal $. An unset variable with no default resolves to "" (compose's default), which the validator then sees.
Types ¶
type Env ¶
Env is a name→value map used for ${VAR} resolution. It is built from the app's .env file (and, later, the encrypted env store) — NEVER from Mooring's own process environment, so Mooring secrets can't leak into a compose render.
func ParseEnvFile ¶
ParseEnvFile parses KEY=VALUE lines (a .env file). Blank lines and #comments are skipped; values are taken literally (no nested interpolation), matching docker compose's .env handling closely enough for validation.
type FileSecret ¶
FileSecret is a compose top-level file-mounted secret (a TLS keypair, a credential file). Mooring shows these as present/missing by stat only and NEVER reads their contents (plan §7 file-secrets vs env).
func FileSecrets ¶
func FileSecrets(raw []byte, env Env) []FileSecret
FileSecrets extracts top-level `secrets:` entries that have a `file:` path. It is read-only and best-effort: a malformed document yields no secrets rather than an error (the validator is the gate; this is just for the panel).
type Options ¶
type Options struct {
// ProtectedPaths are additional absolute host paths that must never be a bind
// source (e.g. Mooring's data dir and config dir, holding the DB + master
// key). Joined with the built-in sensitivePaths set (review #17).
ProtectedPaths []string
}
ValidateBytes runs the full §5.6 validation on a compose document. env is used for ${VAR} resolution (built from the app's .env, never Mooring's env); runDir is the app's run directory that bind mounts must stay under. Options carry extra, deployment-specific inputs to the validator.
type Result ¶
type Result struct {
Violations []Violation
}
Result is the validation outcome.
func ValidateBytes ¶
ValidateBytes runs the full §5.6 validation on a compose document. env is used for ${VAR} resolution (built from the app's .env, never Mooring's env); runDir is the app's run directory that bind mounts must stay under.
func (*Result) SortViolations ¶
func (r *Result) SortViolations()
SortViolations orders violations by line for stable display.