Issue #4411✓ SolvedOpened Jun 27, 2022by zgeist2 reactions

XSS when add class name to Selector Manager

Quick answerby artf2

Thanks for the report, will be fixed in the next release.

Read full answer below ↓

Question

GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v102 Reproducible demo link https://jsfiddle.net/szLp8h4n Describe the bug How to reproduce the bug?Select any componentAdd 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 C...

Answers (4)

👍 Most helpfulartfJun 27, 2022

Thanks for the report, will be fixed in the next release.

RawneJun 27, 2022

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.

zgeistJun 27, 2022

Thanks a lot!

GJSBlockMay 17, 2026

Thanks for reporting this, @zgeist. Security and dependency issues are important. The GrapesJS team actively works on keeping dependencies up-to-date. For you right now: Run npm audit fix to see available patches Check for a newer GrapesJS version that may have already addressed this If available,...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.