-
Notifications
You must be signed in to change notification settings - Fork 108
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
Updated Recommendations for CSP and Avoiding 'unsafe-eval' #156
Comments
I'll do a quick test. |
For resources self deployment:
I guess this is why you failed to load === As for CSP, I failed to remove 'unsafe-eval' in my test. === Your approach should be the most reasonable one, exposing only the scan barcode page to a looser CSP and ensuring strict security for other pages. Also refer: https://stackoverflow.com/questions/9522348/add-custom-header-based-on-file-type |
Thank you for taking a look at this. We do set the engineResourcePaths
I will try with looking more into custom headers. |
As it is overly complex, Some months ago, I suggested to remove this from the guide and only keep the usage of == If you still have problem loading You can check CSP in https://github.com/dynamsoft-rd-0/dbrjs-mass-samples/blob/master/CSP-for-dbrjs10.4.3100.html. You can remove all |
Good news, @rujep e.g. |
The dynamsoft demos online are not self-hosted, but that shouldn't really matter when it comes to whether Based on my testing, it seems I applied the following CSP without
(Note the When I added
|
Sorry for the lack of feedback the last few days. I created this issue because it wasn't easy to find anything on it in existing documentation and wanted to know if I was missing something obvious, as well as hopefully have the team looking into the possibility of only requiring |
I had the same idea as you at first. But I verified my colleague's discovery, and indeed, I guess @rujep I'll try to give you a sample, with all resources self-host and nodejs server (any server is OK. Sorry for rely late because of my vacation. |
The code generated by the wasm compiler (emsdk) naturally has |
Please try this zip. Node.js as server. |
I will continue to try to solve it perfectly after vacation (one week left). It is expected to be time-consuming and require research compilation and detailed usage for emsdk. I can't predict the time, please don't wait for me. ❤ |
@Keillion Thank you for your efforts. I will try the zip later today. |
I believe you have received a response from our technical support. For the completeness of this issue, I still put the zip package that solves the problem here. Here I use nodejs as server. You can find CSP rules in The relevant solution is expected to be included in the next major version. |
Hello Dynamsoft Team,
We are a team developing an Angular web app with PWA capabilities and are integrating the dynamsoft-barcode-reader-bundle (version 10.4.3100). Our application hosts the required Dynamsoft resources locally to ensure quick and seamless caching via our service worker. These resources include the following:
Currently, we are concerned about having to use 'unsafe-eval' in our Content Security Policy (CSP). Our CSP configuration is defined in a web.config file and looks like this:
This setup works but requires 'unsafe-eval' for the library to function, which we would like to avoid for security reasons. Ideally, we aim to:
We came across Issue #102 from October 2021, which provides minimum CSP requirements. However, that post is over three years old, and we were wondering if there have been any updates since then.
Additionally, we attempted to set CSP-specific rules for Dynamsoft files by using
<location>
nodes in web.config:Unfortunately, this approach resulted in an error when trying to load core.worker.js.
Questions:
Thank you for your guidance and support!
Best regards,
Rune
The text was updated successfully, but these errors were encountered: