ppt-tool/backend
Vadym Samoilenko 4f391a04e8 Complete critical security improvements (P0.5-P0.8)
P0.5: Database Row-Level Security (RLS) - CRITICAL
- Created Alembic migration for RLS policies on all client-scoped tables
- Policies for: presentations, master_decks, brand_configs, slides, templates
- Updated get_async_session to set PostgreSQL session variables
- Multi-tenant isolation now enforced at database level (defense-in-depth)
- Session variables: app.current_user_id, app.user_role

P0.6: Safe Error Messages
- Created safe_exception_handler to prevent info disclosure
- Logs full errors internally with context (user_id, path, method)
- Returns generic "internal error" message to clients
- Preserves HTTPException details (intentional error messages)

P0.7: Security Headers
- Created SecurityHeadersMiddleware with comprehensive headers
- Headers: X-Content-Type-Options, X-Frame-Options, X-XSS-Protection
- CSP, Referrer-Policy, Permissions-Policy, HSTS
- Updated nginx.conf with matching security headers

P0.8: Database Connection Pool Optimization
- Increased pool_size from 5 to 20 connections
- Added max_overflow of 40 for burst traffic
- Enabled pool_pre_ping for connection health checks
- Pool recycle after 1 hour to prevent stale connections
- Configurable via DB_POOL_SIZE, DB_MAX_OVERFLOW, DB_POOL_RECYCLE

All critical pre-launch security tasks complete. System now has:
 CORS protection
 Rate limiting
 Request size limits
 Database-level tenant isolation (RLS)
 Safe error handling
 Security headers
 Optimized connection pooling

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-02-27 18:33:58 +00:00
..
alembic/versions Complete critical security improvements (P0.5-P0.8) 2026-02-27 18:33:58 +00:00
api Complete critical security improvements (P0.5-P0.8) 2026-02-27 18:33:58 +00:00
assets Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
constants Phase 2: Admin panel, analytics, storage, template pipeline, multi-provider LLM 2026-02-26 23:39:34 +00:00
enums Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
migrations Phase 3: Bug fixes, feature enhancements, and polish 2026-02-27 12:58:52 +00:00
models Implement critical security fixes and modern design system (Pre-launch P0 tasks) 2026-02-27 18:28:24 +00:00
scripts Phase 2: Admin panel, analytics, storage, template pipeline, multi-provider LLM 2026-02-26 23:39:34 +00:00
services Complete critical security improvements (P0.5-P0.8) 2026-02-27 18:33:58 +00:00
static Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
tests Rebrand Presenton to Oliver DeckForge, pre-configure models, use NanoBanana Pro 2026-02-26 18:17:11 +00:00
utils Complete critical security improvements (P0.5-P0.8) 2026-02-27 18:33:58 +00:00
workers Phase 3: Bug fixes, feature enhancements, and polish 2026-02-27 12:58:52 +00:00
.python-version Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
alembic.ini Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
Dockerfile Phase 4: Fix critical bugs, improve document parsing, add vision OCR 2026-02-27 14:07:00 +00:00
mcp_server.py Rebrand Presenton to Oliver DeckForge, pre-configure models, use NanoBanana Pro 2026-02-26 18:17:11 +00:00
openai_spec.json Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
pyproject.toml Implement critical security fixes and modern design system (Pre-launch P0 tasks) 2026-02-27 18:28:24 +00:00
server.py Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00
uv.lock Phase 1-2: Foundation + Admin Panel & Client Management 2026-02-26 15:37:17 +00:00