security(push): sanitize message-editor content before rendering into the editor - #7968
Closed
ar2rsawseen wants to merge 1 commit into
Closed
security(push): sanitize message-editor content before rendering into the editor#7968ar2rsawseen wants to merge 1 commit into
ar2rsawseen wants to merge 1 commit into
Conversation
…contenteditable The push message editor set the composed message as innerHTML on a live contenteditable. Sanitize that content with countlyCommon.encodeSomeHtml, allowing only the user-property token span (and the attributes it relies on: class, id, contenteditable, data-user-property-*) and escaping any other markup to inert text. The message body is user text and the token element is the only legitimate markup, so display is unchanged for normal messages; the token id is preserved so the editor's per-token event wiring keeps working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Aug 19, 2026
Member
Author
|
Superseded by #7970, which consolidates the frontend HTML-sink hardening into a single per-repo PR. The same change (same authorship) is included there. Closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The push message editor set the composed message as
innerHTMLon a livecontenteditableelement. This routes it throughcountlyCommon.encodeSomeHtml(the samefilterXSSsanitizer the note widget uses), with an allowlist restricted to the user-property token<span>and the attributes it depends on (class,id,contenteditable,data-user-property-*). Any other markup is escaped to inert text.The message body is user text and the token span is the only legitimate markup, so display is unchanged for normal messages. The token
idis preserved, so the editor's per-token event wiring (addEventListeners→querySelector("#id-N")) keeps working. Verified the allowlist deterministically: token attributes and text survive; other tags are escaped.Note: this touches the message-composer UI, so a quick manual check of composing/editing a notification with a personalization token is worthwhile before merge (it could not be exercised in an automated frontend test here).
🤖 Generated with Claude Code