Skip to content

Commit

Permalink
Merge pull request #175 from pessimistic-io/unprotected-initialize-fix
Browse files Browse the repository at this point in the history
added additional modifiers to pess-unprotected-initializer
  • Loading branch information
Yhtiyar authored Jun 21, 2024
2 parents 91351fa + e82b4b1 commit 9afcabd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions slitherin/detectors/unprotected_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def _is_initialize(self, fun: Function) -> bool:
def _has_modifiers(self, fun: Function) -> bool:
"""Checks if function has modifier protection"""
for modifier in fun.modifiers:
if str(modifier) == "onlyOwner" or str(modifier) == "initializer":
if str(modifier).startswith("only") or str(modifier) in [
"initializer",
"onlyInitializing",
"reinitializer",
]:
return True
return False

Expand All @@ -43,7 +47,7 @@ def _has_require(self, fun: Function) -> bool:
if str(variable.type) == "address":
return True
return False

def _has_if_with_reverts(self, fun: Function) -> bool:
for node in fun.nodes:
if node.contains_if():
Expand Down

0 comments on commit 9afcabd

Please sign in to comment.