Commit 4009d0f
feat(webapp,rbac): REQUIRE_PLUGINS=1 fail-fast for required plugin loads
Adds a deployment-mode opt-in that hardens the plugin loader against
silent degradation. Today, when the RBAC plugin module fails to load —
whether because it's not installed or because a transitive dep is broken —
the loader catches the error and returns the default fallback
implementation. Correct for self-hosters; dangerous in deployments where
the fallback's permissive auth is not an acceptable degraded state.
- internal-packages/rbac/src/index.ts: in LazyController.load()'s catch
block, after logging, throw an Error when `process.env.REQUIRE_PLUGINS
=== "1"`. The throw is captured into `this._init` (a rejected promise),
so it surfaces on the first method call on the lazy controller. The
forceFallback option (used by tests) still wins — it short-circuits
before this code path, so tests aren't broken if a test runner happens
to inherit REQUIRE_PLUGINS from its parent env.
- apps/webapp/app/routes/healthcheck.tsx: call `rbac.isUsingPlugin()`
after the DB ping. For self-hosters (and any deployment with the
plugin loading cleanly) this is a noop. With REQUIRE_PLUGINS=1 and a
failed plugin load, the throw surfaces here — healthcheck returns 500
and the rollout's readiness probe fails, so the new revision is
rolled back before traffic shifts.
REQUIRE_PLUGINS is intentionally plural and generic — future plugin
contracts (audit logs, SSO) can read the same flag without renaming.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1015876 commit 4009d0f
3 files changed
Lines changed: 30 additions & 0 deletions
File tree
- .server-changes
- apps/webapp/app/routes
- internal-packages/rbac/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
108 | 122 | | |
109 | 123 | | |
110 | 124 | | |
| |||
0 commit comments