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

Issues with Content Security Policy #234

Closed
kailashrdave opened this issue Nov 13, 2019 · 6 comments
Closed

Issues with Content Security Policy #234

kailashrdave opened this issue Nov 13, 2019 · 6 comments

Comments

@kailashrdave
Copy link

We are using CASL for our project to check permissions.
recently we encountered that there are some issues with CSP in our application.
Going further, we found that it is because of sift.js which has something like following in javascsript...

return"string"==typeof e?new Function("obj","return "+e)

CASL uses "sift" for Mongo DB like filters in javascript.
I tried to go through CASL documentation, but found nothing related to CSP or Security.
Has anybody got this issue before? Is it possible to fix this without adding "unsafe-eval"

image

following is the code snippet from stif.js which causes problem

image

@stalniy
Copy link
Owner

stalniy commented Nov 13, 2019

That’s a problem. I had requested support for using only specific operators some time ago but there is no progress. crcn/sift.js#153

So what we can do right now:

  1. Please create a CSP issue for sift.js
  2. Use unsafe-eval as a temporary solution
  3. If author doesn’t respond in a day I will fork sift and publish a csp-compliant version.

Thanks for the issue!

@kailashrdave
Copy link
Author

@stalniy thanks for prompt response..
I have created issue for stift.js #166

@stalniy
Copy link
Owner

stalniy commented Dec 3, 2019

Ok, I can do a quick fix and a separate @casl/[email protected] which will be csp compliant.

Eventually I plan to contribute either to mingo or sift to allow users to specify which operators they want to use. So, then the issue won't be relevant

@stalniy
Copy link
Owner

stalniy commented Dec 6, 2019

Agreed with sift author to integrate CSP support into his library :) waiting for him to merge my PR

@stalniy
Copy link
Owner

stalniy commented Dec 7, 2019

sift is published, will try to update and publish casl tomorrow (there may be some issues to update sift to the latest version and if so, then I will publish a preview version of @casl/ability which you will be able to use temporarly).

@stalniy stalniy closed this as completed in e3eafbb Dec 9, 2019
stalniy added a commit that referenced this issue Dec 9, 2019
@stalniy
Copy link
Owner

stalniy commented Dec 9, 2019

available in @casl/[email protected]

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

No branches or pull requests

2 participants