Files
55e7429fc6 Stop leaking message body via the Notifications API tag (#36364)
* Stop leaking message body via the Notifications API tag

showNotification was passing the rendered chat body as the Web Notifications
API tag option. On Chromium-based browsers (Chrome, Edge, Brave), the tag is
serialised into the notification-activation command line via the
--notification-launch-id argument, where endpoint detection tooling such as
CrowdStrike Falcon FDR, Microsoft Defender for Endpoint, and Sysmon Event ID 1
captures the full process-start command line and forwards it to the customer's
SIEM. That meant private message content (including incident-response messages,
credentials accidentally pasted into chat, and customer PII) was being copied
into telemetry pipelines that were never in scope to receive it.

Use the title - which already carries only the sender / channel context - as
the tag instead. As a side benefit this is closer to the spec-intended use of
tag: subsequent notifications from the same conversation now replace the prior
one rather than stacking.

Add a regression test covering the leak: the test pushes a body with a
plausible secret pattern (token=AKIA-...) and asserts the tag never echoes
any of it.

Signed-off-by: Vishal Kumar Singh <[email protected]>

* Allow callers to pass an explicit notification tag

Threads channelId through dispatchNotification so per-conversation
notifications coalesce by a stable opaque id rather than the user-visible
title. The title remains as a safe fallback when callers do not supply a
tag, preserving the existing behaviour for the session-expired notification
emitted from login.tsx where no channel context exists.

Signed-off-by: Vishal Kumar Singh <[email protected]>

* fix: explain desktop notification path

* Avoid title fallback for notification tags

Signed-off-by: Vishal Kumar Singh <[email protected]>

* test: align notification action payload expectations

Signed-off-by: Vishal Kumar Singh <[email protected]>

* test: align notification tag e2e expectation

---------

Signed-off-by: Vishal Kumar Singh <[email protected]>
Co-authored-by: Mattermost Build <[email protected]>
2026-07-09 13:30:26 +02:00
..