Documentation
¶
Overview ¶
templ: version: v0.3.1020
templ: version: v0.3.1020
templ: version: v0.3.1020
templ: version: v0.3.1020
Package templates holds the templ components of the Redoubt dashboard. Every dynamic value is rendered through templ's automatic escaping; templ.Raw is never used (user data is never trusted as HTML). Components receive plain view structs from the service layer and never see secret values (golden rule 3): secrets are write-only and only their names are rendered.
templ: version: v0.3.1020
templ: version: v0.3.1020
templ: version: v0.3.1020
Index ¶
- Variables
- func Account(p Page) templ.Component
- func AccountWith(p Page, totp templ.Component, tokens templ.Component) templ.Component
- func Alert(n Notice) templ.Component
- func AppDetail(p Page, app deploy.AppView, deps []deploy.DeploymentView, ...) templ.Component
- func AppNew(p Page, f AppForm) templ.Component
- func AppsList(p Page, rows []AppRow) templ.Component
- func DeploymentPage(p Page, dep deploy.DeploymentView, lines []deploy.LogLine, after int64) templ.Component
- func DeploymentStatus(dep deploy.DeploymentView) templ.Component
- func DeploymentsTable(app string, deps []deploy.DeploymentView, n Notice) templ.Component
- func ErrorFragment(msg string) templ.Component
- func ErrorPage(p Page, status string, msg string) templ.Component
- func GitPage(p Page, app deploy.AppView, f GitForm) templ.Component
- func GitResult(p Page, app string, res deploy.GitSourceResult) templ.Component
- func Layout(p Page) templ.Component
- func Login(p Page, email string) templ.Component
- func Posture(p Page, rep *selfaudit.Report) templ.Component
- func SecretsPanel(p Page, app string, secrets []deploy.SecretMeta, n Notice) templ.Component
- func SelfAudit(p Page, rep selfaudit.Report) templ.Component
- func Setup(p Page, email string) templ.Component
- func TOTPConfirmed(codes []string) templ.Component
- func TOTPEnrolled(p Page, secret string, otpauth string) templ.Component
- func TOTPError(p Page, msg string) templ.Component
- func TOTPLogin(p Page) templ.Component
- func TokenCreated(p Page, name string, token string) templ.Component
- func TokenForm(p Page, n Notice) templ.Component
- func TokensFragment(p Page, n Notice) templ.Component
- type AppForm
- type AppRow
- type GitForm
- type Notice
- type Page
- type PostureItem
- type TSCRow
- type User
Constants ¶
This section is empty.
Variables ¶
var PostureChecklist = []PostureItem{
{"No shell command strings", "Every Docker operation is a typed call to the Engine API; there is no os/exec anywhere in the control plane.", "TestNoShellExecFromUserInput"},
{"No raw Docker socket", "Only the socket-proxy holds docker.sock; every call passes an endpoint allow-list that denies exec, privileged and host-affecting endpoints.", "TestNoContainerGetsTheDockerSocket, TestSocketProxyDeniesExec"},
{"Hardened app containers", "Non-root, no-new-privileges, cap_drop ALL, read-only rootfs with noexec/nosuid tmpfs, seccomp + AppArmor, memory/CPU/pids limits, per-app network.", "TestHardenedHostConfig, TestIntegrationPhase1AllAppContainersHardened"},
{"Overrides are loud", "Relaxing a default needs an explicit flag, logs a warning and writes an audit event.", "TestHardeningOverrideWarnsAndAudits"},
{"Write-only secrets", "age-encrypted at rest, injected at runtime, redacted from every log, BuildKit secret mounts only.", "TestSecretsNeverInLogs, TestBuildSecretsNotInImageLayers"},
{"Tamper-evident audit log", "Every state change is a SHA-256 hash-chained, append-only event; verifiable online and offline.", "TestAuditChainVerifiesAndDetectsTampering, TestEveryStateChangeWritesAuditEvent"},
{"RBAC in the service layer", "Owner / Admin / Deployer / Viewer checked by every service method, not the router or UI.", "TestRBACEnforcedInServices, TestViewerCannotDeployOrRevealSecrets"},
{"Dashboard on localhost", "The control plane is published on 127.0.0.1:8443 only; exposure is an explicit operator action.", "TestDashboardBindsLocalhostByDefault"},
{"Mandatory strong auth", "argon2id passwords, TOTP second factor, lockout and rate limiting.", "TestLoginLockoutAfterFailures, TestRateLimitReturns429"},
{"Scanned supply chain", "Trivy gate and Syft SBOM per deployment; release artifacts cosign-signed and verified before an update.", "TestCriticalCVEBlocked, TestUpdateVerifiesCosignSignature"},
}
PostureChecklist is the secure-by-default checklist rendered on /security. It mirrors docs/SECURITY.md section 2 and names the test that enforces each line.
var PostureTSC = []TSCRow{
{"CC6.1", "Logical access controls", "Role matrix enforced server-side; sessions with TOTP; write-only secrets; every auth and role event on the audit chain (auth.*, user.*)."},
{"CC6.6 / CC6.7", "Boundary protection, transmission", "Localhost-only control plane, per-app networks, TLS via ACME for every app hostname, socket-proxy allow-list."},
{"CC7.1 / CC7.2", "Vulnerability and anomaly monitoring", "Trivy scan gate with per-app policy, SBOM per release, self-audit posture checks, lockout and rate-limit audit events."},
{"CC7.3 / CC7.4", "Evaluation and response", "Hash-chained audit export (JSONL/CSV) with offline verification; failed deployments surface logs without secret values."},
{"CC8.1", "Change management", "Every deployment, rollback, secret change and configuration change is an audited, attributable event with health-gated cutover."},
{"A1.2 / A1.3", "Availability, backup and recovery", "Scheduled age-encrypted addon backups to object storage, restore into a fresh addon, Litestream replication of the control-plane database."},
}
PostureTSC is the Trust Services Criteria mapping (evidence-friendly wording only).
Functions ¶
func AccountWith ¶
AccountWith is the Account page with an optional replacement for the #totp and #tokens panels: a plain (non-htmx) form post renders its write-once result inside the full page rather than as a bare fragment, so browsers without JavaScript still get the layout, styles and navigation.
func AppDetail ¶
func AppDetail(p Page, app deploy.AppView, deps []deploy.DeploymentView, secrets []deploy.SecretMeta) templ.Component
AppDetail is the per-app page: source, deployments, write-only secrets and actions.
func DeploymentPage ¶
func DeploymentPage(p Page, dep deploy.DeploymentView, lines []deploy.LogLine, after int64) templ.Component
DeploymentPage is the log viewer. Persisted (already redacted) lines are rendered server-side; while the deployment is active the htmx SSE extension connects to the JSON API's stream for the rest (app.js appends each line as text, never as HTML) and closes on the "end" event.
func DeploymentStatus ¶
func DeploymentStatus(dep deploy.DeploymentView) templ.Component
DeploymentStatus is the state panel; while active it refreshes when the stream ends and every 10 seconds as a fallback.
func DeploymentsTable ¶
DeploymentsTable is the htmx fragment for an app's deployments. While a deployment is active it polls itself every 5 seconds.
func ErrorFragment ¶
ErrorFragment is the htmx-swapped error (shown inline in the requesting panel).
func GitResult ¶
GitResult shows the webhook secret and deploy key ONCE (they are write-only afterwards).
func Layout ¶
Layout is the shared page shell: strict-CSP-friendly head (no inline scripts, all assets same-origin and content-hashed), navigation and one-shot flash messages.
func Login ¶
Login is the email + password form. CSRF for this pre-session form is bound to the redoubt_csrf cookie set alongside the page.
func Posture ¶
Posture renders /security: the checklist, the self-audit score (when the viewer may read it), the TSC mapping, and the honest compliance wording.
func SecretsPanel ¶
SecretsPanel lists secret names (never values) and, for writers, the set/rotate form.
func SelfAudit ¶
SelfAudit renders the posture report: score, the items needing attention, then every check.
func TOTPConfirmed ¶
TOTPConfirmed shows the recovery codes ONCE.
func TOTPEnrolled ¶
TOTPEnrolled shows the provisioning secret ONCE and asks for the first code.
func TokenCreated ¶
TokenCreated shows a freshly minted API token ONCE.
Types ¶
type AppForm ¶
AppForm is the "new app" form state (re-rendered with the user's input on validation errors).
type GitForm ¶
type GitForm struct {
Provider string
RepoURL string
Branch string
BaseDir string
Dockerfile string
PollInterval string
}
GitForm is the git-source form state.
type Page ¶
type Page struct {
Title string
// User is nil when nobody is signed in (login / setup pages).
User *User
// CSRF is the anti-forgery token bound to the caller's session (hidden input + hx-headers).
CSRF string
// Flash is a one-shot success message; Error a one-shot error message.
Flash string
Error string
// Capabilities derived from the principal's role; the service layer enforces them again.
CanManage bool
CanDeploy bool
CanWriteSecrets bool
CanDelete bool
// TOTPEnabled reports whether the signed-in user has a second factor.
TOTPEnabled bool
}
Page carries the per-request layout state.
type PostureItem ¶
type PostureItem struct {
Control string
Detail string
Enforced string // the regression test or mechanism that keeps it true
}
PostureItem is one line of the secure-by-default checklist.