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

Insufficient sanitization in rich text fields #14468

Open
patrys opened this issue Oct 25, 2023 · 2 comments
Open

Insufficient sanitization in rich text fields #14468

patrys opened this issue Oct 25, 2023 · 2 comments
Assignees
Labels
security Pull requests that address a security vulnerability

Comments

@patrys
Copy link
Member

patrys commented Oct 25, 2023

Currently, Saleor does very basic sanitization of Editor.js content through the SanitizedJSONField, but it's not enough to prevent malicious staff users from inlining JavaScript if a renderer recklessly uses it to set innerHTML of an element.

We should use a tool like bleach with a short list of allowed tags and attributes to make sure clean_text_data actually prevents scripting attacks.

@mmiszy said he could provide a list of tags and attributes that are necessary for Editor.js to function.

It's a hardening task, as any client should sanitize untrusted content, so we're keeping the ticket public and will not assign a CVE.

@patrys patrys added the security Pull requests that address a security vulnerability label Oct 25, 2023
@typeofweb typeofweb self-assigned this Oct 25, 2023
@typeofweb
Copy link
Contributor

It seems that the only tags that Editor.js uses in Saleor Dashboard are:

  • b
  • i
  • a[href]

@JPaulMora
Copy link

Bleach has since been deprecated (see here mozilla/bleach#698), people are migrating to nh3 wich seems very fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Pull requests that address a security vulnerability
Projects
None yet
Development

No branches or pull requests

3 participants