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

Symfony: Add authorization constraints on entities #67

Open
malkusch opened this issue Dec 9, 2015 · 6 comments
Open

Symfony: Add authorization constraints on entities #67

malkusch opened this issue Dec 9, 2015 · 6 comments

Comments

@malkusch
Copy link
Contributor

malkusch commented Dec 9, 2015

Currently users can view, edit and delete entities of other users:

  1. Login as User-1
  2. Create pad and remember id of that pad from URI.
  3. Login as User-2
  4. With the pad id from 2. you can view and edit the pad.

Deleting the pad doesn't work, but unfortunately deleting the note of another user does.

The authenticated user should be checked against the owner of entities.

@malkusch malkusch changed the title Add authorization constraints on entities Symfony: Add authorization constraints on entities Dec 9, 2015
@aminemat
Copy link
Contributor

Why would you want to do that @malkusch ?
are you proposing to create an admin role that can manage users ?

@malkusch
Copy link
Contributor Author

Sorry, I was not clear enough. I updated the description above to be more clear about the issue.

@aminemat
Copy link
Contributor

Oh I see, thanks for reporting this, I will make the necessary changes.

@komarserjio
Copy link
Owner

The easy solution is to find an entity based on two params: entity id + user id. So nothing is found if an entity is requested by not an owner.
Example: https://github.com/komarserjio/notejam/blob/master/cakephp/notejam/src/Controller/NotesController.php#L135

@malkusch
Copy link
Contributor Author

@komarserjio Now that you mention it, is NotesController::create() protected against a post request with a pad id from another user's pad?

@komarserjio
Copy link
Owner

Good point. No, there is no protection from another user's pad.
This case should be added as a unit test and implemented across all apps.

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

3 participants