Hardening checklist
CSRF protection, secure cookies, HSTS, security headers, rate limiting and the other defences that are on by default or one setting away.
HydroGo is meant to be safe with defaults and tight with a few production settings. This page is the checklist to walk through before you go live.
Production checklist
| Setting | Value | Why |
|---|---|---|
http.public_origin | https://cms.example.com | Canonical origin used in links, cookies and previews. |
security.secure_cookies | true | Cookies are only sent over HTTPS. |
security.enable_hsts | true | Browsers refuse to downgrade to HTTP. Enable once HTTPS works everywhere. |
security.mfa_master_key | 16, 24 or 32 random bytes | Encrypts stored TOTP secrets. |
security.mfa_required_roles | [admin] | Force MFA for powerful roles. Enrol accounts first. |
security.preview_signing_key | 32+ random bytes | Signs draft preview links. |
security.public_api_origins | Your frontend origins | Allow cross-origin browser reads of published content only from these origins. |
database.dsn | From environment | Keep credentials out of files you commit. |
# generate a 32-byte secret
openssl rand -hex 32 # 64 hex characters = 32 bytes
openssl rand -base64 32CSRF protection
Browser sessions are protected against cross-site request forgery. The server sets a hydro_csrf cookie and requires its value in the X-CSRF-Token header on every unsafe request (POST, PUT, PATCH, DELETE) that authenticates with the session cookie. Fetch the current token from GET /csrf-token or GET /api/v1/admin/me. Requests authenticated with a Bearer token or API key do not use cookies and are not subject to CSRF.
Cookies
hydro_sessionis HTTP-only andSameSite, and gets theSecureflag whensecure_cookiesis on.- Sessions last up to 7 days and expire after 24 hours of inactivity by default. Users can sign out other sessions from My Account.
- Password reset and invitation links are single use and expire (
password_reset_ttl,invitation_ttl).
Response headers
headers_preset: strict (the default) sends a restrictive Content-Security-Policy, X-Frame-Options, Referrer-Policy and Permissions-Policy. With enable_hsts it also sends Strict-Transport-Security. CSP violations can be reported to POST /csp-report.
Rate limiting and abuse protection
- Authentication and sensitive endpoints are rate limited per client (see the table below). Limited requests answer
429with aRetry-Afterheader. - Repeated failed sign-ins are also slowed down by a login tarpit.
- Limits are kept in process by default. Set
redis.urlso every instance shares the same counters. - The anomaly filter (
enable_anomaly_filter) rejects obviously malicious requests; list endpoints it must not touch inanomaly_bypass_paths. - Administrators can ban an IP or CIDR range in the admin or with
hydro ban 203.0.113.0/24 --for 24h.
| Endpoint | Built-in limit |
|---|---|
| Staff login and MFA code | 5 per minute |
| Password reset request | 3 per hour |
| E-mail verification | 3 per hour |
| Public form submission | 3 per hour |
Form view beacon (POST /api/v1/forms/{form}/view) | 60 per minute |
| Member sign-in and registration | 10 per minute |
| Admin backup download | 3 per minute |
Public news view beacons (POST /api/v1/news/views) enforce a 16 KiB body cap rather than a per-IP 429 rate limit.
geoip.trusted_proxy_cidrs.Uploads and media
- Uploads are validated and re-encoded (images become WebP derivatives), and the library refuses new files when free disk space falls below
media.min_free_bytes. media.hotlink_protectionwithallowed_referer_hostskeeps other sites from embedding your files.
Secrets
- Never commit real values for DSNs, SMTP passwords, S3 keys or signing keys. Use
HYDRO_*environment variables or your platform's secret store. - Webhook secrets are never read from YAML; set
HYDRO_WEBHOOK_SECRET. - Personal tokens and API keys are shown once at creation and stored hashed.