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

Where the user verification is done ? #44

Open
Zahma opened this issue Jun 9, 2020 · 3 comments
Open

Where the user verification is done ? #44

Zahma opened this issue Jun 9, 2020 · 3 comments

Comments

@Zahma
Copy link

Zahma commented Jun 9, 2020

Hello,
for this controller method, I would like to know where the verification of weither the user has the right to put into an article that is not his is done ?

@ApiOperation({ summary: 'Update article' })
@ApiResponse({ status: 201, description: 'The article has been successfully updated.'})
@ApiResponse({ status: 403, description: 'Forbidden.' })
@put(':slug')
async update(@param() params, @Body('article') articleData: CreateArticleDto) {
// Todo: update slug also when title gets changed
return this.articleService.update(params.slug, articleData);
}

@lujakob
Copy link
Owner

lujakob commented Jun 14, 2020

@Zahma
Copy link
Author

Zahma commented Jun 14, 2020

@lujakob can you please explain to me what it does ? because, what I understood is that it checks if the user connected to that route is authenticated thats all. IT does not check if the property of that article belongs to the authenticated user.
Meaning that if another user is authenticated he can access to this route & edit the article of another User.
Correct me if I'm wrong I probably missed something.

@lujakob
Copy link
Owner

lujakob commented Jun 17, 2020

@Zahma indeed, this user check is missing. Should be something like
https://github.com/gothinkster/node-express-realworld-example-app/blob/master/routes/api/articles.js#L153-L179

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

2 participants