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

UnrestrictedWrite for certain Authorization Patterns #93

Open
ritzdorf opened this issue Mar 5, 2019 · 0 comments
Open

UnrestrictedWrite for certain Authorization Patterns #93

ritzdorf opened this issue Mar 5, 2019 · 0 comments
Labels
Bug Something isn't working Enhancement New feature or request Some Day This issue may be worked on some day in the distant future

Comments

@ritzdorf
Copy link
Collaborator

ritzdorf commented Mar 5, 2019

Certain authorization patterns, do not use a direct

require(msg.sender == owner);

and instead perform a mapping-based authorization lookup that leads to the branch condition.
An example is provided below. This currently leads to violations for UnrestrictedWrite.

contract AuthTest {
    mapping(address => bool) isAuthorized;
    uint internal secret;

    constructor() public {
        isAuthorized[msg.sender] = true;
    }

    function setAuthorization(address a, bool v)
        public
        auth
    {
        isAuthorized[a] = v;
    }

    modifier auth {
        require(isAuthorized[msg.sender]);
        _;
    }

    function sensitiveFunc(uint x) public auth returns (bool) {
        secret = x;
    }
}
@ritzdorf ritzdorf added Bug Something isn't working Enhancement New feature or request Some Day This issue may be worked on some day in the distant future labels Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Enhancement New feature or request Some Day This issue may be worked on some day in the distant future
Projects
None yet
Development

No branches or pull requests

1 participant