Skip to content

fix(sentry): Deny organization, project, and user deletion on egress - #3550

Merged
dcramer merged 3 commits into
mainfrom
fix/sentry-deny-org-project-delete
Nov 17, 2026
Merged

dcramer merged 3 commits into
mainfrom
fix/sentry-deny-org-project-delete

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Junior must never delete a Sentry organization or project. Deletion can't be undone, so a person should always do it in Sentry. Today nothing stops it: a Sandbox command with a requester who has enough access could send the request.

Sentry egress now rejects these requests with an EgressPolicyDenied (403) before a grant is chosen. The rejection holds for any credential and any Actor role. It covers sentry.io, us.sentry.io and de.sentry.io:

  • DELETE /api/0/organizations/{org}/
  • DELETE /api/0/projects/{org}/{project}/

These are Sentry's only org and project delete routes. Matching uses the decoded path segments, so variants that Django routes to the same endpoint are caught too. Deletes of child resources, such as project keys or issues, are not affected. The denial message says this is a Junior policy, so the agent doesn't ask for more Sentry scopes.

Object-link card resolution uses userOAuthOnly egress, which skips plugin grant hooks. That path is read-only host code, not Sandbox egress, so it stays as is.

via @dcramer.

--

View Session [Sentry]

Sentry egress now rejects DELETE /api/0/organizations/{org}/ and
DELETE /api/0/projects/{org}/{project}/ on every Sentry domain, before
any grant is chosen. Junior never deletes these, whatever the
credential or the Actor's role.

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 17, 2026 8:07am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 17, 2026

@dcramer dcramer 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.

just my paranoia

@dcramer

dcramer commented Nov 17, 2026

Copy link
Copy Markdown
Member

add the user deletion endpoint too

Reject DELETE /api/0/users/{user}/, including users/me, with the same
policy as organization and project deletion.
@sentry-junior sentry-junior Bot changed the title fix(sentry): Deny organization and project deletion on egress fix(sentry): Deny organization, project, and user deletion on egress Nov 17, 2026
@sentry-junior

sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Done in 28c3b670: user deletion now gets the same deny as org and project deletion.

@dcramer

dcramer commented Nov 17, 2026

Copy link
Copy Markdown
Member

and fix our lint failures

dcramer added a commit that referenced this pull request Nov 17, 2026
Sandbox egress credentials have no design doc yet, so changes have no
stated intent to check against. This PR adds
`design/sandbox-credentials.md` and lists it in the `design/README.md`
index.

The doc sets these goals:
- No real credentials in the Sandbox.
- Inject a credential only into requests that send the plugin
placeholder.
- Never replace a credential that a request already carries.
- Use the least access that works.
- Each plugin owns its own write policy.

It also sets the Sentry rules: Sandbox code cannot create releases or
uploads with the Actor's account, and cannot delete orgs or projects
(see #3550).

The intent comes from `policies/security.md`, from #210,
#381, #490 and #536, and from the comments in
`junior-github/src/egress-policy.ts`,
`chat/sandbox/noninteractive-command.ts` and
`chat/sandbox/prepare-workspace.ts`.

**Open intent questions**
- **Missing auth header:** fill one only when the plugin says its tools
send none, as git does today. Sentry stays strict. The alternative is to
never fill it.
- **Child agents:** Threads and Tasks use the parent Turn's Actor
credentials. I treated that as intended and left it out of the doc.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ac9056086d12016c72d052e066ae38509 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Ac9056086d12016c72d052e066ae38509)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ac9056086d12016c72d052e066ae38509/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
@dcramer
dcramer enabled auto-merge (squash) November 17, 2026 08:11
@dcramer
dcramer merged commit ce59d40 into main Nov 17, 2026
45 checks passed
@dcramer
dcramer deleted the fix/sentry-deny-org-project-delete branch November 17, 2026 08:14

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 6495df1d Deployed Nov 17, 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