BUG: XSS when add class name to Selector Manager
Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome v102
Reproducible demo link
Describe the bug
How to reproduce the bug?
- Select any component
- Add class name to Selector Manager like
<a href="#"onclick='alert(123)'>check</a> - After click on class name, you got alert
What is the expected behavior? Class name should be escaped
What is the current behavior? javascript run in class name
Need add escape function to template https://github.com/artf/grapesjs/blob/dev/src/selector_manager/view/ClassTagView.ts#L13
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (3)
Thanks for the report, will be fixed in the next release.
Also running into this XSS bug. For example adding "><img src=x onerror=alert('XSS')> to the classes of a component will cause it to pop up as well.
Thanks a lot!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6458
BUG: sector.setName doesn't work
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://jsfi...
Issue #5305
BUG: "component:add" event triggers when components are moved
GrapesJS version 0.21.4[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome Version 113.0.5672.63 Reproduc...
Issue #5487
BUG: Style Manager doesn't display multiple rules for the same class
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox Reproducible demo link https://jsf...
Issue #4323
BUG: Performance issue while dragging component to canvas when you have 2k component on canvas
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Google Chrome Version 101.0.4951.41 (Officia...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.