Date: December 16, 2025 Status: Planning Phase Last Updated: December 16, 2025
This document outlines the remaining work required to make the MWM project production-ready. Based on comprehensive code review and exploration, the following areas need attention:
| Priority | Category | Items |
|---|---|---|
| P0 (Critical) | Security | CSRF Protection, httpOnly Cookies |
| P1 (High) | Features | Resume File Upload, Comments System |
| P2 (Medium) | Features | Save/Bookmark Posts, Rate Limiting |
| P3 (Low) | Enhancements | CSP Headers, Additional Tests |
Current State: JWT tokens stored in localStorage (XSS vulnerable) Target State: Tokens stored in httpOnly cookies
Files to Modify:
backend/src/controllers/auth.controller.ts- Set cookies on login/refreshbackend/src/middlewares/auth.middleware.ts- Read tokens from cookiesbackend/src/app.ts- Configure cookie parserfrontend/src/lib/api.ts- Remove localStorage token handlingfrontend/src/providers/AuthProvider.tsx- Update auth state management
Implementation Steps:
- Install
cookie-parserin backend - Configure cookie options (httpOnly, secure, sameSite, maxAge)
- Update login/register/refresh to set cookies
- Update auth middleware to read from cookies
- Update logout to clear cookies
- Update frontend to rely on cookies (withCredentials: true)
- Remove localStorage token storage
Current State: No CSRF protection on forms Target State: All state-changing requests validated with CSRF tokens
Files to Modify:
backend/src/app.ts- Add CSRF middlewarebackend/src/controllers/auth.controller.ts- Include CSRF token in responsesfrontend/src/lib/api.ts- Include CSRF token in headers- All frontend forms - Include CSRF token
Implementation Steps:
- Install
csurfor implement custom CSRF tokens - Generate CSRF tokens on session start
- Send CSRF token in response header or meta tag
- Include CSRF token in all POST/PUT/DELETE requests
- Validate CSRF tokens on server
Current State: Resume field accepts URL only (Google Drive/Dropbox links) Target State: Direct file upload with cloud storage
Files to Modify:
backend/src/models/JobApplication.ts- Update schema for file metadatabackend/src/controllers/careers.controller.ts- Handle file uploadbackend/src/routes/careers.routes.ts- Add multer middlewarefrontend/src/app/[locale]/careers/[slug]/page.tsx- File input component
Implementation Steps:
- Configure Cloudinary/S3 for file storage
- Add multer middleware for multipart form handling
- Create file upload endpoint with validation (PDF, DOC, max 5MB)
- Update frontend form to use file input
- Store file URL and metadata in database
- Add file preview/download functionality
Current State: UI placeholder only, no backend Target State: Full commenting system with moderation
Files to Create:
backend/src/models/Comment.ts- Comment schemabackend/src/controllers/comment.controller.ts- CRUD operationsbackend/src/routes/comment.routes.ts- API endpointsbackend/src/validations/comment.validation.ts- Input validationfrontend/src/components/blog/CommentSection.tsx- Comment UIfrontend/src/services/public/comment.service.ts- API client
Comment Model Schema:
{
post: ObjectId (ref: BlogPost),
author: { name, email, website? },
content: string,
status: 'pending' | 'approved' | 'rejected' | 'spam',
parentComment?: ObjectId (for replies),
likes: number,
isEdited: boolean,
createdAt, updatedAt
}Implementation Steps:
- Create Comment model with moderation status
- Create comment controller with CRUD + moderation
- Add routes with validation
- Create admin comment management page
- Build frontend comment section component
- Add email notifications for new comments
- Implement spam detection (optional)
Current State: UI button exists, no functionality Target State: Users can save posts for later reading
Files to Modify:
backend/src/models/User.ts- Add savedPosts arraybackend/src/controllers/blog.controller.ts- Add save/unsave endpointsbackend/src/routes/blog.routes.ts- Add save routesfrontend/src/app/[locale]/blog/[slug]/page.tsx- Connect save buttonfrontend/src/services/public/blog.service.ts- Add save API calls
Implementation Steps:
- Add
savedPosts: [ObjectId]to User model - Create POST
/blog/:slug/saveendpoint - Create DELETE
/blog/:slug/saveendpoint - Create GET
/users/me/saved-postsendpoint - Update frontend to toggle save state
- Add "My Saved Posts" page
Current State: Basic rate limiting via express-rate-limit Target State: Granular rate limiting per endpoint type
Files to Modify:
backend/src/middlewares/rateLimit.middleware.ts- Create rate limitersbackend/src/routes/*.routes.ts- Apply appropriate limiters
Rate Limit Configuration:
const rateLimiters = {
auth: { windowMs: 15 * 60 * 1000, max: 5 }, // Login: 5 per 15 min
register: { windowMs: 60 * 60 * 1000, max: 3 }, // Register: 3 per hour
contact: { windowMs: 60 * 60 * 1000, max: 5 }, // Contact: 5 per hour
api: { windowMs: 60 * 1000, max: 100 }, // General: 100 per minute
};Files to Modify:
backend/src/app.ts- Add CSP middlewarefrontend/next.config.js- Add CSP headers
CSP Policy:
{
'default-src': ["'self'"],
'script-src': ["'self'", "'unsafe-inline'", "https://www.google.com"],
'style-src': ["'self'", "'unsafe-inline'"],
'img-src': ["'self'", "data:", "https://res.cloudinary.com"],
'font-src': ["'self'"],
'connect-src': ["'self'", "https://api.example.com"],
'frame-src': ["https://www.youtube.com", "https://player.vimeo.com"],
}File: frontend/src/components/admin/__tests__/Careers.test.tsx
Issue: Test suite is skipped due to mock/async rendering issues
Action: Refactor tests to use proper mocks
- Day 1-2: Implement httpOnly cookies for JWT
- Day 3-4: Implement CSRF protection
- Day 5: Testing and bug fixes
- Day 1-2: Resume file upload
- Day 3-5: Comments system (backend + frontend)
- Day 1: Save/bookmark posts
- Day 2: Rate limiting
- Day 3: CSP headers
- Day 4-5: Testing and documentation
- Auth service - cookie handling
- CSRF middleware
- Comment controller
- File upload validation
- Full auth flow with cookies
- Comment creation and moderation
- File upload end-to-end
- Login/logout with cookies
- Job application with resume upload
- Blog post commenting
- Environment variables configured for production
- CORS origins updated for production domains
- Cookie domain configured
- SSL certificates installed
- Database indexes created
- Redis configured for session/cache
- CDN configured for static assets
- Monitoring and alerting set up
- Backup strategy implemented
- CI/CD pipeline passing
- All security changes should be implemented together to avoid breaking auth
- Test thoroughly in staging before production deployment
- Consider feature flags for gradual rollout of new features
- Monitor error rates after each deployment
Plan prepared by: Claude Code Approved by: [Pending] Target Completion: [TBD]