Commit 5547e66
committed
Address PR review: fallback grace window + multi-table query AND + UX
Five real-bug fixes from CodeRabbit + Devin review of #3499:
#1 personalAccessToken.server.ts: FALLBACK_NOT_INSTALLED_ERROR string
was 'RBAC fallback not installed' but the OSS fallback actually
returns 'RBAC plugin not installed'. The mismatch made every PAT
creation with a roleId hit the compensating-delete branch on
self-hosters with no plugin installed — including the dashboard
PAT-creation flow. Aligns the constant with the canonical string.
#2 internal-packages/rbac/src/fallback.ts: authenticateBearer skipped
the revoked-API-key grace window (RevokedApiKey table), so a
freshly-rotated env API key would 401 immediately on the new auth
path. Mirrors findEnvironmentByApiKey's fallback-to-RevokedApiKey
logic so the auth-cross-cutting e2e tests pass.
#3 api.v1.query.ts: multi-table queries built a plain RbacResource
array, which checkAuth treats as 'any element passes'. A JWT
scoped to one detected table could submit a query that also reads
another table it isn't scoped to. Wrap with everyResource — same
AND-semantics fix as the batch trigger routes.
#4 account.tokens/route.tsx: defaultRoleId could land on a custom or
plan-blocked role when userRoleId wasn't in the picker's assignable
set. The action's submit-revalidation would then 400 until the user
manually changed the dropdown. Clamp the default to roles the picker
actually renders.
#5 settings.team/route.tsx: the role Select used defaultValue, so a
failed set-role submit left the attempted role visible while the
server kept the old one. Switch to a controlled value bound to
currentRoleId.1 parent cf3d6e4 commit 5547e66
5 files changed
Lines changed: 49 additions & 13 deletions
File tree
- apps/webapp/app
- routes
- _app.orgs.$organizationSlug.settings.team
- account.tokens
- services
- internal-packages/rbac/src
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
598 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
599 | 603 | | |
600 | 604 | | |
601 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | | - | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
84 | 89 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
| |||
0 commit comments