Skip to content

Commit 71b7ad1

Browse files
committed
fix: allow Jam uploads in CSP and drop ignored sendDefaultPii
PR #15 added https://*.jam.dev to script-src and frame-src, so the recorder loads in production, but connect-src was never updated. The recorder had no route to upload a capture. Add the origin to connect-src in both vercel.json and nginx.conf, which the config test already requires to stay identical. Sentry ignores sendDefaultPii entirely whenever dataCollection is set, so the line read as a PII control that does nothing. Remove it and leave the dataCollection block as the single source of truth. queryParams is correct at the pinned @sentry/core 10.65.0; urlQueryParams does not exist until 10.68. Both fixes get an assertion that fails without them.
1 parent edff2e7 commit 71b7ad1

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎nginx.conf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ server {
88
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
99

1010
# Security headers
11-
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; img-src 'self' data: https:; font-src 'self' data: https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' https://*.jam.dev; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com https://*.jam.dev; connect-src 'self' https://uziwdtkzofptihahfooo.supabase.co https://*.supabase.co https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://r.jina.ai https://s.jina.ai https://oauth2.googleapis.com https://www.googleapis.com https://*.ingest.sentry.io https://*.sentry.io https://eu.i.posthog.com https://*.posthog.com;" always;
11+
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; img-src 'self' data: https:; font-src 'self' data: https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' https://*.jam.dev; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com https://*.jam.dev; connect-src 'self' https://*.jam.dev https://uziwdtkzofptihahfooo.supabase.co https://*.supabase.co https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://r.jina.ai https://s.jina.ai https://oauth2.googleapis.com https://www.googleapis.com https://*.ingest.sentry.io https://*.sentry.io https://eu.i.posthog.com https://*.posthog.com;" always;
1212
add_header X-Frame-Options "SAMEORIGIN" always;
1313
add_header X-Content-Type-Options "nosniff" always;
1414
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

‎src/lib/observability.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ export function initializeObservability(): void {
102102
dsn: sentryDsn,
103103
environment: import.meta.env.MODE,
104104
ignoreErrors: [/^Synthetic observability verification$/],
105-
sendDefaultPii: false,
105+
// No sendDefaultPii: deprecated, and Sentry ignores it whenever
106+
// dataCollection is set. The block below is the only PII control.
106107
beforeBreadcrumb: filterObservabilityBreadcrumb,
107108
dataCollection: {
108109
userInfo: false,

‎src/test/observability.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ describe("observability primitives", () => {
210210
expect(sentryInitMock).toHaveBeenCalledWith(expect.objectContaining({
211211
dsn: "https://public-test@sentry.example/1",
212212
ignoreErrors: [/^Synthetic observability verification$/],
213-
sendDefaultPii: false,
214213
beforeBreadcrumb: filterObservabilityBreadcrumb,
215214
dataCollection: {
216215
userInfo: false,
@@ -228,6 +227,9 @@ describe("observability primitives", () => {
228227
replaysSessionSampleRate: 0,
229228
replaysOnErrorSampleRate: 1,
230229
}));
230+
// Deprecated and ignored whenever dataCollection is set: passing it would
231+
// read as a PII control that does nothing.
232+
expect(sentryInitMock.mock.calls[0][0]).not.toHaveProperty("sendDefaultPii");
231233
expect(browserTracingIntegrationMock).toHaveBeenCalledOnce();
232234
expect(replayIntegrationMock).toHaveBeenCalledWith({
233235
maskAllText: true,

‎src/test/vercel-deployment-config.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ describe("Vercel frontend deployment configuration", () => {
9999

100100
expect(csp).toContain("script-src 'self' https://*.jam.dev");
101101
expect(csp).toContain("frame-src 'self' https://accounts.google.com https://*.jam.dev");
102+
// Loading the recorder is useless if it cannot upload the capture.
103+
expect(csp).toContain("connect-src 'self' https://*.jam.dev");
102104
expect(nginxCsp).toBe(csp);
103105
expect(indexHtml).toContain('<script src="/src/bootstrap.ts" type="module"></script>');
104106
expect(indexHtml).not.toContain('<script type="module" src="/src/main.tsx"></script>');

‎vercel.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"headers": [
1616
{
1717
"key": "Content-Security-Policy",
18-
"value": "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; img-src 'self' data: https:; font-src 'self' data: https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' https://*.jam.dev; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com https://*.jam.dev; connect-src 'self' https://uziwdtkzofptihahfooo.supabase.co https://*.supabase.co https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://r.jina.ai https://s.jina.ai https://oauth2.googleapis.com https://www.googleapis.com https://*.ingest.sentry.io https://*.sentry.io https://eu.i.posthog.com https://*.posthog.com;"
18+
"value": "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; img-src 'self' data: https:; font-src 'self' data: https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' https://*.jam.dev; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com https://*.jam.dev; connect-src 'self' https://*.jam.dev https://uziwdtkzofptihahfooo.supabase.co https://*.supabase.co https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://r.jina.ai https://s.jina.ai https://oauth2.googleapis.com https://www.googleapis.com https://*.ingest.sentry.io https://*.sentry.io https://eu.i.posthog.com https://*.posthog.com;"
1919
},
2020
{
2121
"key": "X-Frame-Options",

0 commit comments

Comments
 (0)