1.6 KiB
1.6 KiB
trigger
| trigger |
|---|
| always_on |
Security Rules (Non-Negotiable)
Mandatory Security Requirements
- Idempotency: All critical
POST/PUT/PATCHMUST validateIdempotency-Keyheader - Two-Phase File Upload: Upload → Temp → Commit → Permanent
- Race Conditions: Redis Redlock + TypeORM
@VersionColumnfor Document Numbering - Validation: Zod (frontend) + class-validator (backend DTO)
- Password: bcrypt 12 salt rounds, min 8 chars, rotate every 90 days
- Rate Limiting:
ThrottlerGuardon all auth endpoints - File Upload: Whitelist PDF/DWG/DOCX/XLSX/ZIP, max 50MB, ClamAV scan
- AI Isolation (ADR-018): Ollama on Admin Desktop ONLY — NO direct DB/storage access
- Error Handling (ADR-007): Use layered error classification with user-friendly messages
- AI Integration (ADR-020): RFA-First approach with unified pipeline architecture
- AI Audit Trail: Log all AI interactions and human validations
- Rate Limiting: Apply to AI endpoints to prevent abuse
Full Documentation
specs/06-Decision-Records/ADR-016-security-authentication.md
Security Checklist (Before Every Commit)
- Input validation implemented (Zod/class-validator)
- RBAC/CASL permissions checked
- No SQL injection vulnerabilities
- File upload validation (whitelist + ClamAV)
- Rate limiting applied to auth endpoints
- AI boundary enforcement (ADR-018) - no direct DB/storage access
- AI audit logging implemented for AI interactions
- Error handling follows ADR-007 layered classification
- OWASP Top 10 review passed