Skip to content

Commit e5396c3

Browse files
committed
fix: sanitize messages in notification component
1 parent 9ab87bf commit e5396c3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ electron-app/traces
2020
inols*.log
2121
# The electron-builder output.
2222
electron-app/dist
23+
24+
build/

arduino-ide-extension/src/browser/theia/messages/notification-component.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from '@theia/core/shared/react';
22
import { NotificationComponent as TheiaNotificationComponent } from '@theia/messages/lib/browser/notification-component';
33
import { nls } from '@theia/core/lib/common';
44
import { codicon } from '@theia/core/lib/browser';
5+
import { sanitize } from 'dompurify';
56

67
export class NotificationComponent extends TheiaNotificationComponent {
78
override render(): React.ReactNode {
@@ -20,7 +21,7 @@ export class NotificationComponent extends TheiaNotificationComponent {
2021
/>
2122
<div className="theia-notification-message">
2223
<span
23-
dangerouslySetInnerHTML={{ __html: message }}
24+
dangerouslySetInnerHTML={{ __html: sanitize(message) }}
2425
onClick={this.onMessageClick}
2526
/>
2627
</div>

0 commit comments

Comments
 (0)