Skip to content

bug(platform): a session bound to one organization is told it is "not a member" of the other workspaces it belongs to #4908

Closed

Description

@yannickmonney

Problem

Since #4903, a session minted for one organization (trustedOrganizationId, for example a trusted-header or SSO sign-in) can only use that organization. Every other organization's routes refuse it with 403 ORG_FORBIDDEN and the message "This session is limited to the organization that signed you in." The dashboard reads that refusal as "You're not a member of this workspace", which is wrong for someone who is a member. Paths at main 715dc15ad, under services/platform/.

  • Server: backend/auth/org.ts:63-74 (requireOrgMember) and backend/domains/organizations/routes.ts (/:id, /:id/*) answer ORG_FORBIDDEN with SESSION_ORGANIZATION_MESSAGE when sessionAllowsOrganization fails.
  • Client: app/lib/backend/org.ts:131 maps any ORG_FORBIDDEN from /members/me to { status: 'not_member' }. app/routes/dashboard/$id.tsx:291 then shows accessDenied.noMembership: "You're not a member of this workspace. Contact an administrator for access." (de: "Du bist kein Mitglied dieses Arbeitsbereichs. …", fr: "Tu n'es pas membre de cet espace de travail. …").
  • The right sentence already exists: fix(platform): bind organization session authority #4903 added common.errors.organizationSessionRestricted ("This session is limited to the organization that signed you in."). app/lib/auth/auth-client-error.ts recognizes the refusal by code and message, but only the 2FA and passkey dialogs use it.
  • When it happens: someone who belongs to workspaces A and B signs in through A's single sign-on and then opens a link into B: a bookmark, a task link from an email or chat, or browser history. They're told they aren't a member and should contact an administrator. The fix on their side is to sign in to B differently, which nothing says. The organization switcher now lists only A (organizations/routes.ts, GET /), so B also disappears from the menu without explanation.

Expected

  • Recognize the session-restricted refusal (ORG_FORBIDDEN plus SESSION_ORGANIZATION_MESSAGE, as authSessionRefusalMessage does) in the member-context read. Give it its own state that shows organizationSessionRestricted, with a way to sign out and sign in to this workspace. Keep not_member for real non-members.
  • Consider one line in the switcher or account menu saying this session only covers the organization it signed in to.

Regression: a dashboard layout test where /members/me rejects with 403 { code: 'ORG_FORBIDDEN', message: SESSION_ORGANIZATION_MESSAGE }. The restricted-session message shows, not noMembership. On 715dc15ad it shows noMembership.

Severity and owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions