-
-
Notifications
You must be signed in to change notification settings - Fork 912
SubResource and security #1649
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
Comments
Something might be missing here as the
I think that you need to add a context for the subresource on the subresource operation name. |
I added I would have preferred an check with A being the Thanks for the reply, and a documentation about this would be also helpful. Edit: I think I can work around it by creating a new expression language function which checks every item of the paginator. |
Won't performances be slightly decreased by that? I think we had a recent issue about this and the paginator. Anyway I'd like this to be consistent with how the grant on |
It will, and it's why it has been done this way initially. It may also break the pagination. If you want to check something for all rows, better use an extension to tweak the SQL query. |
We may add a |
Meh shouldn't we enforce users to do proper querying instead? Even an additionnal query to check if the user has the given rights seems better then checking a whole collection to me. |
Any news on this? /A/id => Access granted |
Really can't understand why "object" is a Paginator instance. I think "object" should be a Student instance, instead. How can I secure the subresource with a Paginator object? |
For now, and because it is a complex issue if we don't want to introduce bad design I really suggest that you add an event listener ( Yes, it's convenient to directly use the |
Could you please provide a short example on how to perform the security
check in the event listener?
Thank you
Il giorno mar 21 ago 2018 alle ore 14:09 Antoine Bluchet <
[email protected]> ha scritto:
… For now, and because it is a complex issue if we don't want to introduce
bad design I really suggest that you add an event listener (PRE_READ for
example) that checks if the user has access to the request.
Yes, it's convenient to directly use the access_control but it's not that
easy to implement on subresources and will definitely take time.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1649 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aomk7KbgKIR7prPyXlyApLrUTYjL3u1Oks5uS_iOgaJpZM4Rebtl>
.
|
@matlar83 I am going through the same process and I wonder if you were able to write your access rules in the |
@soyuka also, a weird thing to note is that using |
|
Tell me if I did a mistake. In the
Otherwise if we need more complicated access control, we should use some events. |
Maybe is too late but I did it by passing the id to the voter with this
And then in the Voter
This is useful if the ID is a UUID object instead an integer, for example |
Closing in favor of #2706 |
I have entities A with one-to-many B, B is defined as a SubResource in A.
Both A and B have security checks which ensure that:
The following routs work as excepted (regular user):
/A (no access)
/A/id (only possible for own id)
/B (no access)
/B/id (only possible if A has your own id)
But the collection built by the SubResource is not restricted:
/A/id/B (can be accessed by everyone)
How can it be secured?
Code for security so far:
The text was updated successfully, but these errors were encountered: