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

Does using clientside integration expose policies? #197

Closed
maliiiith opened this issue May 30, 2019 · 7 comments
Closed

Does using clientside integration expose policies? #197

maliiiith opened this issue May 30, 2019 · 7 comments
Labels

Comments

@maliiiith
Copy link

I'm building a role based permission model with CASL to authorize endpoints in the server side. So if I integrate with the client side, would that expose all of my policies to the public?

If that's the case, wouldn't it be a security risk?

@stalniy
Copy link
Owner

stalniy commented May 30, 2019

Yes, it exposes user abilities inside your system.

I don’t think this is a security risk because anyway users know what they can do in your system. otherwise how can they use it?

@stalniy
Copy link
Owner

stalniy commented May 31, 2019

Also you don’t need to share all permissions but only user specific or role specific. So, each user knows only his own permissions

@maliiiith
Copy link
Author

Yes, it exposes user abilities inside your system.

I don’t think this is a security risk because anyway users know what they can do in your system. otherwise how can they use it?

I was going through another similar library and found this comment: onury/accesscontrol#62 (comment)

That's why I raised this question.

Also you don’t need to share all permissions but only user specific or role specific. So, each user knows only his own permissions

I have a shared package in a monorepo that holds all of the policy definitions. Importing that exposes all of defined abilities.

@stalniy
Copy link
Owner

stalniy commented May 31, 2019

Don’t share package (in this case you really expose a lot of info)! Instead you need to share permissions via API call. Some time ago I wrote an example of how to share permissions between ruby and js:
https://medium.com/dailyjs/casl-and-cancan-permissions-sharing-between-ui-and-api-5f1fa8b4bec

Someday you will need to allow admins to change permissions for different roles or users. And on that day, you will need to change both client and server. If you keep permissions logic on server, then you will not need to change client.

@stalniy
Copy link
Owner

stalniy commented May 31, 2019

Thanks for the link! I left a comment with my opinion on this topic in that thread :)

@maliiiith
Copy link
Author

Sorry for the delay! I just went through your article and it looks cool! I wasn't a fan of providing permissions via an API call. But I will look into it!

Thank you very much!

@stalniy
Copy link
Owner

stalniy commented Jun 3, 2019

If you share permissions (i.e., user actions, not roles) for a particular user then you don’t expose any sensitive info to client. You expose what client already knows about himself in the system. Also this allows to keep UX at the good level.

I think this issue may be closed now. Thanks for using CASL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants