You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(web): unrecognized org roles fail closed, and the package testsuite learns canWrite
Two Criticals from review:
1. Fail-open: resolveScope's org branch gated the ACL check on
hasOrgAccess (prefix match only, "org:<accountId>:") but derived
canWrite from orgRole (which validates the role suffix against
ORG_ROLES). A claim with an unrecognized role, e.g.
"org:acc-7:contractor", passed hasOrgAccess, made orgRole return
null, and null !== "member" evaluated to true — an unparseable role
got write access. Fixed by resolving the role once and gating on
role === null (thrown as the same "forbidden" WorkspaceAuthError),
so an unrecognized role loses read too, not just write. canWrite is
now literally role !== "member" over a role proven non-null.
hasOrgAccess is no longer imported into context.ts (still exported
and independently tested in session.ts).
2. CI break: making WorkspaceScope.canWrite required broke
`pnpm --filter @netizen-labs/workspace typecheck` — 15 TS2741/
TS2345 errors across the package's own test suite, which builds
scope literals directly. Added canWrite to every one.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments