Restrict guest visibility to accessible spaces - #65
Open
ArtyomSavchenko wants to merge 4 commits into
Open
Conversation
Signed-off-by: Artem Savchenko <armisav@gmail.com>
Signed-off-by: Artem Savchenko <armisav@gmail.com>
Signed-off-by: Artem Savchenko <armisav@gmail.com>
ArtyomSavchenko
marked this pull request as ready for review
August 1, 2026 03:43
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
Guest / ReadOnlyGuest / DocGuest accounts could see far more than intended:
contact.space.Contacts, so any guest could browse every person in the workspace regardless of project membership — while the @-mention picker was simultaneously broken, always empty, sincesearchFulltextexcludes system spaces for these roles.Collaborator,love.class.MeetingMinutes/RoomInfo,hr.class.Request,notification.class.PushSubscription,guest.class.PublicLinkall live incore.space.Workspace(a hardcodedmainSpace, never filtered by role) — guests could read other people's meeting attendance, HR requests, push-subscription records, and share links.findAll.OnEmployeeCreatecopied the anonymous read-only account's space membership onto every new named Guest, so a guest could inherit access to any space ever marked "visible to anonymous," regardless of that space's auto-join settings.Changes
foundations/server/packages/middleware/src/spaceSecurity.ts(new logic factored intoguestVisibility.tsto keep this file from growing further):findAll/searchFulltext: open (no_id) Person/Employee queries are narrowed to accounts sharing a real space with the caller;_id/$inqueries bypass (resolving an already-visible reference).searchFulltextnow letscontact.space.Contactsthrough for these roles but applies the same allow-list to results, fixing the empty picker without exposing everyone.findAll: per-class restriction for the sensitive classes above — self-scoped for Collaborator/HR Request/PushSubscription, collaborator-gated for MeetingMinutes, denied outright for RoomInfo/PublicLink (no legitimate open-browse path).love.class.Roomintentionally excluded — no membership concept exists on it yet.findAll+searchFulltext: spaces belonging to a role-disabledModulePermissionGroupare excluded from both, so a disabled app is fully unreachable rather than just hidden from the sidebar/search.server-plugins/contact-resources/src/index.ts:OnEmployeeCreateno longer copies the anonymous-guest account's space membership onto new named guests; onlyautoJoinForRoles/explicit invite grants apply.