REPO_POLICIES: Web services
check / check (push) Canceled after 0s

Merges the WriteTimeout and IdleTimeout items, folds "Never trust
X-Forwarded-For unconditionally" into the sentence on trusted proxies,
and cuts "This list is non-exhaustive", which "without limitation" in
the rule already says; every hardening measure stays.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-16 23:51:53 +00:00
1 parent ca24c6b7ff
commit a268799e97
1 file changed
+7 -6
+7 -6
View File
@@ -778,6 +778,8 @@ style conventions are in separate documents:
standard file sets tabs for `Makefile` and Go files. A re-vendor replaces the
standard part and keeps those sections.
# Web services
- Dockerized web services listen on port 8080 by default, overridable with
`PORT`.
@@ -804,8 +806,7 @@ style conventions are in separate documents:
- Maximum response body size where applicable (e.g. paginated APIs).
- `ReadTimeout` and `ReadHeaderTimeout` on the `http.Server` to defend
against slowloris attacks.
- `WriteTimeout` on the `http.Server`.
- `IdleTimeout` on the `http.Server`.
- `WriteTimeout` and `IdleTimeout` on the `http.Server`.
- Per-handler execution time limits via `context.WithTimeout` or
chi/stdlib `middleware.Timeout`.
- **Authentication and session security:**
@@ -822,7 +823,7 @@ style conventions are in separate documents:
- True client IP detection when behind a reverse proxy
(`X-Forwarded-For`, `X-Real-IP`). The application must accept
forwarded headers only from a configured set of trusted proxy
addresses. Never trust `X-Forwarded-For` unconditionally.
addresses, never unconditionally.
- **CORS:**
- Authenticated endpoints must restrict `Access-Control-Allow-Origin` to
an explicit allowlist of known origins. Wildcard (`*`) is acceptable
@@ -843,9 +844,9 @@ style conventions are in separate documents:
HTTP. However, HSTS headers and `Secure` cookie flags must still be
set by the application so that the browser enforces HTTPS end-to-end.
This list is non-exhaustive. Apply defense-in-depth: if a standard security
hardening measure exists for HTTP services and is not listed here, it is
still expected. When in doubt, harden.
Apply defense-in-depth: if a standard security hardening measure exists for
HTTP services and is not listed here, it is still expected. When in doubt,
harden.
- Database migrations live in `internal/db/migrations/` and must be embedded in
the binary.