Skip to content

ref(core): Narrow request.user in org, project and team endpoints - #129416

Draft
gricha wants to merge 1 commit into
ref/sa-narrow-explorefrom
ref/sa-narrow-core
Draft

gricha wants to merge 1 commit into
ref/sa-narrow-explorefrom
ref/sa-narrow-core

Conversation

@gricha

@gricha gricha commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Organization, project, team and SCIM endpoints read the caller through sentry.auth.principal: "my projects" and own-membership lookups use owned_by_acting_user(), "is this mine?" uses is_acting_user(), nullable actor ids use acting_user_id(), and org creation, the owner-only org list and username/email reads use require_user().

  • A service account gets an empty "my projects" (is_member:1, project counts) instead of 403. Requesting a closed team for a member now files an access request with no requester; before, it wrote the row and then returned 403. A project PUT with isBookmarked saves the update and skips the bookmark, as it always did for token callers; before, it saved part of the update and then returned 403. New tests cover all three.
  • Token callers no longer count teamless projects or invited (null-user) members as theirs.
  • Users and agents see no change.

Member management (member details PUT/DELETE, member invites, invite requests, get_allowed_org_roles) is deliberately unchanged: whether a service account may manage members is still open, so it keeps getting 403 user-required and those files stay on #129402's mypy allowlist.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 31, 2026
@gricha
gricha added this pull request to stack #129364 October 31, 2026 02:27
@gricha
gricha removed this pull request from stack #129364 November 1, 2026 04:24
@gricha
gricha force-pushed the ref/sa-narrow-core branch from 7bae012 to 138bfdc Compare November 1, 2026 04:24
@gricha
gricha added this pull request to stack #129440 November 1, 2026 04:24
Organization, project, team and SCIM endpoints read the caller through `sentry.auth.principal`: "my projects" and own-membership lookups use `owned_by_acting_user()`, "is this mine?" uses `is_acting_user()`, nullable actor ids use `acting_user_id()`, and org creation, the owner-only org list and username/email reads use `require_user()`.

- A service account gets an empty "my projects" (`is_member:1`, project counts) instead of 403. Requesting a closed team for a member now files an access request with no requester; before, it wrote the row and then returned 403. A project PUT with `isBookmarked` saves the update and skips the bookmark, as it always did for token callers; before, it saved part of the update and then returned 403. New tests cover all three.
- Token callers no longer count teamless projects or invited (null-user) members as theirs.
- Users and agents see no change.
@gricha
gricha force-pushed the ref/sa-narrow-core branch from 138bfdc to b98b96b Compare November 1, 2026 04:57
@sentry

sentry Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 780 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant