You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ACL Allows Relation access even though DENY * #115
@bajtos it is reproducible. say we have two models, customers and reviews. if you create an acl that:
denies access to reviews only = you can still see reviews via a curl request to /api/customers/1/reviews, meaning the acl on relations are not enforced
denies access to customers and review = acl works properly and does not let the user access to api/customers/1 or /api/customers/1/reviews
I have just bumped into this issue and it is a major roadblock for us to get our server into production. I tried to track down the problem and would greatly appreciate your help. All I can say is that the before.** event is never fired for second level endpoints (/model/:id/relatedModel). Since the application.js calls Model.checkAccess on this event, the entire ACL evaluation is disabled for those remotes. Clearly, those second level remotes must be setup differently than the first level remotes. Are those second level remotes maybe created after the eventhandler is registered?
Any hint would be greatly appreciated.
I have just bumped into this issue and it is a major roadblock for us to get our server into production. I tried to track down the problem and would greatly appreciate your help. All I can say is that the before.** event is never fired for second level endpoints (/model/:id/relatedModel).
I don't think this is correct. Or to be specific I don't think you are attaching your before hook to the correct model. Consider this endpoint:
/customers/1/reviews
This calls the Customers.prototype.__get__reviews method. It triggers the Customers before hook (not the Reviews). I have just confirmed this with loopback@2.17.2.
A potential issue (depending on how you expect ACL to work) is that the set of Review access controls are not applied when accessing Review through a relation. Only the Customer ACL is enforced.
Activity
bajtos commentedon Oct 15, 2014
@superkhau could you help us here and check if strongloop/loopback-example-access-control#2 can be still reproduced in loopback 2.x?
superkhau commentedon Oct 29, 2014
@bajtos it is reproducible. say we have two models,
customersandreviews. if you create an acl that:/api/customers/1/reviews, meaning the acl on relations are not enforcedapi/customers/1or/api/customers/1/reviewsraymondfeng commentedon Oct 29, 2014
What is your ACL?
superkhau commentedon Oct 29, 2014
hotaru355 commentedon Apr 13, 2015
I have just bumped into this issue and it is a major roadblock for us to get our server into production. I tried to track down the problem and would greatly appreciate your help. All I can say is that the
before.**event is never fired for second level endpoints (/model/:id/relatedModel). Since theapplication.js calls
Model.checkAccesson this event, the entire ACL evaluation is disabled for those remotes. Clearly, those second level remotes must be setup differently than the first level remotes. Are those second level remotes maybe created after the eventhandler is registered?Any hint would be greatly appreciated.
ritch commentedon May 7, 2015
I don't think this is correct. Or to be specific I don't think you are attaching your
beforehook to the correct model. Consider this endpoint:This calls the
Customers.prototype.__get__reviewsmethod. It triggers theCustomersbefore hook (not theReviews). I have just confirmed this withloopback@2.17.2.A potential issue (depending on how you expect ACL to work) is that the set of
Reviewaccess controls are not applied when accessingReviewthrough a relation. Only theCustomerACL is enforced.ritch commentedon Jun 1, 2015
I'm closing this as its no longer an issue.
Improvements will come to relation access control. Keep an eye on #1362