Repository navigation
fix(seer): Keep service account actors when resolving Seer viewer context - #128718
Merged
Merged
Conversation
gricha
marked this pull request as ready for review
October 23, 2026 22:56
gricha
force-pushed
the
fix/seer-viewer-context-service-account
branch
from
October 23, 2026 23:06
3ee4732 to
e647437
Compare
gricha
force-pushed
the
ref/use-viewercontext-lib
branch
from
October 23, 2026 23:06
fee7d0f to
0a10c37
Compare
…text An explicit SeerViewerContext user_id replaced a service-account actor with that user, so Seer's echoed context authenticated as a human.
gricha
force-pushed
the
fix/seer-viewer-context-service-account
branch
from
October 24, 2026 01:45
e647437 to
2b7f674
Compare
DominikB2014
approved these changes
Oct 26, 2026
skaasten
added a commit
that referenced
this pull request
Oct 29, 2026
…oint (#128779) The viewer-context endpoint now signs a typed `(service_account, id)` ViewerContext instead of Seer's org-only one, and Sentry can authenticate requests that carry it (service accounts design, step 6). - **Authentication:** `ViewerContextAuthentication` sends service-account contexts to `authenticate_service_account()` before the user path, which resolves the active account from its cell replica on every request. `request.user` stays anonymous; `request.auth` is an `AuthenticatedToken` with `kind="service_account"` and the account's current scopes, so narrowing, disabling or deleting an account applies to already-issued tokens once it replicates. - **Access:** `ServiceAccountAccess` limits the account to its org and scopes. Open-membership orgs grant every active project and team; otherwise only linked active projects and no teams. Those projects also count as its "member" projects, so default project lookups and release endpoints return them. - **seer-rpc:** `SeerRpcViewerContextAuthentication` rejects service-account contexts. seer-rpc methods trust their `org_id` argument and skip access checks, so accepting them would bypass the account's scopes, project links and disabled state. This also stops one account from getting a context for another through the viewer-context endpoint. - **Release permission cache:** service accounts skip the 60s cache, since their IDs would share `apikey:` keys with API keys. Nothing calls the endpoint yet. No seed or backfill is needed, but an account must exist and replicate before Seer can request its context. Builds on #128718 (merged), which keeps the actor intact when Sentry calls Seer. Follow-ups: rate limits are still per IP rather than per account, and holders of the shared signing key can still sign these contexts directly (ENG-8830). Refs ENG-8829 <!-- junior-request-attribution:start --> via **shaun.kaasten**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0BAS2BU2TC%3A1793030532.196199 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AD0BAS2BU2TC%3A1793030532.196199) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0BAS2BU2TC%3A1793030532.196199/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Shaun Kaasten <[email protected]> Co-authored-by: Shaun Kaasten <[email protected]>
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.
When a call to Seer passes an explicit
SeerViewerContextwith auser_id,_resolve_viewer_contextreplaced any non-user, non-agent actor with a USER actor for that id, without logging a mismatch. For a service account that means Seer receives — and echoes back — a context that Sentry then authenticates as a human.A service account is now kept as-is: the explicit
user_idis treated as a mismatch (warning logged, superuser and project stripped). SYSTEM / INTEGRATION / UNKNOWN still adopt the explicit user, since tasks and webhooks rely on that to attribute work to a user.No service-account producers exist yet; this needs to land before they do. Stacked on #128628.