Skip to content

fix(cli): Drop the DSN header from session envelopes - #2423

Merged
MathurAditya724 merged 6 commits into
mainfrom
fix/local-session-dsn-header
Nov 19, 2026
Merged

MathurAditya724 merged 6 commits into
mainfrom
fix/local-session-dsn-header

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2396.

Go, Ruby and PHP copy their DSN into every envelope header. With --session, that DSN holds the session's ingest key, so it ended up stored in the session and visible to anyone with only the read link. The daemon now removes the dsn key from the envelope header before it stores or streams a session envelope. It does this after decompressing, so gzipped PHP and Ruby requests are covered too. Only the header line changes; the items are kept exactly as sent. Plain local run without a session leaves the header alone.

Before:

{"event_id":"…","dsn":"http://[email protected]:8969/_local/v1/sessions/<id>/ingest/<cap>/0","sdk":{"name":"sentry.go"}}

After:

{"event_id":"…","sdk":{"name":"sentry.go"}}

The docs now show how each SDK sends to a session. Node and Python use the ingest URL as is, and PHP sets spotlight to the ingest URL. Go, Rust and Ruby need a DSN, which local run --session doesn't set, so you create a session with sentry local session create, turn its ingestUrl into a DSN, run the app directly, and read events with sentry local event list <id>. I also removed the older docs line saying --session only works with Node and Python.

Two small cleanups: the session ingest regex is now built from the list of ingest paths so the two can't drift apart, and .. paths under the ingest key are covered so they can't reach the reset action.

via @MathurAditya724.

--

View Session [Sentry]

sentry-junior Bot and others added 4 commits November 18, 2026 19:38
…t URL

Session capture only accepted a POST to the exact ingest URL, so PHP's
Spotlight transport (which adds /stream) got 401, and SDKs pointed at a
DSN under the ingest URL (Go, Rust, PHP, Ruby build
<path>/api/<project>/envelope/) got 401 too.

The session now also accepts <ingest URL>/stream and
<ingest URL>/api/<project>/envelope[/]. Each path still needs the ingest
capability and gets the same loopback and CORS checks.
Go, Ruby and PHP copy their DSN, which holds the session ingest capability,
into every envelope header. Session envelopes reach read-capability holders,
so the daemon now removes the header's dsn key at session ingest, after
decompression. Also document how each SDK reaches a session, build the
session ingest regex from its path list, and test path traversal to reset.
…-header

Co-Authored-By: Aditya Mathur <[email protected]>

# Conflicts:
#	packages/cli/src/commands/local/control-plane.ts
#	packages/cli/src/commands/local/receiver-ingest.ts
#	packages/cli/test/commands/local/control-plane.test.ts
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Nov 19, 2026 9:57am UTC
sentry-local Ready Ready Preview Nov 19, 2026 9:57am UTC

Request Review

local run --session creates a new session on every run and only sets
SENTRY_SPOTLIGHT, so Go, Rust and Ruby need a session from
session create and the app run directly with a DSN under its ingest URL.
Also strip a leading UTF-8 BOM before reading the envelope header, and
cover that plain receivers keep the header's dsn.

Co-Authored-By: Aditya Mathur <[email protected]>

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the refreshed exact head against current main. Full local typecheck, lint and workspace tests passed, including all 335 Local tests. Independent real-loopback probes passed for identity/gzip/deflate/Brotli requests, a BOM header, binary attachment byte preservation, raw envelope API reads, and read-capability SSE: the DSN/ingest capability is absent while other header metadata and item bytes remain intact. Plain receivers retain their existing behavior. Reviewed ingest-path/authorization consistency and generic diagnostics without sensitive header logging. No actionable findings; waiting for final hosted gates before squash merge.

@MathurAditya724
MathurAditya724 merged commit 88633b8 into main Nov 19, 2026
31 checks passed
@MathurAditya724
MathurAditya724 deleted the fix/local-session-dsn-header branch November 19, 2026 10:15

This branch was successfully deployed

2 active deployments
Preview – sentry-local — e73a1197 Deployed Nov 19, 2026 by vercel[bot]
Preview – cli — e73a1197 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant