Skip to content

Commit

Permalink
Merge pull request #1529 from bartbutenaers/notification-injected-css…
Browse files Browse the repository at this point in the history
…-fix

Notification: sanetized style fix
  • Loading branch information
joepavitt authored Dec 11, 2024
2 parents b32cdc3 + c992878 commit 23e82cd
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 23e82cd

Please sign in to comment.