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

obsolete detectors #163

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions slitherin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from slitherin.detectors.arbitrary_call.arbitrary_call import ArbitraryCall
from slitherin.detectors.double_entry_token_possibility import (
DoubleEntryTokenPossiblity,
Expand All @@ -9,12 +11,14 @@
from slitherin.detectors.unprotected_setter import UnprotectedSetter
from slitherin.detectors.nft_approve_warning import NftApproveWarning
from slitherin.detectors.inconsistent_nonreentrant import InconsistentNonreentrant
from slitherin.detectors.call_forward_to_protected import CallForwardToProtected
from slitherin.detectors.obsolete.call_forward_to_protected import (
CallForwardToProtected,
)
from slitherin.detectors.multiple_storage_read import MultipleStorageRead
from slitherin.detectors.timelock_controller import TimelockController
from slitherin.detectors.tx_gasprice_warning import TxGaspriceWarning
from slitherin.detectors.unprotected_initialize import UnprotectedInitialize
from slitherin.detectors.read_only_reentrancy import ReadOnlyReentrancy
from slitherin.detectors.obsolete.read_only_reentrancy import ReadOnlyReentrancy
from slitherin.detectors.event_setter import EventSetter
from slitherin.detectors.before_token_transfer import BeforeTokenTransfer
from slitherin.detectors.uni_v2 import UniswapV2
Expand All @@ -29,19 +33,28 @@
from slitherin.detectors.arbitrum.block_number_timestamp import (
ArbitrumBlockNumberTimestamp,
)
from slitherin.detectors.arbitrum.arbitrum_chainlink_price_feed import ArbitrumChainlinkPriceFeed
from slitherin.detectors.arbitrum.arbitrum_chainlink_price_feed import (
ArbitrumChainlinkPriceFeed,
)
from slitherin.detectors.potential_arith_overflow import PotentialArithmOverflow
from slitherin.detectors.curve.curve_readonly_reentrancy import CurveReadonlyReentrancy
from slitherin.detectors.balancer.balancer_readonly_reentrancy import BalancerReadonlyReentrancy
from slitherin.detectors.vyper.reentrancy_curve_vyper_version import CurveVyperReentrancy
from slitherin.detectors.balancer.balancer_readonly_reentrancy import (
BalancerReadonlyReentrancy,
)
from slitherin.detectors.vyper.reentrancy_curve_vyper_version import (
CurveVyperReentrancy,
)
from slitherin.detectors.price_manipulation import PriceManipulationDetector
from .consts import OBSOLETE_FLAG

artbitrum_detectors = [
ArbitrumPrevrandaoDifficulty,
ArbitrumBlockNumberTimestamp,
ArbitrumChainlinkPriceFeed
ArbitrumChainlinkPriceFeed,
]

obsolete_detectors = [CallForwardToProtected, ReadOnlyReentrancy]

plugin_detectors = artbitrum_detectors + [
DoubleEntryTokenPossiblity,
UnprotectedSetter,
Expand All @@ -51,12 +64,10 @@
OnlyEOACheck,
MagicNumber,
DubiousTypecast,
CallForwardToProtected,
MultipleStorageRead,
TimelockController,
TxGaspriceWarning,
UnprotectedInitialize,
ReadOnlyReentrancy,
EventSetter,
BeforeTokenTransfer,
UniswapV2,
Expand All @@ -70,8 +81,12 @@
CurveReadonlyReentrancy,
BalancerReadonlyReentrancy,
CurveVyperReentrancy,
PriceManipulationDetector
PriceManipulationDetector,
]

if os.getenv(OBSOLETE_FLAG):
plugin_detectors += obsolete_detectors

plugin_printers = []


Expand Down
1 change: 1 addition & 0 deletions slitherin/consts.py
ndkirillov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ARBITRUM_KEY = "SLITHERIN_ARBITRUM"
OBSOLETE_FLAG = "SLITHERIN_OBSOLETE"
SLITHERIN_VERSION = "0.7.0"
4 changes: 4 additions & 0 deletions slitherin/detectors/obsolete/README.md
ndkirillov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Obsolete detectors
These detectors are deprecated.
## How to still use it
Set a flag `SLITHERIN_OBSOLETE=true`
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _detect_low_level_custom_address_call(self, fun: Function) -> bool:
return True
return False

def _pess_is_excluded_from_detector(self, contract: "Contract") -> bool:
def _pess_is_excluded_from_detector(self, contract) -> bool:
path = Path(contract.source_mapping.filename.absolute).parts
is_zep = "openzeppelin-solidity" in path or \
("@openzeppelin" in path and path[path.index("@openzeppelin") + 1] == "contracts") or \
Expand Down
Loading