Issue in controllers/jobs.js
- Line 41:
findByIdAndUpdate
- Line 58:
findByIdAndRemove
These two methods currently retrieve a task by its ID without considering the user ID of the task creator. As a result, they can perform actions on tasks not owned by the user. To address this, it would be better to use findOneAndUpdate and findOneAndDelete instead.