Skip to content

fix(sentry): scrub percent-encoded Matrix IDs and opaque base64url tokens from URLs#531

Merged
7w1 merged 2 commits intoSableClient:devfrom
Just-Insane:fix/sentry-scrub-opaque-matrix-ids
Mar 25, 2026
Merged

fix(sentry): scrub percent-encoded Matrix IDs and opaque base64url tokens from URLs#531
7w1 merged 2 commits intoSableClient:devfrom
Just-Insane:fix/sentry-scrub-opaque-matrix-ids

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

Description

Extends scrubMatrixUrl with two additional patterns that were leaking through the existing scrubber.

1. Opaque Matrix IDs with percent-encoded colon (%3A)

Device IDs, filter tokens, and other Matrix IDs that lack a sigil prefix but follow the localpart%3Aserver pattern were not matched by the existing sigil-based patterns. For example:

/Gj3Wy2D8gAi8jTIyR%3Asable.moe  →  /[MATRIX_ID]

2. Long opaque base64url path segments

Access tokens, Curve25519 keys, MSC3575 session tokens, and push endpoints appear as 30+ character base64url strings in URL path segments. These were passing through unscrubbed. For example:

/vI02CuiDNpaYEhUIVLbqE8vdKqm2ZwqIR5Y6NwNY_Rg/  →  /[REDACTED]/

The new pattern runs last so the earlier sigil-based patterns already handle known Matrix IDs first.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted
  • Fully AI generated

Two regex patterns added to scrubMatrixUrl in sentryScrubbers.ts. The first matches path segments containing a bare localpart%3Aserver form (no sigil) and replaces with [MATRIX_ID]. The second matches any path segment of 30 or more base64url characters and replaces with [REDACTED], covering access tokens, crypto keys, and opaque session identifiers. Both are appended after the existing patterns so known sigil-prefixed IDs are handled first.

@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners March 25, 2026 02:53
@dozro
Copy link
Copy Markdown
Member

dozro commented Mar 25, 2026

hey it seems like you're missing a changeset. Can you please add a changeset, as described here https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md#documenting-a-change

Thank you :3

@Just-Insane
Copy link
Copy Markdown
Contributor Author

hey it seems like you're missing a changeset. Can you please add a changeset, as described here dev/CONTRIBUTING.md#documenting-a-change

Thank you :3

Yup, working on it.

@Just-Insane Just-Insane marked this pull request as draft March 25, 2026 03:09
@Just-Insane Just-Insane force-pushed the fix/sentry-scrub-opaque-matrix-ids branch from 00c9655 to 6409005 Compare March 25, 2026 03:32
@Just-Insane Just-Insane marked this pull request as ready for review March 25, 2026 03:52
Co-authored-by: Rose <git@itsrye.dev>
Copy link
Copy Markdown
Member

@dozro dozro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes in the code lgtm

@7w1 7w1 added this pull request to the merge queue Mar 25, 2026
Merged via the queue into SableClient:dev with commit 7b76e27 Mar 25, 2026
9 checks passed
@Just-Insane Just-Insane deleted the fix/sentry-scrub-opaque-matrix-ids branch March 27, 2026 16:31
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.

3 participants