Skip to content

Commit

Permalink
Update dos_detector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayarawat19 committed Apr 9, 2024
1 parent e6f8a3a commit 09bae2f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions slither/detectors/functions/dos_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from slither.core.declarations import Contract
from slither.utils.output import Output


def detect_infinite_loop_calls(contract: Contract) -> List[Node]:
ret: List[Node] = []
for f in contract.functions_entry_points:
Expand All @@ -15,6 +16,7 @@ def detect_infinite_loop_calls(contract: Contract) -> List[Node]:

return ret


def detect_infinite_calls(node: Optional[Node], visited: List[Node], ret: List[Node]) -> None:
if node is None:
return
Expand Down Expand Up @@ -49,9 +51,7 @@ class DOSDetector(AbstractDetector):
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#dos-vulnerabilities"

WIKI_TITLE = "DoS Vulnerabilities"
WIKI_DESCRIPTION = (
"Detects functions that may lead to Denial of Service (DoS) attacks"
)
WIKI_DESCRIPTION = "Detects functions that may lead to Denial of Service (DoS) attacks"
WIKI_EXPLOIT_SCENARIO = "---"

WIKI_RECOMMENDATION = "To mitigate DOS vulnerabilities, developers should carefully analyze their contract's public functions. Functions that are not intended to be called externally should be declared as `internal` or `private`."
Expand All @@ -62,7 +62,12 @@ def _detect(self) -> List[Output]:
values = detect_infinite_loop_calls(c)
for node in values:
func = node.function
info = [func, " contains a loop without proper exit condition: ", node, "\n",]
info = [
func,
" contains a loop without proper exit condition: ",
node,
"",
]
res = self.generate_result(info)
results.append(res)
return results
Expand Down

0 comments on commit 09bae2f

Please sign in to comment.