Skip to content

test(service-accounts): Add a token column to the service account auth matrix - #131441

Merged
skaasten merged 1 commit into
masterfrom
junioragent/eng-9059-add-a-token-column-to-the-service
Nov 17, 2026
Merged

skaasten merged 1 commit into
masterfrom
junioragent/eng-9059-add-a-token-column-to-the-service

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Now that service account tokens are possible, add this type of auth to the auth test matrix.


Service accounts can now authenticate with a bearer token (#130914) as well as a viewer context. Before GA, both ways in need to be held to the same authorization rules.

This adds a service_account_token column to the service account auth matrix, next to the existing viewer-context column, so every service account row also runs with a bearer token for the same account.

Refs ENG-9059

via @skaasten.

--

View Session [Sentry]

…h matrix

Every service account row in the agent token auth matrix now also runs with a service account bearer token, against the same oracle and the same expected outcomes as the viewer-context column. Known gaps get a strict xfail per credential.

Refs ENG-9059
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

ENG-9059

@skaasten
skaasten marked this pull request as ready for review November 17, 2026 15:26
@skaasten
skaasten requested a review from a team as a code owner November 17, 2026 15:26
@sentry-junior
sentry-junior Bot requested a review from skaasten November 17, 2026 15:27
@skaasten
skaasten requested a review from gricha November 17, 2026 15:28
@skaasten
skaasten merged commit c2645ae into master Nov 17, 2026
79 checks passed
@skaasten
skaasten deleted the junioragent/eng-9059-add-a-token-column-to-the-service branch November 17, 2026 16:37
@skaasten skaasten added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Nov 17, 2026
@skaasten
skaasten deployed to fast-revert November 17, 2026 17:13 — with GitHub Actions Active
@sentry-fast-revert-bot

Copy link
Copy Markdown
Contributor

PR reverted: c7135e4

sentry-fast-revert-bot Bot added a commit that referenced this pull request Nov 17, 2026
…ount auth matrix (#131441)"

This reverts commit c2645ae.

Co-authored-by: skaasten <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on c2645ae in this run:

tests/sentry/seer/endpoints/test_organization_agent_token.py::AgentTokenPublicGetMatrixTest::test_public_mutation_076_GroupAutofix_post — log
SUBFAILED (authentication='service_account_token')
[gw1] linux -- Python 3.13.18 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/seer/endpoints/test_organization_agent_token.py:2626: in _assert_matrix_row
    assert_cell(authentication)
tests/sentry/seer/endpoints/test_organization_agent_token.py:3004: in <lambda>
    lambda authentication: assert_cell(self, endpoint, authentication),
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/sentry/seer/endpoints/test_organization_agent_token.py:3042: in <lambda>
    lambda self, endpoint, authentication: self._assert_public_mutation_authentication(
tests/sentry/seer/endpoints/test_organization_agent_token.py:2933: in _assert_public_mutation_authentication
    self._assert_service_account_outcome(endpoint, authorization_oracle, response)
tests/sentry/seer/endpoints/test_organization_agent_token.py:2433: in _assert_service_account_outcome
    assert matches_oracle, (
E   AssertionError: ('/api/0/organizations/{organization_id_or_slug}/{var}/{issue_id}/autofix/', b'{"run_id":1,"sentry_run_id":"13e3de2f-4...","feature_id":"autofix"}', b'{"detail":{"code":"user-required","message":"This action requires a user.","extra":{}}}')
E   assert False

skaasten added a commit that referenced this pull request Nov 17, 2026
…h matrix (#131473)

Re-lands #131441, which was reverted in
c7135e47542 because it collided with
#131251.

Service accounts can authenticate with a bearer token
(#130914) as well as a viewer context. Before GA, both
need to follow the same authorization rules. This adds a
`service_account_token` column next to the viewer-context column in the
service account auth matrix, so every service account row also runs with
a bearer token for the same account.

#131251 makes POST to `GroupAutofixEndpoint` return 403 `user-required`
for service account tokens. So the token is refused there, but the
viewer context isn't:
- `SERVICE_ACCOUNT_TOKEN_USER_REQUIRED` lists rows that refuse only the
token. Right now that's only `GroupAutofix_post`.
- `_assert_service_account_outcome` takes the authentication. For those
rows it expects `user-required` with token auth, and the viewer context
still has to match the oracle.
- `OrganizationSeerAgentChatEndpoint` refuses tokens the same way, but
it isn't in the public matrix, so it isn't listed.

Test-only change.

Refs ENG-9059

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_1a2399a01a018d2d2e0b438397a5e72d)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_1a2399a01a018d2d2e0b438397a5e72d/?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]>

This branch was successfully deployed

1 active deployment
fast-revert — 64178405 Deployed Nov 17, 2026 by skaasten via revert #10995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Trigger: Revert Add to a merged PR to revert it (skips CI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants