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

Strict CSP issue with onclick #3431

Open
ganeddact opened this issue Nov 1, 2024 · 0 comments
Open

Strict CSP issue with onclick #3431

ganeddact opened this issue Nov 1, 2024 · 0 comments
Assignees
Labels

Comments

@ganeddact
Copy link

Preconditions

Apply a strict CSP, not allowing inline event handlers

Magento Version : 2.4.6-p8

ElasticSuite Version : 2.11.9.2

Environment : developer

Third party modules :

Steps to reproduce

  1. Have a multiselect filter attribute in a category page
  2. Select one checkbox
  3. Check the console

Expected result

  1. Filter should apply

Actual result

  1. No filtering applies
  2. Console log reports "Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src .."

Looks like in vendor/smile/elasticsuite/src/module-elasticsuite-catalog/view/frontend/web/template/attribute-filter.html on line 15 there is an onclick event that does not sit well with this strict CSP.
Unrelated to the above, there is another one in line 28 in vendor/smile/elasticsuite/src/module-elasticsuite-catalog/view/frontend/templates/layer/filter/default.phtml

Inline onclicks are generally considered bad practice, and should be replaced by event handlers.

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

3 participants