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
RBAC plugin: array resources + action alias wrapper (TRI-8719 Phase A)
Foundational changes before swapping apiBuilder to rbac.authenticateBearer.
No behaviour change yet — apiBuilder is still on the legacy path.
Array resources:
- @trigger.dev/plugins RbacAbility.can now accepts RbacResource | RbacResource[].
Array form means 'grant access if any element passes', preserving the
legacy checkAuthorization multi-key semantic once TRI-8719 completes.
- internal-packages/rbac ability.ts: permissive/super/deny pass through
unchanged; buildJwtAbility iterates the array and short-circuits on
first match.
Action alias wrapper (internal-packages/rbac/src/index.ts):
- ACTION_ALIASES map + withActionAliases function. Wraps an underlying
RbacAbility so that can(action, resource) retries with alias actions
when the direct check fails. Currently: trigger, batchTrigger, update
are all satisfied by a scope whose action is write — matching legacy
superScope behaviour for route.action values that don't align with
scope prefixes.
- LazyController wraps the ability it gets from authenticateBearer /
authenticateSession. authenticateAuthorize* stop delegating to the
underlying's own Authorize methods (that would bypass the wrapper)
and instead do the inline ability.can check against the wrapped
ability.
The enterprise plugin (TRI-8720) does not need to know about aliases —
the wrapper applies uniformly regardless of which ability came back.
Tests:
- ability.test.ts: +4 tests for array resource form (31 total in file).
- loader.test.ts: +11 tests for withActionAliases (direct match, alias
retry for trigger/batchTrigger/update, id-scoped retry, admin passes,
array form retry, canSuper delegation).
- Unit suite: 31 tests, all passing.
- Webapp typecheck: clean.
0 commit comments