This document outlines the security implementations in the payNEXT architecture.
- HTTPS Enforcement: Caddy automatically provisions Let's Encrypt SSL certificates and redirects all HTTP traffic to HTTPS.
- Security Headers:
helmet.jsis configured globally to set secure HTTP headers (HSTS, X-Frame-Options, etc.).
- Rate Limiting: Authentication endpoints (
/api/v1/auth/login,/register) are restricted to 5 requests per 15 minutes per IP to prevent brute-force attacks. - CORS: Strict origin whitelisting is enforced. Only
https://paynextt.meandhttp://localhost:8080are permitted.
- SQL Injection: All PostgreSQL queries use parameterized inputs via the
pglibrary. - XSS & Data Sanitization:
express-validatoris used to trim, escape, and validate all incoming user inputs before processing.
- Reverse Proxy: Caddy acts as the single entry point, routing
/api/*to the backend and/to the Nginx frontend. - Load Balancing: The API service can be scaled horizontally (
docker-compose up --scale api=2). Caddy distributes traffic across instances using around_robinpolicy.
See the repository wiki or run the provided curl commands in TESTING.md to verify rate limiting, CORS, and header configurations.