Repository navigation
fix(group_users): don't return sensitive fields - #462
Merged
Merged
Conversation
The group_users index hydrates each row with its user so the frontend can render a member list without an N+1 fetch. It embedded the raw `Model::User`, whose default JSON includes `password_digest`, `access_token`, `refresh_token`, `expires_at` and `expires`. Any group manager (not only admins) could read them for every member. Embed `User::PublicResponse` (`to_public_struct`) instead, matching what #461 did for the users controller. OPENAPI_DOC.yml is regenerated: `GroupUser.user` now references `PlaceOS.Model.User.PublicResponse`, and it also picks up the /users response schema changes from #461, which were never regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- chatgpt: show, destroy and websocket resume only resolve the caller's own chat; anyone else's is a 404 (resume is checked before the upgrade) - oauth_apps: index returns a secret-free view to non-admins - flux: refuse guest tokens, any signed in user can still query - emails: index and show are support / admin only - api_keys: embed the owner as User::AdminResponse instead of the raw model, which serialised the password digest and SSO tokens Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
GET /api/engine/v2/group_users/adds the group and the user to each row, so thefrontend can show a member list without fetching each user separately.
The user it adds was the raw
Model::User, and that object's JSON includes:password_digestaccess_token/refresh_token(the stored SSO tokens)expires_at/expiresThis isn't limited to admins. Any group manager sees these fields for every
member of the groups they manage.
#461 fixed the same leak in the users controller but didn't touch this one.
Fix
The embedded user is now
User::PublicResponse(to_public_struct): the sameallow-listed public view that
/usersgives non-admins. It's the public viewfor every caller, admins included, so these rows also no longer include
admin-only fields (
sys_admin,support,misc,login_name,card_number,ui_theme).Breaking change for clients
The
userobject ingroup_usersindex rows now contains only thePUBLIC_DATAfields plusid. Any client that read other fields from itwill stop getting them. Users can still get their own full profile from
GET /users/current.Tests
New
sensitive fieldsspecs inspec/controllers/groups/user_spec.crrun asboth a group manager and a sys_admin. Each one adds a member that has a password
and SSO tokens, lists the group, and checks that:
Both new specs failed before the fix and pass with it. The 4 existing
group_usersspecs still pass.OpenAPI
OPENAPI_DOC.ymlis regenerated.GroupUser.usernow points toPlaceOS.Model.User.PublicResponse.It also includes the
/usersresponse schema changes from #461, which neverregenerated the doc: create, update and the search endpoints now return the
response-struct union instead of
PlaceOS.Model.User.