Repository navigation
fix(mcp): Check events, traces and replays an ID alone names against the session's project - #2541
Open
sentry-junior[bot] wants to merge 5 commits into
Open
sentry-junior[bot] wants to merge 5 commits into
sentry-junior[bot] wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
BYK
approved these changes
Nov 26, 2026
…the session's project A project-scoped `sentry mcp --commands` session still reached other projects through IDs that name no project. `event view <event-id>` fell back to the org-wide event ID lookup, `trace view <trace-id>` reads a trace org-wide, and `replay view <replay-id>` checked the replay's project only when the call named one. The scope checks in `target-scope.ts` now take what they check (`Issue 123`, `Event abc`), and `assertProjectInScope` covers anything with a project slug: - `getEvent` and `resolveEventInOrg` refuse an event outside the scope, and `event view` no longer swallows that refusal in its fallbacks. - `getDetailedTrace` refuses a trace with no span in the session's project. A trace that has one keeps the spans of the projects it calls into. - `resolveReplay` refuses another organization, and the replay project check also compares the replay with the session's project. A replay without a project is refused in a project scope. Refs #2237 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
fix/mcp-commands-opaque-id-scope
branch
from
November 27, 2026 11:56
59db38d to
4ee3341
Compare
…t list `replay view --web` opened the replay before `validateReplayProjectScope` ran, so a project-scoped session could open another project's replay that an ID alone names. The scope check now runs first. A refused event, trace or replay suggested `issue list`. The hint now names the list command of what was refused (`event list acme/web`). Refs #2237
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 719d201. Configure here.
`event list` takes an issue, not a project, and `trace list` needs a project. A refused event now suggests `issue list`, and a refused trace suggests `trace list` only in a project scope. Refs #2237
…ands-opaque-id-scope
…ands-opaque-id-scope
BYK
approved these changes
Nov 28, 2026
This branch was successfully 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.

Follow-up to #2527 for #2237. Stacked on #2527.
#2527 checks issues. In a project-scoped
sentry mcp --commandssession (acme/web), events, traces and replays fetched by an opaque ID still reached other projects:event view <event-id>404s inacme/web, then its fallback finds the event org-wide (/eventids/) and shows it. The same happens withevent view acme/ <event-id>.trace view <trace-id>reads the trace org-wide.replay view <replay-id>checked the replay's project only when the call named a project.Changes
target-scope.ts. The checks now take what they check (Issue 123,Event abc) for the error. The newassertProjectInScope(org, projectSlug, subject)covers anything with a project slug.assertIssueInScopenow uses it.getEventrefuses a project outside the scope before the request.resolveEventInOrgrefuses another org before the request and another project after it.event viewused to swallow every non-auth error in its same-org fallback. It now passes a scope refusal through.getDetailedTracerefuses another org. In a project scope, it also refuses a trace with no span in the session's project, at any depth.trace view,span viewand the span tree inevent viewall read traces through it.resolveReplayrefuses another org.validateReplayProjectScope, whichreplay viewandreplay downloadalready run, now also compares the replay with the session's project. A replay without a project, such as an archived one, is refused in a project scope.Open question: a trace that has a span in the session's project is returned whole, including spans from the other projects it calls into. Sentry's trace view works the same way, and a distributed trace isn't useful cut down to one project. If the session should only ever see its own project's spans, the next step is to filter spans instead of checking the trace.
via @BYK.
--
View Session [Sentry]