Skip to content

security(push): sanitize message-editor content before rendering into the editor - #7968

Closed
ar2rsawseen wants to merge 1 commit into
masterfrom
security/push-editor-sanitize
Closed

security(push): sanitize message-editor content before rendering into the editor#7968
ar2rsawseen wants to merge 1 commit into
masterfrom
security/push-editor-sanitize

Conversation

@ar2rsawseen

Copy link
Copy Markdown
Member

The push message editor set the composed message as innerHTML on a live contenteditable element. This routes it through countlyCommon.encodeSomeHtml (the same filterXSS sanitizer 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 id is preserved, so the editor's per-token event wiring (addEventListenersquerySelector("#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

…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>
@ar2rsawseen

Copy link
Copy Markdown
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.

@ar2rsawseen
ar2rsawseen deleted the security/push-editor-sanitize branch August 19, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant