SR-009 — Layered Security Controls: System Requirements

By Engineering Team•October 14, 2026•6 min read
Metadata Details
System Name astro-static-site Layered Security Specifications
Document ID SR-STATIC-009
Author Engineering Team
Status Draft / Implementation

Traces back to BRD-007 — Layered Security for the Public Website and Its Media. The zone’s baseline (TLS, HSTS, the managed and custom firewall rules, the rate limit and the threat settings) comes from the shared site module used by every environment and is specified once, in SR-INFRA-008. This document adds what is specific to this site and shows where each BRD-007 need is met. Cite requirement IDs with the document ID (e.g. SR-009 SR-F-02).


1. Layer Model

Security layers: every request from a reader or attacker passes the zone's perimeter (DNS, TLS, managed and custom firewall rules, rate limit, threat settings, DDoS protection) and the edge (CDN cache, HSTS, response headers, Content-Security-Policy), then reaches the Pages project on the domain and www, or the media bucket only through the assets subdomain; the state bucket has no public address

Every layer is declared in the site’s shared OpenTofu module, deploy/modules/site/, and applied to each environment by its own root (SR-INFRA-001).


2. Where each need is met

BRD-007 need Met by
BR-1.1 Availability under attack SR-INFRA-008 SR-F-07 (rate limit); DDoS protection on every zone; SR-NF-01 here
BR-1.2 Known-attack filtering SR-INFRA-008 SR-F-05, SR-F-06, SR-F-14
BR-1.3 Welcome legitimate automation SR-F-01 here
BR-2.1 Private connections SR-INFRA-008 SR-F-01 to SR-F-04
BR-2.2 Safe page delivery SR-F-02 here
BR-3.1 Media not directly exposed SR-F-04 here
BR-3.2 Records isolated and recoverable SR-006 SR-F-07, SR-F-09, SR-NF-05
BR-4.1 Trustworthy releases SR-F-05 here; SR-005
BR-4.2 Nothing published before release SR-F-06 here
BR-5.1 Least access SR-008 SR-NF-01, SR-NF-02
BR-5.2 Credentials never in source SR-004 SR-F-02; SR-008 SR-F-02

3. Functional System Requirements

ID Description Traceability (BRD)
SR-F-01 (Crawlers Pass) No rule challenges or blocks by user agent or bot score; the custom rules block only methods a static site does not serve and exploit paths, so search engines fetch the pages and the sitemap. BR-1.3
SR-F-02 (Response Headers) Every page response carries X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin and a Content-Security-Policy from public/_headers. The policy is written per build by scripts/write-headers.mjs: inline scripts are allowed by hash, img-src names the environment’s media origin, and only the font, icon and Analytics hosts the site uses are allowed. BR-2.2
SR-F-03 (Caching) /_astro/* responses carry Cache-Control: public, max-age=31536000, immutable. Media objects carry a Cache-Control header set at upload and kept by the release copy. BR-1.1
SR-F-04 (Media Only Through the Site’s Address) The media bucket’s only public path is its custom domain assets.<domain> in the site’s zone; its r2.dev address is off, and the custom domain allows no listing and no writes (SR-003 SR-F-03). BR-3.1
SR-F-05 (Immutable Deployments) Each release is a distinct, immutable Pages deployment created by the pipeline from one commit (SR-007); rollback re-points the environment to a previous deployment without a rebuild. BR-4.1
SR-F-06 (Nothing Published Before Release) Pull requests and branches publish nothing: the Pages projects have no Git connection and no preview builds (SR-INFRA-008 SR-F-10). A change reaches a public address only when a person releases it, to the test environment first. BR-4.2

4. Non-Functional & Security Requirements

ID Specification Traceability (BRD)
SR-NF-01 (Rule Parity) The zone’s rules apply to the whole zone, so the apex, www and assets.<domain> get the same protection; the media path is not weaker than the page path. BR-1.1, BR-3.1
SR-NF-02 (Fail Closed on Header Gaps) A change that removes or weakens a header in SR-F-02 fails review; the expected header set is the one in this document. BR-2.2
SR-NF-03 (Cost Ceiling) Every control uses features of the Cloudflare free plan; a control that needs a paid tier is reported before it is adopted (BRD-001 BR-1.1). BR-1.1