Skip to content

ref(api): Narrow request.user in flags, preprod, replays, releases and investigations - #129421

Draft
gricha wants to merge 1 commit into
ref/sa-narrow-seerfrom
ref/sa-narrow-misc
Draft

gricha wants to merge 1 commit into
ref/sa-narrow-seerfrom
ref/sa-narrow-misc

Conversation

@gricha

@gricha gricha commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Flags, preprod, replays, releases, feedback, data export, data secrecy, investigations, workflow engine and superuser-middleware logging read the caller through sentry.auth.principal.

  • A service account can create flag webhook secrets and approve preprod artifacts (recorded with no creator/approver) and gets 404 for data exports it doesn't own; span stars, replay viewed-by and test-fire actions are 403 user-required. New tests cover the first three.
  • Token callers can't read exports with no user (fixed on master on its own in fix(data-export): Don't match exports with no user for callers with no user #129442), and starring a span returns 401 instead of a 500. The flag-secret creator and preprod approver lookups no longer match rows with no user, which changes nothing for tokens in practice: a token's request.access holds every scope, so it already passes the org:write branch, and a null-approver approval is still an approval.
  • Users and agents see no change.

Left: data_export.py (get_or_create keyed on the user), notebooks/base.py (user_id() helper used by about 15 endpoints) and web/client_config.py (Django views typed as DRF requests).

@gricha
gricha added this pull request to stack #129364 October 31, 2026 02:27
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 31, 2026
@sentry

sentry Bot commented Oct 31, 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 removed this pull request from stack #129364 November 1, 2026 04:24
@gricha
gricha force-pushed the ref/sa-narrow-misc branch from 4c95fee to 71d23a5 Compare November 1, 2026 04:24
@gricha
gricha added this pull request to stack #129440 November 1, 2026 04:24
…d investigations

Flags, preprod, replays, releases, feedback, data export, data secrecy, investigations, workflow engine and superuser-middleware logging read the caller through `sentry.auth.principal`.

- A service account can create flag webhook secrets and approve preprod artifacts (recorded with no creator/approver) and gets 404 for data exports it doesn't own; span stars, replay viewed-by and test-fire actions are 403 `user-required`. New tests cover the first three.
- Token callers: no longer count as the creator of a flag secret with no creator (updating it now needs `org:write`), no longer treat a null-approver approval as their own, can't read null-user exports, and starring a span returns 401 instead of a 500.
- Users and agents see no change.

Left: `data_export.py` (`get_or_create` keyed on the user), `notebooks/base.py` (`user_id()` helper used by about 15 endpoints) and `web/client_config.py` (Django views typed as DRF requests).
@gricha
gricha force-pushed the ref/sa-narrow-misc branch from 71d23a5 to 6958b17 Compare November 1, 2026 04:57

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