feat(admin-console): Stage 1 — pipe + skeleton behind the gateway
Tests · Go / test (push) Successful in 2m0s
Tests · Go / test (push) Successful in 2m0s
Add the server-rendered operator console at /_gm, exposed publicly through the gateway behind the existing admin_accounts Basic Auth. Backend: - new internal/adminconsole package (html/template Renderer, stateless HMAC CSRF signer, embedded stylesheet) - /_gm route group reusing basicauth.Middleware(admin.Service) + a CSRF guard (per-operator token + same-origin check); dashboard landing page - BACKEND_ADMIN_CONSOLE_CSRF_KEY config (per-process random fallback) Gateway: - new "admin" public route class (per-IP rate limit, body + GET/HEAD/POST method limits) classifying /_gm traffic - reverse proxy to the backend /_gm surface, preserving Host and relaying the backend 401 Basic Auth challenge; 502 when the backend is unreachable - GATEWAY_PUBLIC_HTTP_ANTI_ABUSE_ADMIN_* config dev-deploy: - Caddy routes /_gm/* to the gateway - bootstrap admin + stable CSRF key; enable Prometheus /metrics exporters on backend and gateway (forward-compat for a future Prometheus/Grafana stack) Docs: ARCHITECTURE 14.1/16, FUNCTIONAL 10.2.1 (+ru mirror), backend and gateway READMEs, new backend/docs/admin-console.md. Tests: renderer + CSRF unit tests; backend router auth/render/asset/CSRF; gateway classifier, proxy forwarding/Host/401/405/413/429/502.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Package adminconsole renders the server-side operator console mounted by the
|
||||
// backend under the `/_gm` route group.
|
||||
//
|
||||
// The console is a multi-page, server-rendered surface built on the standard
|
||||
// library's html/template package: navigation is driven by request path and
|
||||
// query, state changes are submitted with HTML forms and answered with a
|
||||
// Post/Redirect/Get redirect. The package owns three concerns and nothing
|
||||
// transport-specific:
|
||||
//
|
||||
// - Renderer composes the shared layout with one content page per route.
|
||||
// - CSRF issues and verifies the stateless anti-CSRF token embedded in every
|
||||
// state-changing form.
|
||||
// - Assets exposes the embedded stylesheet served under `/_gm/assets/`.
|
||||
//
|
||||
// The gin glue (route registration, Basic Auth, the CSRF guard middleware, and
|
||||
// the per-page handlers) lives in package server; this package stays free of
|
||||
// the web framework so it can be unit-tested in isolation.
|
||||
package adminconsole
|
||||
Reference in New Issue
Block a user