A seat link's token is cut from an error report and its breadcrumbs before it goes to Sentry, since the history breadcrumb for taking the link out of the address bar still names it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141G6xqLeNRYEtviLWSB5Up
This commit is contained in:
Eric Wagoner
2026-10-17 20:12:49 -04:00
co-authored by Claude Opus 5.5
parent c984bb4b56
commit 6606853332
+9
View File
@@ -2,6 +2,13 @@ import { mount } from "svelte";
import Announcement from "./Announcement.svelte"; import Announcement from "./Announcement.svelte";
import * as Sentry from "@sentry/browser"; import * as Sentry from "@sentry/browser";
/** A seat link carries its token in the fragment (#seat=<name>.<token>), 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 // Errors only — no tracing, no replay. Without a DSN baked at build time
// (VITE_SENTRY_DSN in .env.production) this is entirely inert. // (VITE_SENTRY_DSN in .env.production) this is entirely inert.
if (import.meta.env.VITE_SENTRY_DSN) { 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. // Extensions run their own scripts in the page, and their failures are not ours.
denyUrls: [/^iabjs:\/\//, /^(chrome|moz|safari(-web)?)-extension:\/\//], denyUrls: [/^iabjs:\/\//, /^(chrome|moz|safari(-web)?)-extension:\/\//],
ignoreErrors: ["Java object is gone"], ignoreErrors: ["Java object is gone"],
beforeSend: (event) => JSON.parse(scrub(JSON.stringify(event))),
beforeBreadcrumb: (crumb) => JSON.parse(scrub(JSON.stringify(crumb))),
}); });
} }