Grant the passkey permissions to existing roles on upgrade #483

Merged
jcoffey-dev merged 1 commits from fix/478-passkey-upgrade-grants into main 2026-11-19 17:05:59 +00:00
Owner

Fixes #478 (forum t/339).

On an install from before rc.32, nobody holds sysPasskeyGet/Create/Update/Destroy, not even the default administrator. The default roles were stored as explicit lists at install, and granted_permissions.rs never added the passkey permissions on upgrade. It also had no way to grant anything to the user role. So passkeys can't be listed or added anywhere, and an admin can't fix it by hand ("You are not authorized to grant permissions").

Change

  • New User audience in granted_permissions.rs: it grants to the default user role and leaves out the group role. The four passkey permissions go to the user, tenant administrator and administrator roles, once, recorded and respecting a role that disables them, as for the other fork permissions.
  • fork_defaults_reach_upgraded_installs (unit test): fails when DefaultPermissions gives a fork-added permission (SysAiExplain and later, i.e. after the last upstream import) to the user, tenant or administrator role and the upgrade grants don't carry it. grants_match_the_defaults checks the reverse.
  • passkey_tests gets an upgraded-install case:
    • strip the permissions from the stored roles, then check a new account is refused;
    • run the start-up defaults, then check each role has them back, a new account can list its passkeys, and the group role gets none;
    • remove one again, then check it isn't granted twice.

Checked locally

  • cargo test -p common --lib manager::: 39 passed.
  • passkey_tests (RocksDb, its own netns): passed, the new case included.
  • fork checks (name, notice, context, privacy, expr-schema, unittests), cargo fmt --check: clean.
  • ai_explain_tests fails at line 87, before its upgrade section: a real model's answer came back instead of the stub's. This change doesn't touch the AI path, but I didn't check whether the same happens on main.

Release note for the next RC: passkeys now work on installs upgraded from before rc.32, with no action needed.

Fixes #478 (forum t/339). On an install from before rc.32, nobody holds `sysPasskeyGet/Create/Update/Destroy`, not even the default administrator. The default roles were stored as explicit lists at install, and `granted_permissions.rs` never added the passkey permissions on upgrade. It also had no way to grant anything to the user role. So passkeys can't be listed or added anywhere, and an admin can't fix it by hand ("You are not authorized to grant permissions"). **Change** - New `User` audience in `granted_permissions.rs`: it grants to the default user role and leaves out the group role. The four passkey permissions go to the user, tenant administrator and administrator roles, once, recorded and respecting a role that disables them, as for the other fork permissions. - `fork_defaults_reach_upgraded_installs` (unit test): fails when `DefaultPermissions` gives a fork-added permission (`SysAiExplain` and later, i.e. after the last upstream import) to the user, tenant or administrator role and the upgrade grants don't carry it. `grants_match_the_defaults` checks the reverse. - `passkey_tests` gets an upgraded-install case: - strip the permissions from the stored roles, then check a new account is refused; - run the start-up defaults, then check each role has them back, a new account can list its passkeys, and the group role gets none; - remove one again, then check it isn't granted twice. **Checked locally** - `cargo test -p common --lib manager::`: 39 passed. - `passkey_tests` (RocksDb, its own netns): passed, the new case included. - fork checks (name, notice, context, privacy, expr-schema, unittests), `cargo fmt --check`: clean. - `ai_explain_tests` fails at line 87, before its upgrade section: a real model's answer came back instead of the stub's. This change doesn't touch the AI path, but I didn't check whether the same happens on main. Release note for the next RC: passkeys now work on installs upgraded from before rc.32, with no action needed.
jcoffey-dev added this to the 27.1 milestone 2026-11-19 16:46:50 +00:00
jcoffey-dev added the bug
priority
p1
labels 2026-11-19 16:46:50 +00:00
jcoffey-dev self-assigned this 2026-11-19 16:46:50 +00:00
jcoffey-dev added 1 commit 2026-11-19 16:46:50 +00:00
Grant the passkey permissions to existing roles on upgrade
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 12m5s
e844ce5525
An install from before rc.32 stored its default roles without
sysPasskeyGet/Create/Update/Destroy, and granted_permissions.rs never
added them, so nobody on an upgraded install could list or add a passkey.
An administrator couldn't fix it by hand either: you can't grant a
permission you don't hold.

- Add a User audience that grants to the default user role (not the
  group role), and grant the four passkey permissions to the user,
  tenant administrator and administrator roles, once, as for the
  other fork permissions.
- fork_defaults_reach_upgraded_installs: fails when DefaultPermissions
  gives a fork-added permission (SysAiExplain and later) to the user,
  tenant or administrator role and the upgrade grants don't carry it.
- passkey_tests: strips the permissions from the stored roles, checks a
  new account is refused, runs the start-up defaults, and checks every
  role has them back, a new account can list its passkeys, the group
  role gets none, and a removed one isn't granted twice.

Fixes #478
jcoffey-dev merged commit 82346f32a1 into main 2026-11-19 17:05:59 +00:00
jcoffey-dev deleted branch fix/478-passkey-upgrade-grants 2026-11-19 17:05:59 +00:00
Sign in to join this conversation.