mattermost-mobile-upstream/app/actions/websocket
Ben Schumacher 307da95d9d
[MM-69457] Stop logging PII in exportable app logs (#9884)
* MM-69457: Stop logging PII in exportable app logs

App logs are written to rolling files users can export via "Report a
Problem" and the same args are forwarded as Sentry breadcrumbs. Several
call sites logged PII into both destinations.

Fix the known high-risk sites and prevent regressions:
- push token, incoming-call payload (callerName), channel display names,
  and raw websocket url/event are no longer logged
- wrap stray raw error/event logging with getFullErrorMessage()
- add a no-restricted-syntax ESLint rule flagging PII (names/emails/
  usernames) and credentials (tokens/passwords/secrets) in log* calls
- document Logging & PII guidance in CLAUDE.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAfpPfhVfZSv3veGDQfPYQ

* Update websocket error test for PII-safe logging

The error handler no longer logs the raw url/event; assert it logs
code/reason instead and verify the url is not logged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAfpPfhVfZSv3veGDQfPYQ

* fix: address PR review feedback on PII-safe logging

- Add server URL to websocket error log for multi-server debuggability
- Redact device token to first 4 chars instead of omitting entirely
- Update websocket error test to match new log signature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address PR review feedback on PII-safe logging

- files.ts: add hasRejectionReason boolean to initial event log
- websocket/index.ts: replace this.url (full WS URL with connection_id)
  with this.serverUrl in all log calls; update tests to match
- calls_native.ts: split combined serverId/channelId guard into two
  separate if blocks for clearer per-field log messages
- push_notifications.ts: expand redacted token prefix from 4 to 16 chars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: revert websocket lifecycle logs back to full URL

The full WebSocket URL (with path and connection_id) provides more
diagnostic value than just the server base URL for lifecycle events
(connect, reconnect, close, missed events). Only the onError handler
keeps this.serverUrl, which was the original targeted fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* cleanup

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 12:19:04 +02:00
..
burn_on_read.test.ts Bor create post (#9393) 2026-02-09 17:00:54 +05:30
burn_on_read.ts Bor create post (#9393) 2026-02-09 17:00:54 +05:30
category.test.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
category.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
channel.test.ts Keep users in archived channels when server omits ExperimentalViewArchivedChannels (MM-65820) (#9815) 2026-06-09 19:47:37 +00:00
channel.ts fix critical crashes on Android (#9871) 2026-06-23 02:40:21 +08:00
event.test.ts Bor create post (#9393) 2026-02-09 17:00:54 +05:30
event.ts Add conversation-entity support for plugin-agents v2.0 (#9704) 2026-05-25 07:20:07 -07:00
files.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
files.ts [MM-69457] Stop logging PII in exportable app logs (#9884) 2026-07-02 12:19:04 +02:00
group.test.ts Add tests to index, group and users websocket actions (#8486) 2025-01-17 14:25:12 -05:00
group.ts Move config to its own database table (#6744) 2022-11-11 21:20:42 +04:00
index.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
index.ts Mm 68326 file cleanup v2 (#9756) 2026-05-22 19:48:29 +02:00
integrations.test.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
integrations.ts Gekidou Android share extension (#6803) 2022-11-30 23:18:56 +02:00
managed_categories.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
managed_categories.ts [MM-68255] Enable mobile support for Managed Categories (#9683) 2026-04-16 10:01:51 -04:00
posts.test.ts Mattermost Blocks (#9764) 2026-06-29 18:42:16 +02:00
posts.ts Mattermost Blocks (#9764) 2026-06-29 18:42:16 +02:00
preferences.test.ts Revert "e2e(detox): Rainforest to Detox migration (#9790)" (#9834) 2026-06-15 17:57:01 +02:00
preferences.ts fix: app bugs surfaced by Detox RF migration (#9789) 2026-06-09 13:25:42 +05:30
reactions.test.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
reactions.ts Refactor errors around the app (#7306) 2023-05-03 13:08:55 +02:00
roles.test.ts Add model mocks to TestHelper (#8715) 2025-03-28 09:40:08 +01:00
roles.ts Refactor errors around the app (#7306) 2023-05-03 13:08:55 +02:00
scheduled_post.test.ts Feature schedule posts (#8509) 2025-04-14 22:08:59 +05:30
scheduled_post.ts Feature schedule posts (#8509) 2025-04-14 22:08:59 +05:30
system.test.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
system.ts [MM-68255] Enable mobile support for Managed Categories (#9683) 2026-04-16 10:01:51 -04:00
teams.test.ts Add model mocks to TestHelper (#8715) 2025-03-28 09:40:08 +01:00
teams.ts Refactor errors around the app (#7306) 2023-05-03 13:08:55 +02:00
threads.test.ts Add tests to remaining actions/websocket files (#8495) 2025-01-21 08:42:09 -05:00
threads.ts Refactor errors around the app (#7306) 2023-05-03 13:08:55 +02:00
users.test.ts [MM-62565] Custom Profile attributes websocket changes (#8758) 2025-05-27 16:24:40 +02:00
users.ts Add autotranslations (#9324) 2026-02-10 17:50:39 +01:00