Skip to content

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

@mohyware

Description

@mohyware

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions