Skip to content

ref(typing): Check batched feature flags against the acting user - #129628

Merged
gricha merged 1 commit into
ref/sa-security-emailfrom
ref/sa-feature-actor
Nov 4, 2026
Merged

gricha merged 1 commit into
ref/sa-security-emailfrom
ref/sa-feature-actor

Conversation

@gricha

@gricha gricha commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

The events, events-stats and trace-item-attributes endpoints pass acting_user(request.user) to features.batch_has() instead of the raw principal. That drops the three endpoints from the request.user allowlist (15 → 12).

batch_has (and getsentry's handlers, which override it) type the actor as User | RpcUser | AnonymousUser | None, so widening the manager would break getsentry's typing. Instead, the call sites resolve the caller first.

Nothing changes for users or token callers. The only actor reads in the feature handlers here and in getsentry are actor is not None and actor.is_superuser, the flagpole context's has_user() and getsentry's is_demo_user(actor), and all three treat None like AnonymousUser. A service account becomes None, as before through has_user().

@gricha
gricha requested review from a team as code owners November 3, 2026 00:35
@gricha
gricha added this pull request to stack #129572 November 3, 2026 00:35
@gricha
gricha requested review from a team as code owners November 3, 2026 00:35
@gricha
gricha requested review from cvxluo and skaasten November 3, 2026 00:35
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 3, 2026
@gricha
gricha force-pushed the ref/sa-feature-actor branch from 593fc2a to 257ca85 Compare November 3, 2026 04:03
@sentry

sentry Bot commented Nov 3, 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

@gricha
gricha force-pushed the ref/sa-feature-actor branch from 257ca85 to f78409f Compare November 3, 2026 04:41
@gricha
gricha removed this pull request from stack #129572 November 3, 2026 06:52
@gricha
gricha added this pull request to stack #129650 November 3, 2026 06:52
@gricha
gricha force-pushed the ref/sa-feature-actor branch from f78409f to 5d4a6de Compare November 3, 2026 19:53
@gricha
gricha removed this pull request from stack #129650 November 3, 2026 19:53
@gricha
gricha added this pull request to stack #129747 November 3, 2026 19:54
@gricha
gricha requested review from a team as code owners November 3, 2026 20:01
@gricha
gricha requested review from a team as code owners November 3, 2026 20:01
@gricha
gricha force-pushed the ref/sa-feature-actor branch from 5d4a6de to 547cc8b Compare November 3, 2026 20:01
@gricha
gricha force-pushed the ref/sa-feature-actor branch from 547cc8b to d7b4491 Compare November 3, 2026 20:09
@gricha
gricha force-pushed the ref/sa-feature-actor branch from d7b4491 to 8b5e30f Compare November 3, 2026 20:51
@gricha
gricha force-pushed the ref/sa-feature-actor branch from 8b5e30f to e8eab3e Compare November 3, 2026 21:10
@gricha
gricha force-pushed the ref/sa-feature-actor branch from e8eab3e to be47279 Compare November 3, 2026 23:19
@gricha
gricha force-pushed the ref/sa-feature-actor branch from be47279 to 3bc2cbc Compare November 4, 2026 00:44
The events, events-stats and trace-item-attributes endpoints pass
acting_user(request.user) to features.batch_has() instead of the raw
principal. Feature handlers here and in getsentry only read the actor as
`actor is not None and actor.is_superuser` or through has_user(), so None
and AnonymousUser behave the same and nothing changes for users or token
callers. Drops the three endpoints from the request.user allowlist.
@gricha
gricha force-pushed the ref/sa-feature-actor branch from 3bc2cbc to 2360efd Compare November 4, 2026 01:15
@gricha
gricha merged commit c849b90 into master Nov 4, 2026
79 checks passed
@gricha
gricha deleted the ref/sa-feature-actor branch November 4, 2026 03:39
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.

3 participants