fix(docs): Wiki.js session gate fail-open + read_only rule intersection #191

Merged
haydar merged 1 commit from fix/docs-session-source-permissions into develop 2026-10-31 18:38:45 +00:00
Member

Two confirmed defects behind the Docs 403s and the Home->login->Home
bounce:

  1. The session gate treated broker HTTP errors as a dead-session
    verdict. brokerPost returned null on any non-2xx and the gate
    destroyed the managed session on data === null — so a 429 from the
    broker's throttle:300,1 or a 5xx during a Portal restart
    mass-logged-out Docs: navigations lost wikiSession, hit the
    anonymous SSO bounce, and in-flight /_api calls evaluated as
    anonymous (403, _error/unauthorized). Non-2xx answers are now
    transport failures (undefined -> fail open), matching the
    Forgejo/OpenProject gates and the gate's own documented policy:
    only an explicit {active:false} 200 verdict or an absent
    dwb_session cookie drops a session.

  2. read_only orgs were not actually read-only on Docs. This Wiki.js 3
    beta resolves page access from the pooled group RULES alone — the
    group permissions list is a disjoint admin/route vocabulary that
    never intersects page rules — so collapsing permissions to the
    guest set left every role's write grants in its ALLOW+SUBTREE rule
    intact. ensureWikiJsOrgGroups now intersects the rule roles with
    NativeAuthorizer::WIKIJS_READ_ONLY_PERMISSIONS (new shared const,
    also used by wikijsPermissions and
    DocsAccessService::effectivePermissions), so the provisioned and
    projected rights match again: read:pages/read:assets/
    read:comments/read:history/read:source and nothing else.

Also corrects the "(group globals) ∩ (page rules)" comments that
described a composition model this beta does not implement.

Two confirmed defects behind the Docs 403s and the Home->login->Home bounce: 1. The session gate treated broker HTTP errors as a dead-session verdict. brokerPost returned null on any non-2xx and the gate destroyed the managed session on `data === null` — so a 429 from the broker's throttle:300,1 or a 5xx during a Portal restart mass-logged-out Docs: navigations lost wikiSession, hit the anonymous SSO bounce, and in-flight /_api calls evaluated as anonymous (403, _error/unauthorized). Non-2xx answers are now transport failures (undefined -> fail open), matching the Forgejo/OpenProject gates and the gate's own documented policy: only an explicit {active:false} 200 verdict or an absent dwb_session cookie drops a session. 2. read_only orgs were not actually read-only on Docs. This Wiki.js 3 beta resolves page access from the pooled group RULES alone — the group `permissions` list is a disjoint admin/route vocabulary that never intersects page rules — so collapsing permissions to the guest set left every role's write grants in its ALLOW+SUBTREE rule intact. ensureWikiJsOrgGroups now intersects the rule roles with NativeAuthorizer::WIKIJS_READ_ONLY_PERMISSIONS (new shared const, also used by wikijsPermissions and DocsAccessService::effectivePermissions), so the provisioned and projected rights match again: read:pages/read:assets/ read:comments/read:history/read:source and nothing else. Also corrects the "(group globals) ∩ (page rules)" comments that described a composition model this beta does not implement.
fix(docs): Wiki.js session gate fail-open + read_only rule intersection
All checks were successful
ci / commit-trailers (pull_request) Successful in 10s
ci / secret-scan (pull_request) Successful in 20s
ci / integrations-js (pull_request) Successful in 29s
ci / portal-frontend (pull_request) Successful in 41s
ci / openproject-spec (pull_request) Successful in 26s
ci / release-tests (pull_request) Successful in 1m30s
ci / openproject-rspec (pull_request) Successful in 4m34s
ci / portal-php (pull_request) Successful in 6m31s
2114597144
Two confirmed defects behind the Docs 403s and the Home->login->Home
bounce:

1. The session gate treated broker HTTP errors as a dead-session
   verdict. brokerPost returned null on any non-2xx and the gate
   destroyed the managed session on `data === null` — so a 429 from the
   broker's throttle:300,1 or a 5xx during a Portal restart
   mass-logged-out Docs: navigations lost wikiSession, hit the
   anonymous SSO bounce, and in-flight /_api calls evaluated as
   anonymous (403, _error/unauthorized). Non-2xx answers are now
   transport failures (undefined -> fail open), matching the
   Forgejo/OpenProject gates and the gate's own documented policy:
   only an explicit {active:false} 200 verdict or an absent
   dwb_session cookie drops a session.

2. read_only orgs were not actually read-only on Docs. This Wiki.js 3
   beta resolves page access from the pooled group RULES alone — the
   group `permissions` list is a disjoint admin/route vocabulary that
   never intersects page rules — so collapsing permissions to the
   guest set left every role's write grants in its ALLOW+SUBTREE rule
   intact. ensureWikiJsOrgGroups now intersects the rule roles with
   NativeAuthorizer::WIKIJS_READ_ONLY_PERMISSIONS (new shared const,
   also used by wikijsPermissions and
   DocsAccessService::effectivePermissions), so the provisioned and
   projected rights match again: read:pages/read:assets/
   read:comments/read:history/read:source and nothing else.

Also corrects the "(group globals) ∩ (page rules)" comments that
described a composition model this beta does not implement.
haydar scheduled this pull request to auto merge when all checks succeed 2026-10-31 18:32:32 +00:00
haydar merged commit fc55b0e307 into develop 2026-10-31 18:38:45 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
developing4all/devworkbase!191
No description provided.