security: Add Authentication and Authorization to API Routes#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const mission = await missionRepository.create({ | ||
| prompt, | ||
| userId, | ||
| dashboardUrl, | ||
| dashboardType, |
There was a problem hiding this comment.
Register missions with execution service before running
Missions are now created via missionRepository (lines 34-38) but the executor (browserAgent.executeMission) still updates status and steps through the in-memory missionService. Because the mission is never inserted into missionService, every execution call throws “Mission not found” on the first updateStatus, so the async run fails immediately and no status/steps are persisted for any mission. The change effectively makes all mission executions fail right after creation. Consider adding the mission to the service used by the executor or switching the executor to use the repository-backed storage.
Useful? React with 👍 / 👎.
|
Closing PR - content was implemented but reverted by user preference. Available for reference. |
Summary
This PR addresses the critical security vulnerability where all API endpoints were completely open without authentication. All mission endpoints now require authentication, enforce role-based access control (RBAC), and implement user ownership checks.
Changes
requireAuthmiddleware to all mission endpointsmissionServiceto database-backedmissionRepositoryGET /api/missions/statsendpoint for user statisticsDELETE /api/missions/:idendpoint with ownership validationCreateMissionRequesttype to includedashboardUrl,dashboardType, andpriority/api/auth/register,/api/auth/login,/api/auth/refresh)Type of Change
Testing
Security Improvements
Checklist
Related Issues
Addresses Feature #2 from FEATURE_OPPORTUNITIES.md - Priority Score: 3.0 ⭐
Notes
/api/auth/*) are stubbed and return 501userIdin the database