fix(security): prevent stored XSS in role notifications #4330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a Stored Cross-Site Scripting (XSS) vulnerability in the Role management feature. The vulnerability existed in the notification system when displaying role information (name and description) using dangerouslyUseHTMLString. Malicious input in these fields could execute arbitrary JavaScript in the browser.
Issue:
Stored XSS via name and description parameters.
Any user-controlled content in these fields could inject and execute scripts.
The vulnerability was triggered in the Vue notification component:
Fix:
Escaped HTML characters (<, >, &, ", ') in name and description using a simple pure JS escape function.
Prevented execution of user-supplied HTML while keeping the notification readable.
dangerouslyUseHTMLString is still used, but now all user-controlled values are sanitized.
Benefits:
Prevents XSS attacks in role notifications.
No third-party libraries needed; uses native JS string escaping.
Compatible with the existing Vue .vue component structure.
Example:
Before:
Role Name:
<img src=x onerror=alert(1)>→ Executes JS
After:
Role Name: <img src=x onerror=alert(1)>
→ Renders as plain text, safe to display
Testing:
Created a new role with malicious <script> or
in name and description.
Opened notifications — no scripts executed; all input rendered as text.
Confirmed existing roles display correctly.
