Repository navigation
fix(cli): Accept /stream and DSN envelope posts under a session ingest URL - #2396
Merged
Merged
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
MathurAditya724
approved these changes
Nov 19, 2026
MathurAditya724
left a comment
Member
There was a problem hiding this comment.
Reviewed the implementation, neighboring patterns, regression coverage, and review threads on this exact head. Local validation: 34 control-plane/lifecycle tests covering ingest aliases, scoped capability checks, CORS, and session lifecycle. No actionable findings remain; hosted checks are green.
MathurAditya724
marked this pull request as ready for review
November 19, 2026 06:44
MathurAditya724
added a commit
that referenced
this pull request
Nov 19, 2026
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. <!-- junior-request-attribution:start --> via @MathurAditya724. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Af689f1f928b25c03737a6ea9643eadc2 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Af689f1f928b25c03737a6ea9643eadc2) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Af689f1f928b25c03737a6ea9643eadc2/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Aditya Mathur <[email protected]>
7 tasks done
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--sessiononly takes a POST to the exact ingest URL. Some SDKs build a different path, so their events get rejected:/streamtoSENTRY_SPOTLIGHT.<dsn path>/api/<project>/envelope/from a DSN.The session now also accepts
<ingest URL>/streamand<ingest URL>/api/<project>/envelope/(with or without the trailing slash). Each path still needs the ingest capability and gets the same loopback and CORS checks.Before:
After:
Ruby: sentry-ruby's Spotlight transport always posts to
/streamat the root, which can't carry the capability. The root stays closed, since opening it would let any local process write to any session. Ruby apps can use a DSN under the ingest URL instead, with Spotlight off:http://[email protected]:8969/_local/v1/sessions/<id>/ingest/<cap>/0.Open question: SDKs that send to a DSN (PHP at least) copy it into each envelope header. With the DSN form, the ingest capability is stored in the session's envelopes, so anyone with the read capability can see it. Should session ingest strip the
dsnheader?Docs to follow: once the docs line saying
--sessionneeds SDKs that post to the exact ingest URL lands, it should list the three forms (ingest URL, plus/stream, DSN under it) and say Ruby needs the DSN form.via @MathurAditya724.
--
View Session [Sentry]