fix: sanitize message in notification component (#2664)

fix: sanitize messages in notification component
This commit is contained in:
Christian Sarnataro 2025-03-24 11:42:48 +00:00 committed by GitHub
parent 9ab87bf8b5
commit d298b3ffc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ import React from '@theia/core/shared/react';
import { NotificationComponent as TheiaNotificationComponent } from '@theia/messages/lib/browser/notification-component';
import { nls } from '@theia/core/lib/common';
import { codicon } from '@theia/core/lib/browser';
import { sanitize } from 'dompurify';
export class NotificationComponent extends TheiaNotificationComponent {
override render(): React.ReactNode {
@ -20,7 +21,7 @@ export class NotificationComponent extends TheiaNotificationComponent {
/>
<div className="theia-notification-message">
<span
dangerouslySetInnerHTML={{ __html: message }}
dangerouslySetInnerHTML={{ __html: sanitize(message) }}
onClick={this.onMessageClick}
/>
</div>