Files
Felipe MartinandGitHub 647b7e5b6f MM-68830: Preserve unknown permissions during migrations on downgrade (#36888) (#37006)
* MM-68830: Preserve unknown permissions during migrations on downgrade

A server that was upgraded to a newer release (which introduced new
permissions and wrote them into roles) and then downgraded fails fatally
at startup: the permissions migration re-saves every role, and
Role.Save() rejects any permission the older binary does not recognize,
making the downgrade unrecoverable.

Add RoleStore.SavePreservingUnknownPermissions, used only by
doPermissionsMigration, which tolerates and preserves permissions this
build does not recognize (logging a warning) instead of rejecting the
role. The regular Save() — and therefore the role API path — stays
strict, so unknown permissions cannot be introduced through user input.

Unrecognized permissions are kept on disk so they are not lost on a
later re-upgrade.

* MM-68830: assert save forwarding in role cache tests

Address review feedback: assert the underlying store's Save and
SavePreservingUnknownPermissions are actually invoked (the cache
invalidation defer fires regardless of forwarding), and check the
returned errors.

* MM-68830: address review feedback

- Shorten log message in validateForSave
- Rename validationRole -> roleCopy for clarity
- Trim doc comments to describe behavior only
- List all unknown permissions in IsValidWithoutId error
- Assert specific error type in storetest

* MM-68830: add Role.Clone and use it in validateForSave

* MM-68830: add tests for Role.Clone

* MM-68830: fix scheme id deep copy assertion in Role.Clone test
2026-06-11 15:33:13 +02:00
..
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00
2025-10-02 20:24:29 +05:30
2025-06-10 15:04:57 -03:00
2026-01-13 11:59:22 -05:00
2025-06-10 15:04:57 -03:00
2025-06-10 15:04:57 -03:00