Pulse/pkg/auth
rcourtman 3324ef3909 Keep admin recovery reachable when the legacy RBAC import fails
d235aab3c put MigrateFromFiles on a production path for the default org and
failed NewSQLiteManager whenever the import was rejected. That propagated to
GetManager, so every RBAC route returned 503 including ResetAdminRole, which
is the operator's only way back. The realistic trigger is a v5 install that
recreated a role the v6 store already holds under the same ID, so an
ordinary upgrade could leave an operator with no route to repair it short of
hand-editing the legacy JSON.

Rejecting the import is right and stays: importLegacyRBAC is transactional
and the legacy files are left in place, so a failure leaves the database
un-migrated rather than half-migrated. Missing roles deny access rather than
granting it, which is why the store is safe to keep serving.

The store now stays live and records the failure on MigrationError. The
deliberate fail-closed behaviour of the management surface is preserved
rather than removed: the handler manager accessors surface the migration
failure as the same 503 rbac_store_unavailable as before. Recovery reaches
the provider directly, so it is exempt by construction.

The existing 503 contract test is what caught the first attempt at this,
which simply let the surface serve un-migrated data. It now additionally
asserts recovery is reachable, so the two halves are pinned together.
2026-07-24 22:56:09 +01:00
..
auth_test.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
authorizer.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
authorizer_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
coverage_test.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
password.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
permissions.go Enforce server-owned action approval authority 2026-07-11 19:49:17 +01:00
policy_evaluator.go Remove unreachable exported functions from pkg/ 2026-07-10 00:27:35 +01:00
policy_evaluator_test.go Clear all errcheck and gofmt violations so make lint gates on real findings 2026-06-09 21:42:21 +01:00
rbac.go Fix RBAC assignment migration and loading 2026-07-23 22:11:48 +01:00
rbac_global_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
rbac_manager.go fix: replace hallucinated upgrade URLs with correct pulserelay.pro 2026-01-10 22:45:40 +00:00
rbac_manager_test.go fix: replace hallucinated upgrade URLs with correct pulserelay.pro 2026-01-10 22:45:40 +00:00
scopes.go Enforce server-owned action approval authority 2026-07-11 19:49:17 +01:00
sqlite_manager.go Keep admin recovery reachable when the legacy RBAC import fails 2026-07-24 22:56:09 +01:00
sqlite_manager_bench_test.go Clear all errcheck and gofmt violations so make lint gates on real findings 2026-06-09 21:42:21 +01:00
sqlite_manager_queryplan_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
sqlite_manager_test.go Keep admin recovery reachable when the legacy RBAC import fails 2026-07-24 22:56:09 +01:00
token.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00