Practical baseline guidance for secure operation of NextPress.
Run regularly (for example weekly and before release):
make security-check
go list -m -u allmake security-checkrunsgovulncheckagainst project packages.- Review actionable findings and upgrade affected modules.
CORS_ORIGINS controls allowed origins. Keep it explicit in production:
- Production: set exact origins (comma-separated), e.g.
https://app.example.com,https://admin.example.com. - Local/dev: empty
CORS_ORIGINSallows all origins for faster iteration.
Operational notes:
- When
CORS_ORIGINSis set, credentials are allowed and response headers are constrained. - When unset, wildcard behavior is enabled and browser credentials are incompatible by design.
- Prefer terminating public traffic through Nginx and applying TLS before the app.
- Start with conservative
RATE_LIMIT_*values from.env.example. - Keep separate limits for public, auth, and admin scopes.
- Verify behavior with automated tests in
internal/platform/middleware/rate_limit_test.go. - Re-tune limits based on real traffic and error rate telemetry.
Current implementation uses one signing secret (JWT_SECRET) for access and refresh tokens.
Recommended rotation process:
- Announce maintenance window for token invalidation.
- Set new
JWT_SECRETand redeploy API instances. - Invalidate old refresh tokens (users re-authenticate).
- Verify new token issuance and refresh flows.
Future enhancement path:
- Add support for key IDs (
kid) and multi-key verification window for zero-downtime rotation.