Skip to main content
HydroGo
SecurityHardening checklist

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

SettingValueWhy
http.public_originhttps://cms.example.comCanonical origin used in links, cookies and previews.
security.secure_cookiestrueCookies are only sent over HTTPS.
security.enable_hststrueBrowsers refuse to downgrade to HTTP. Enable once HTTPS works everywhere.
security.mfa_master_key16, 24 or 32 random bytesEncrypts stored TOTP secrets.
security.mfa_required_roles[admin]Force MFA for powerful roles. Enrol accounts first.
security.preview_signing_key32+ random bytesSigns draft preview links.
security.public_api_originsYour frontend originsAllow cross-origin browser reads of published content only from these origins.
database.dsnFrom environmentKeep credentials out of files you commit.
BASH
# generate a 32-byte secret
openssl rand -hex 32     # 64 hex characters = 32 bytes
openssl rand -base64 32

CSRF 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_session is HTTP-only and SameSite, and gets the Secure flag when secure_cookies is 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 429 with a Retry-After header.
  • Repeated failed sign-ins are also slowed down by a login tarpit.
  • Limits are kept in process by default. Set redis.url so every instance shares the same counters.
  • The anomaly filter (enable_anomaly_filter) rejects obviously malicious requests; list endpoints it must not touch in anomaly_bypass_paths.
  • Administrators can ban an IP or CIDR range in the admin or with hydro ban 203.0.113.0/24 --for 24h.
EndpointBuilt-in limit
Staff login and MFA code5 per minute
Password reset request3 per hour
E-mail verification3 per hour
Public form submission3 per hour
Form view beacon (POST /api/v1/forms/{form}/view)60 per minute
Member sign-in and registration10 per minute
Admin backup download3 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.

Behind a proxy or CDN, make sure client IPs reach HydroGo correctly, otherwise rate limits and bans apply to the proxy instead of visitors. For GeoIP headers, list the proxies you trust in 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_protection with allowed_referer_hosts keeps 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.