From a268799e97cf7a5eb12b0a8aac99c9aed7482017 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Mon, 16 Nov 2026 23:51:53 +0000 Subject: [PATCH] REPO_POLICIES: Web services 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 --- prompts/REPO_POLICIES.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/prompts/REPO_POLICIES.md b/prompts/REPO_POLICIES.md index 129bf6f..e3faf77 100644 --- a/prompts/REPO_POLICIES.md +++ b/prompts/REPO_POLICIES.md @@ -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.