Repository navigation
feat(authz): governed groups bridge + grant ceilings (#797 P2) - #85
Merged
Merged
Conversation
…ts only (INV-6) (docmost#797) INV-4 (A4): a page grant never exceeds the acting human. Granting reader needs their own page view, granting writer (add, or an update that raises) needs page edit, or the workspace-admin disjunct (workspace#admin_cascade, decided on the human only: a recorded exception to the docmost#617 intersection rule). Decided under the page's ACL lock from the actor's own rows first; the PDP's page answer only after a settle fence read under the lock, while the transaction holds no xid. Refused: 403 grant_exceeds_actor, audited page.acl_write_refused. A grant that passes only through the admin disjunct is audited page.acl_admin_override_grant with the PAGE_ACL_ADMIN_OVERRIDE log token. Fence unconfirmed: 503 grant_ceiling_unconfirmed. Lowering and removal stay open. INV-6: a group subject on add or on a raise is 400 group_grant_not_allowed_on_restricted_page (the default group included, INV-5). Existing group grants are grandfathered and reported by a read-only keyset listing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reads (wiki-v2 docmost#797) Service bridge (CCC-owned, no upstream edits): - ServiceGroupController/Service under /api/service/groups (groups:read / groups:write): list (q, limit), get, members (keyset, with externalId), memberships lookup, usage, create, rename, add members (1..200 user externalIds, provisioned like a space add, ON CONFLICT DO NOTHING), remove member (a narrowing route), delete (409 group_in_use while any live space membership or page grant names the group), and default/ensure (409 basic_group_has_grants, log token BASIC_GROUP_HAS_GRANTS). The default group is immutable elsewhere (409 default_group_immutable). - Space member add takes externalId XOR groupId and mode set|atLeast; the group branch locks the group row, applies rule M, upserts on (space_id, group_id), and refuses the default group (400 basic_group_not_grantable, also on re-role). - INV-2 (SpaceGrantCeiling): a write that raises a membership must be covered by the acting human (reader: space view; writer: edit and share; admin: a live direct admin row, own or through a group, or the workspace cascade). Local rows decide under the space lock first; the PDP is asked only after a settle fence read outside any transaction. 403 grant_exceeds_actor, 503 grant_unconfirmed, 503 when the PDP cannot answer. Shared by the writes and the preview. Authz: - directoryRead remote-refusal family: native workspace members, invitations, group list/info/members and space members, 404 + audited. - PdpSearchService returns group suggestions only to a workspace or space administrator. - NARROWING_ROUTES: ServiceGroupController.removeMember. Specs: real-Postgres group control plane, the full INV-2 matrix, a grant racing a just-committed narrowing, INV-5 at each space sink, the group branch, directory-read and group-subject fitness, contract and scope coverage, all mutation-checked. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ds (wiki-v2 docmost#797 P2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…only (INV-6) (wiki-v2 docmost#797 P2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ilings (wiki-v2 docmost#797) Bump service-bridge.openapi.json to 1.16.0 (F1 left the bump to the integrator), name the space-member directory read in the refusal sentence, and document the relayed page-ACL ceilings (INV-4/INV-6). README: the groups family, a 1.16.0 section and the directoryRead refusals, replacing the stale "reads stay reachable" line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…listing (wiki-v2 docmost#797) The paged order is (created_at to the millisecond, id::text) and the unpaged one (created_at, id), the same split as listSpaceMembers, so two members added within one millisecond sorted differently and the spec failed intermittently on the integration run. It now checks the keyset pages against a single paged listing and the member set against the unpaged one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ocmost#797 P2) - Remote mode: the settings sidebar hides Members and Groups (the server's directoryRead refusal answers 404, so they showed empty tables; hiding also drops their hover prefetch), and the space Members tab renders only the Admin Console note, no empty member list. - INV-6 in the UI: the restricted-page picker no longer offers groups (MultiMemberSelect includeGroups, default true), and a grandfathered group grant row offers only its current role or lower (the server refuses a raise). - grant-ceiling-parity.spec.ts pins the schema facts the INV-2 / INV-4 local-row allows rely on (mirrored by the super repo's zed assertions); ROLE_RANK is exported for it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… P2, review round 2) The header's workspace menu linked every remote-mode user to /settings/members, which the server's directoryRead refusal answers 404 (an empty table). The item now renders only in native mode; pinned in feedback-menu.test.tsx (through the real TopMenu). Co-Authored-By: Claude Opus 5.5 <[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.
Fork half of cccvu/wiki-v2#797 P2. It merges two branches built on
74b47d40, the tip ofwiki-v2:feat/797-groups-bridge(F1,b128cd03) andfeat/797-page-grant-ceilings(F2,616234ff). The server changes are all underauthz/,service-bridge/ordocs/integrations/. Review rounds added small client changes in upstream-owned files, each documented in the super repo'sUPSTREAM_MODIFICATIONS.md(seams 9, 38, 140, 144 and 214–218).What it adds
Groups bridge (
/api/service/groups, scopesgroups:read/groups:write). These routes hold data only; the platform authorizes first.q,limit), get a group, page through its members (keyset, withexternalId), look up the groups one identity is in (never provisions it), andusage(what a group grants).externalIds. A group is never a member of a group.409 group_in_use { spaceCount, pageCount }while the group still grants anything.Authz-Propagation).POST default/ensureis the only route that changes it. It is refused with409 basic_group_has_grantswhile any live space membership or page grant names it.409 default_group_immutable.Space members.
addSpaceMember/previewSpaceMembertakeexternalIdXORgroupId, plus an optionalmodeofset(the default) oratLeast. They now answergroupIdandapplied, anduserIdis null for a group.INV-2: space grant ceiling (
SpaceGrantCeiling). A write that raises a membership must be covered by what the acting human holds on the space:space#viewspace#editandspace#shareworkspace#admin_cascade403 grant_exceeds_actor. An unconfirmed fence is503 grant_unconfirmed, and a PDP that cannot answer is a retryable 503.INV-4 / INV-6: page grant ceilings (
authz/page-restriction). These apply to the relayed page-ACL routes.add-permission, and anupdate-permissionthat raises a role, need the actor's ownpage#view(reader) orpage#edit(writer), orworkspace#admin_cascade.403 grant_exceeds_actor, auditedpage.acl_write_refused. An unconfirmed fence is503 grant_ceiling_unconfirmed.page.acl_admin_override_grant(log tokenPAGE_ACL_ADMIN_OVERRIDE).400 group_grant_not_allowed_on_restricted_page. Existing group grants are kept and reported by a read-only keyset listing.INV-5: the default group is never granted. It is refused at every space sink (
400 basic_group_not_grantable, re-role included; removal is still allowed) and at the page sink through INV-6.directoryReadremote-refusal family. In remote mode the native workspace members, invitations, group list / info / members and space members reads answer 404 and are audited asdirectory.native_read_refused. The publicinvites/infostays reachable.PdpSearchServicereturns group suggestions only to a caller who administers the workspace or a space.ServiceGroupController.removeMemberjoinsNARROWING_ROUTES.Bridge contract (
service-bridge.openapi.json)info.versiongoes from 1.15.0 to 1.16.0. F1 left the bump to the integrator.RatePrincipal.docs/integrations/authorization/README.mdgains the groups family, a 1.16.0 section and the directory-read refusals. It also replaces the stale "reads stay reachable" line.Integration notes
service-group.pg.spec.ts, keyset paging). Paged member order is (created_at to the millisecond, id::text) and unpaged order is (created_at, id), the same split aslistSpaceMembers. Two members added within one millisecond could therefore sort differently. The spec now compares the keyset pages against one paged listing. It passed 4 times in a row after the change.Test results (local, Node 26)
scripts/check-upstream-boundary.sh: boundary intact, and the brand guard passes.scripts/ci/docmost-server-typecheck.mjs: forward and reversed passes clean (865 roots).src/authz src/service-bridge src/editor-compat src/common/helpers/prosemirror src/integrations/import(--maxWorkers=2 --workerIdleMemoryLimit=1G): 240 of 241 suites, 4030 passed, 3 failed.authz/collab-ingress/update-guard.spec.ts. The same 3 fail on the base74b47d40locally, so they come from Node 26; CI runs Node 22.postgres:18,AUTHZ_REQUIRE_PG=1, in band; 25 authz / 19 service-bridge / 2 editor-compat specs): 44 of 46 suites passed on the first run.service-group.pg.spec.ts: the flaky spec fixed above.idempotent-page-create.pg.spec.ts: a 5 s conversion timeout under machine load. It passes when rerun alone, and the merge does not touch it.Follow-up
The super-repo re-pin PR follows on cccvu/wiki-v2#797. It carries the platform half and the new log tokens (
PAGE_ACL_ADMIN_OVERRIDE,PAGE_ACL_CEILING_UNCONFIRMED,SPACE_GRANT_UNCONFIRMED,GROUP_WRITE_BUSY,BASIC_GROUP_HAS_GRANTS) incheck-infra-configLOG_TOKENS.Do not merge before the super-repo PR is reviewed.
🤖 Generated with Claude Code
Review rounds (on cccvu/wiki-v2 PR 804)
9fa24412): in remote mode the settings sidebar hides Members and Groups, and the space Members tab shows only the Admin Console note. The restricted-page picker offers people only (MultiMemberSelect includeGroups), and a group grant row is never offered a raise.grant-ceiling-parity.spec.tspins the ceilings' local-allow facts.07d59a3d): the header's "Manage members" link is shown only in native mode.Implementation plan for the set (hub cccvu/wiki-v2 PR 804): https://github.com/cccvu/wiki-v2/issues/797#issuecomment-6760267773