openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Fix AccessControlDefaultAdminRules admin consistency

Open ernestognw opened this issue 1 year ago • 1 comments

The current AccessControlDefaultAdminRules implementation inherits from the AccessControl behavior, which allows any account to renounce any role even if it hasn't been granted. This is consistent with our policy of allowing NOOPs.

However, when a user renounces the DEFAULT_ADMIN_ROLE without holding it, the action will reset the defaultAdmin() and owner() variables, breaking the invariant that assumes that if an account hasRole(...) == true, then that same account should be both owner() and defaultAdmin()

This PR ensures consistency for the stated invariant.

ernestognw avatar Apr 11 '23 14:04 ernestognw

⚠️ No Changeset found

Latest commit: 218be732e81493c1a7bf05c22fce30ada6e7cffe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 11 '23 14:04 changeset-bot[bot]