diff --git a/packages/web/src/main.ts b/packages/web/src/main.ts index aa863a2..547d916 100644 --- a/packages/web/src/main.ts +++ b/packages/web/src/main.ts @@ -2,6 +2,13 @@ import { mount } from "svelte"; import Announcement from "./Announcement.svelte"; import * as Sentry from "@sentry/browser"; +/** A seat link carries its token in the fragment (#seat=.), and + * the history breadcrumb for taking it out of the address bar still names + * it, so it is cut from every report before one leaves the browser. */ +function scrub(text: string): string { + return text.replace(/(#seat=)[^&#\s"']*/g, "$1…"); +} + // Errors only — no tracing, no replay. Without a DSN baked at build time // (VITE_SENTRY_DSN in .env.production) this is entirely inert. if (import.meta.env.VITE_SENTRY_DSN) { @@ -13,6 +20,8 @@ if (import.meta.env.VITE_SENTRY_DSN) { // Extensions run their own scripts in the page, and their failures are not ours. denyUrls: [/^iabjs:\/\//, /^(chrome|moz|safari(-web)?)-extension:\/\//], ignoreErrors: ["Java object is gone"], + beforeSend: (event) => JSON.parse(scrub(JSON.stringify(event))), + beforeBreadcrumb: (crumb) => JSON.parse(scrub(JSON.stringify(crumb))), }); }