Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification: sanetized style fix #1529

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ui/src/widgets/ui-notification/UINotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ export default {
value: function () {
// Get the value (i.e. the notification text content) from the last input msg
const value = this.messages[this.id]?.payload
// Sanetize the html to avoid XSS attacks
return DOMPurify.sanitize(value)

// Sanetize the html to avoid XSS attacks.
// Allow 'style' tags to allow styling of the notification content.
// The FORCE_BODY is required to avoid 'style' tags (at the start of the value string) still being skipped.
const sanetizedValue = DOMPurify.sanitize(value, { ADD_TAGS: ['style'], FORCE_BODY: true })
return sanetizedValue
},
allowConfirm () {
return this.getProperty('allowConfirm')
Expand Down
Loading