# Application Design Plan - andreaslop-site-hosting ## Steps - [x] Analyse requirements and host code (done: CmsHost, StaticContentExtensions, CspPolicyCatalog, SecurityHeadersOptions, SetupController) - [x] Collect answers to the design questions below - [x] Generate components.md - [x] Generate component-methods.md - [x] Generate services.md - [x] Generate component-dependency.md - [x] Generate application-design.md (consolidated) - [x] Validate completeness and consistency (security baseline / PBT applicability) ## Facts from the code that shape the questions - `SecurityHeadersOptions.AllowedConnectOrigins` is applied to **both** `Strict` and `Relaxed`. If the Umami and Sentry origins were put there for Andrea's site, the admin (`/admin`, `/api/v1`, under `Strict`) would get them too. `AllowedScriptOrigins` is only used by `Relaxed` today. - Linux file systems are case-sensitive, and all page files are lowercase. A request `/Over-Mij` therefore resolves to a known page exactly when `over-mij.html` exists. A cached "known page set" is not strictly needed: a file-exists predicate on the lowercased name gives the same nginx behaviour. - `UseHttpsRedirection` is a no-op when the host listens on plain HTTP only without an HTTPS port configured; the proxy Pi talks HTTP to the app. There is no forwarded-headers handling in `CmsHost` today. To be verified in NFR Design against the SlpSoftware deployment. - `SetupController` (`GET /Setup/status`, `POST /Setup/owner`) has no protection other than "system not yet initialised". The admin setup page posts to it. ## Design Questions ### Question 1: Origins for the StrictSite policy Where do the Umami script origin and the Sentry connect origins for the website live? - A) New separate lists in `SecurityHeaders` (for example `AllowedSiteScriptOrigins`, `AllowedSiteConnectOrigins`) used only by `StrictSite`; the admin policies stay exactly as strict as today (recommended) - B) Reuse the existing `AllowedScriptOrigins` / `AllowedConnectOrigins`; accept that `Strict` (admin and API) then also lists the Sentry ingest origin in `connect-src` - X) Other (please describe after [Answer]: tag below) [Answer]: A (RELAYED by CMS & API on Bryan's behalf; confirmed when Bryan approves the design) ### Question 2: How the host decides a page is "known" nginx canonicalises (301) only known pages. How should the host decide this? - A) Per request, a file-exists check on the lowercased name (`.html`, or `/index.html`); no cache, so a site delivered in place (symlink variant, rsync) is always current. The pure resolver takes the check as a predicate (recommended) - B) A snapshot of the known pages built at startup and refreshed on a short timer or file watcher - X) Other (please describe after [Answer]: tag below) [Answer]: A (RELAYED by CMS & API on Bryan's behalf; confirmed when Bryan approves the design) ### Question 3: First-admin setup token in the admin The setup token protects `POST /Setup/owner`. How does the person doing the first setup supply it? - A) The setup page shows a "setup token" field, but only when the server says one is required (`GET /Setup/status` returns `tokenRequired`); the token is sent in a request header; small frontend change, no change when no token is configured (recommended) - B) No frontend change: the token is sent only as a header by a direct API call (for example curl), the setup page stays as it is - X) Other (please describe after [Answer]: tag below) [Answer]: A (RELAYED by CMS & API on Bryan's behalf; confirmed when Bryan approves the design)