hagopj13 / hagopj13/node-express-boilerplate

An Authenticated User can update other users

Open
#174 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.