Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_setupRole not in constructor #107

Open
code423n4 opened this issue Nov 18, 2021 · 2 comments
Open

_setupRole not in constructor #107

code423n4 opened this issue Nov 18, 2021 · 2 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working invalid This doesn't seem right sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Handle

pauliax

Vulnerability details

Impact

_setupRole is used in function setSentinel. This is not a recommended approach.
See the warning: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/access/AccessControl.sol#L183-L189

Recommended Mitigation Steps

OZ suggests using _grantRole when you need to assign roles not from the constructor.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Nov 18, 2021
code423n4 added a commit that referenced this issue Nov 18, 2021
@Xuefeng-Zhu Xuefeng-Zhu added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Nov 23, 2021
@Xuefeng-Zhu
Copy link
Collaborator

_grantRole is private

@0xleastwood
Copy link
Collaborator

This is a best security practice. Incorrectly using OpenZeppelin's AccessControl library may lead to unintended consequences as the admin account can call setSentinel multiple times.

@Xuefeng-Zhu Xuefeng-Zhu added invalid This doesn't seem right and removed invalid This doesn't seem right labels Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working invalid This doesn't seem right sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

3 participants