Repository navigation
ref(members): Don't let service accounts manage members - #129638
Merged
Merged
Conversation
Contributor
decision-model-linterapi
decision-model-linter: 18 calls on 6 files, 37,935 input tokens, $0.0016, model typesafe/jev-1.13-20260917 |
Contributor
Sentry Snapshot Testing
|
gricha
force-pushed
the
ref/sa-no-member-management
branch
from
November 3, 2026 02:27
b702167 to
e1c042a
Compare
gricha
force-pushed
the
ref/sa-no-member-management
branch
2 times, most recently
from
November 3, 2026 04:41
2286fff to
f862b22
Compare
gricha
force-pushed
the
ref/sa-no-member-management
branch
from
November 3, 2026 19:53
f862b22 to
efbb57f
Compare
gricha
force-pushed
the
ref/sa-no-member-management
branch
2 times, most recently
from
November 3, 2026 20:09
1b124b9 to
decac06
Compare
azulus
approved these changes
Nov 3, 2026
gricha
force-pushed
the
ref/sa-no-member-management
branch
from
November 3, 2026 20:51
decac06 to
0a8dd99
Compare
gricha
force-pushed
the
ref/sa-no-member-management
branch
2 times, most recently
from
November 3, 2026 23:19
641aab7 to
bfcaeae
Compare
gricha
force-pushed
the
ref/sa-no-member-management
branch
from
November 4, 2026 00:44
bfcaeae to
67e9df3
Compare
Inviting, editing and removing members needs a user. - Member detail endpoints (details, member teams, invite request details) set requires_user. They already returned 404 to callers with no user; a service account now gets 403 user-required instead of reaching the member. - Invites and invite requests call require_user() first. A service account gets 403; a legacy API key, which never had an org role to invite with and got 400, now gets 401. No production invite without a user in the last 30 days. Listing members is unchanged. Drops the four member files from the request.user allowlist.
gricha
force-pushed
the
ref/sa-no-member-management
branch
from
November 4, 2026 01:15
67e9df3 to
67e09cc
Compare
gricha
added a commit
that referenced
this pull request
Nov 4, 2026
… and client config (#129630) Four one-off `request.user` reads, which drops their files from the allowlist (10 → 6). What's left is member management (#129638), data export (#129637) and `group_integration_details.py` (#129639); #129640 then deletes the allowlist. - **Agent tokens:** `resolve_minting_principal()` rejects any caller with no user (`has_user`), not just `AnonymousUser`. A service account used to resolve to a *user* principal carrying its `ServiceAccountId` and fail later; it now gets the same "Minting requires a user principal" 403 as an anonymous caller. The new assertion fails without this change: ``` E AssertionError: assert AgentPrincipal(type=<AgentPrincipalType.USER: 'user'>, id=ServiceAccountId(service_account_id=1)) is <MintingPrincipalRejection.UNSUPPORTED: 'unsupported'> ``` - **Release serialization** takes a `RequestPrincipal`. It only forwards the caller to `serialize()` and `serialize_generic_user()`, which already take one, so this is type-only. - **Notebooks** read the caller through `acting_user_id()`; same value for users and token callers. - **Client config** is built only from Django views, so its request is typed as `HttpRequest`. Type-only.
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.
Service accounts can't invite, edit, remove or provision members. They can still list members. Drops the four member files from the
request.userallowlist (5 → 1).OrganizationMemberEndpoint: member details, member teams, invite request details, SCIM member details) setrequires_user. They already returned 404 to API keys; a service account now gets 403user-required, also when reading a single member (it used to get 200).SCIMEndpoint: users, teams, schemas) setsrequires_user. A service account withmember:writecould provision members through SCIM on an SCIM-enabled org; it now gets 403. SCIM's real caller is the SCIM token's proxy user, which is unaffected.POST members/,POST invite-requests/) callrequire_user()first and record the inviter from it.ServiceAccountId.The new service-account tests fail without this change:
(
test_service_account_cannot_remove_memberalready got 403 before, from theServiceAccountIdguard.)With it, the member index, details, team-details, invite-request and SCIM suites pass, and the endpoint parity matrix moves the member and SCIM rows to user-required (318 passed). The two API-key tests from #129538 now expect 401, and still check that nothing is created.