Módulo Horario ships with sensible defaults, but several controls require explicit configuration before a deployment is production-ready. This page walks through each security domain, explains the expected configuration, and provides a checklist you can work through before going live.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Luisanchez0/modulo_Horario/llms.txt
Use this file to discover all available pages before exploring further.
Secrets management
Secrets management
Never commit Production (AWS Secrets Manager):Then reference secrets from Docker Compose using the
.env files or hardcode secrets in source code. The repository’s .gitignore excludes .env, but you must verify this is in place before every push.Local development:/run/secrets/ path rather than plain environment variables.Rotation schedule: Rotate all production secrets every 30 days.HTTPS and TLS
HTTPS and TLS
HTTPS is optional in local development and mandatory in production. Running production traffic over plain HTTP exposes tokens and credentials to network interception.Set up Let’s Encrypt with Nginx:Redirect HTTP to HTTPS and add security headers:
The
Strict-Transport-Security header tells browsers to always use HTTPS for your domain for one year, even if the user types http://. Add it only after you are certain HTTPS is working correctly.Rate limiting
Rate limiting
Rate limits protect the login endpoint from brute-force attacks and protect API endpoints from abuse. Configure these in Nginx for production.Login endpoint — 5 requests per minute per IP:General API endpoints — 100 requests per minute per IP:When the limit is exceeded, the API returns
429 Too Many Requests.CORS configuration
CORS configuration
CORS must be restricted to your actual frontend domain in production. A wildcard origin (
*) allows any website to make credentialed requests to your API.Pydantic input validation
Pydantic input validation
All request bodies pass through Pydantic schemas before reaching business logic. Invalid input—wrong types, missing required fields, malformed emails, strings that are too short or too long—is rejected automatically with
422 Unprocessable Entity.You do not need to add manual validation guards in route handlers. Rely on schema definitions and add field validators for domain-specific rules:SQL injection prevention
SQL injection prevention
SQLAlchemy’s ORM parameterizes all queries automatically. User-supplied values are passed as bound parameters, never interpolated into the query string.Never construct queries by string formatting:If
docente_id were 1; DROP TABLE horarios; --, the string-formatted version would execute the destructive statement. The ORM version would look for a record with that literal string as an ID and find nothing.XSS prevention
XSS prevention
React escapes all dynamic values rendered into the DOM. A payload like
<script>alert('xss')</script> is rendered as the escaped string <script>alert('xss')</script>, not as executable HTML.The backend returns JSON, not HTML, so API responses are also safe from injection by default. Do not use dangerouslySetInnerHTML unless you have explicitly sanitized the content first.Safe logging
Safe logging
Log user IDs and IP addresses for audit trails. Never log passwords, tokens, or secrets.In production, write logs to a rotating file (
RotatingFileHandler) and use JSON format for compatibility with ELK Stack or similar log aggregation systems.Pre-deployment checklist
Work through this list before every production deployment. Before development:- Run
bash setup-secrets.shto generate local secrets - Confirm
.envis listed in.gitignore - Confirm
.envdoes not appear ingit status
- Run
git diff --cached | grep -i "password\|secret\|key"— output should be empty - Confirm no
.envfile is tracked:git status | grep ".env"should return nothing
- Regenerate all secrets in AWS Secrets Manager
- Configure HTTPS in Nginx with a valid Let’s Encrypt certificate
- Enable rate limiting for
/auth/login(5 req/min) and general API routes (100 req/min) - Set
CORS_ALLOW_ORIGINSto your production domain — never* - Configure centralized, structured logging
- Run a security smoke test against the deployed environment
- Review access logs for anomalies
- Check rate-limiting alert counts
- Review failed login attempt trends
- Verify SSL certificate expiry date
- Rotate all secrets
- Audit and patch dependencies
- Conduct a security review
- Test backup and restore procedures