Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

06-jobs-api: Unauthorized Users Can Edit and Delete Other Users' Jobs #85

Open
mohyware opened this issue Sep 25, 2024 · 0 comments
Open

Comments

@mohyware
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant