hagopj13 / hagopj13/node-express-boilerplate
An Authenticated User can update other users
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
```
router
.route('/:userId')
.patch(auth(), validate(userValidation.updateUser), userController.updateUser);
```
The above endpoint allows an authenticated user to update another user.
How can we restrict a user updating another user's data but allow updating his data?
Contributor guide
Research direction
Start with the shown PATCH /:userId route and trace auth(), userValidation.updateUser, and userController.updateUser. Check how the authenticated user's identity is exposed and how the controller selects the target user. Done means an authenticated user can update their own data but receives an authorization failure when targeting another user.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, mongodb, node.js
- Domain
- api, authorization, backend, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100