Skip to content

Commit

Permalink
audit: Function Visibility Can Be Restricted (#198)
Browse files Browse the repository at this point in the history
* fix: space initializer visibility

* fix: enableSpace, disableSpace, isSpaceEnabled visibility on SpaceManager

---------

Co-authored-by: Orlando <[email protected]>
  • Loading branch information
Orland0x and Orlando authored Jun 13, 2023
1 parent 9ce547c commit 4ce13e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Space.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract Space is ISpace, Initializable, IERC4824, UUPSUpgradeable, OwnableUpgra
Strategy[] memory _votingStrategies,
string[] memory _votingStrategyMetadataURIs,
address[] memory _authenticators
) public override initializer {
) external override initializer {
if (_votingStrategies.length == 0) revert EmptyArray();
if (_authenticators.length == 0) revert EmptyArray();
if (_votingStrategies.length != _votingStrategyMetadataURIs.length) revert ArrayLengthMismatch();
Expand Down
10 changes: 5 additions & 5 deletions src/utils/SpaceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ contract SpaceManager is OwnableUpgradeable {

/// @notice Enable a space.
/// @param space Address of the space.
function enableSpace(address space) public onlyOwner {
if (space == address(0) || isSpaceEnabled(space)) revert InvalidSpace();
function enableSpace(address space) external onlyOwner {
if (space == address(0) || spaces[space]) revert InvalidSpace();
spaces[space] = true;
emit SpaceEnabled(space);
}

/// @notice Disable a space.
/// @param space Address of the space.
function disableSpace(address space) public onlyOwner {
function disableSpace(address space) external onlyOwner {
if (!spaces[space]) revert InvalidSpace();
spaces[space] = false;
emit SpaceDisabled(space);
Expand All @@ -46,12 +46,12 @@ contract SpaceManager is OwnableUpgradeable {
/// @notice Check if a space is enabled.
/// @param space Address of the space.
/// @return bool whether the space is enabled.
function isSpaceEnabled(address space) public view returns (bool) {
function isSpaceEnabled(address space) external view returns (bool) {
return spaces[space];
}

modifier onlySpace() {
if (!isSpaceEnabled(msg.sender)) revert InvalidSpace();
if (!spaces[msg.sender]) revert InvalidSpace();
_;
}
}

0 comments on commit 4ce13e5

Please sign in to comment.