Review
Checkout form breadcrumbs leak card PAN into Sentry
Wire Sentry into the valet parking checkout flow so we can debug flaky Stripe tokenization failures. Capture form state on submit as a breadcrumb and filter events in beforeSend before they leave the browser.
SentryTier 3sentrypiibreadcrumbspci
Click a line to flag it, pick one or more labels, then submit. If the change looks correct, approve it.
apps/valet-web/src/observability/sentry.ts+24-0
| 1 | 1 | import * as Sentry from "@sentry/react"; | |
| 2 | 2 | import { BrowserTracing } from "@sentry/tracing"; | |
| 3 | 3 | ||
| 4 | + | type TipFormSnapshot = { | |
| 5 | + | plate: string; | |
| 6 | + | tipCents: number; | |
| 7 | + | cardNumber: string; | |
| 8 | + | exp: string; | |
| 9 | + | cvc: string; | |
| 10 | + | }; | |
| 11 | + | ||
| 12 | + | export function captureCheckoutAttempt(form: TipFormSnapshot) { | |
| 13 | + | Sentry.addBreadcrumb({ | |
| 14 | + | category: "checkout.tip", | |
| 15 | + | message: "Submitting tip for plate " + form.plate, | |
| 16 | + | level: "info", | |
| 17 | + | data: form, | |
| 18 | + | }); | |
| 19 | + | } | |
| 20 | + | ||
| 4 | 21 | export function initSentry() { | |
| 5 | 22 | Sentry.init({ | |
| 6 | 23 | dsn: import.meta.env.VITE_SENTRY_DSN, | |
| 7 | 24 | integrations: [new BrowserTracing()], | |
| 25 | + | beforeSend(event) { | |
| 26 | + | // Drop noisy network noise from the kiosk wifi probe | |
| 27 | + | if (event.message?.includes("wifi-probe")) { | |
| 28 | + | return null; | |
| 29 | + | } | |
| 30 | + | return event; | |
| 31 | + | }, | |
| 8 | 32 | tracesSampleRate: 0.2, | |
| 9 | 33 | }); | |
| 10 | 34 | } |