Skip to content

fix(frontend): strip fragments from analytics URLs#13375

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-correctness-bugs-9c28
Draft

fix(frontend): strip fragments from analytics URLs#13375
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-correctness-bugs-9c28

Conversation

@cursor

@cursor cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Motivation

Personal-note share links keep the decryption key in the URL fragment (#k=...) so the key is never sent to the canister or leaked through referrers. Plausible's tracker uses location.href for event URLs by default, so opening /notes/share/<token>#k=<key> could attach the share key to pageview and recipient analytics payloads.

Existing work checked: recently merged note-share PRs #13299, #13300, #13303, #13321, #13353, the open security-model docs PR #13366, open/recent analytics PRs, and related issues. The docs and PR descriptions confirm the key/token must not be exposed in analytics, but none of the active work sanitizes Plausible's auto-attached URL.

Changes

  • Add a central Plausible transformRequest that strips URL fragments from every analytics payload URL before it is sent.
  • Preserve the path/query and all other payload fields.
  • Cover the privacy invariant in the analytics service tests.

Tests

  • npm run test -- --run src/frontend/src/tests/lib/services/analytics.service.spec.ts
  • npm run format
  • npm run lint -- --max-warnings 0
  • npm run check
  • npm run test
  • npm run check:tests
  • npm run lint:lockfile
Open in Web View Automation 

cursoragent and others added 2 commits July 4, 2026 11:03
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
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