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