Skip to content

Commit

Permalink
Revise detector names to be semantically correct with the `//aderyn-i…
Browse files Browse the repository at this point in the history
…gnore..` pattern (#739)
  • Loading branch information
TilakMaddy authored Oct 4, 2024
1 parent ae3ed55 commit 8d5fdc3
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 71 deletions.
52 changes: 30 additions & 22 deletions aderyn_core/src/detect/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ pub(crate) enum IssueDetectorNamePool {
FunctionPointerInConstructor,
DeadCode,
FunctionSelectorCollision,
CacheArrayLength,
AssertStateChange,
ArrayLengthNotCached,
StateChangeInAssert,
CostlyOperationsInsideLoops,
ConstantFunctionChangingState,
BuiltinSymbolShadow,
Expand All @@ -132,18 +132,18 @@ pub(crate) enum IssueDetectorNamePool {
DelegateCallInLoop,
CentralizationRisk,
SolmateSafeTransferLib,
AvoidAbiEncodePacked,
Ecrecover,
HashCollisionDueToAbiEncodePacked,
SignatureMalleabilityDueToRawEcrecover,
DeprecatedOzFunctions,
UnsafeERC20Functions,
UnspecificSolidityPragma,
ZeroAddressCheck,
NoZeroAddressCheck,
UselessPublicFunction,
UnindexedEvents,
RequireWithoutString,
NonReentrantIsNotBeforeOthers,
BlockTimestampIsWeakDeadline,
LiteralInsteadOfConstant,
RequireWithString,
NonReentrantBeforeOthers,
BlockTimestampDeadline,
UnsafeOzERC721Mint,
PushZeroOpcode,
ArbitraryTransferFrom,
Expand Down Expand Up @@ -173,8 +173,8 @@ pub(crate) enum IssueDetectorNamePool {
StateVariableShadowing,
UncheckedSend,
MisusedBoolean,
SendEtherNoChecks,
DelegateCallUncheckedAddress,
SendsEtherAwayWithoutCheckingAddress,
DelegateCallOnUncheckedAddress,
TautologicalCompare,
#[allow(clippy::upper_case_acronyms)]
RTLO,
Expand All @@ -190,7 +190,7 @@ pub(crate) enum IssueDetectorNamePool {
DeleteNestedMapping,
UnusedStateVariable,
ConstantFunctionsAssembly,
BooleanEquality,
RedundantBooleanEquality,
TxOriginUsedForAuth,
MsgValueInLoop,
ContractLocksEther,
Expand Down Expand Up @@ -236,8 +236,10 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
IssueDetectorNamePool::FunctionSelectorCollision => {
Some(Box::<FunctionSelectorCollisionDetector>::default())
}
IssueDetectorNamePool::CacheArrayLength => Some(Box::<CacheArrayLengthDetector>::default()),
IssueDetectorNamePool::AssertStateChange => {
IssueDetectorNamePool::ArrayLengthNotCached => {
Some(Box::<CacheArrayLengthDetector>::default())
}
IssueDetectorNamePool::StateChangeInAssert => {
Some(Box::<AssertStateChangeDetector>::default())
}
IssueDetectorNamePool::CostlyOperationsInsideLoops => {
Expand Down Expand Up @@ -277,10 +279,12 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
IssueDetectorNamePool::SolmateSafeTransferLib => {
Some(Box::<SolmateSafeTransferLibDetector>::default())
}
IssueDetectorNamePool::AvoidAbiEncodePacked => {
IssueDetectorNamePool::HashCollisionDueToAbiEncodePacked => {
Some(Box::<AvoidAbiEncodePackedDetector>::default())
}
IssueDetectorNamePool::Ecrecover => Some(Box::<EcrecoverDetector>::default()),
IssueDetectorNamePool::SignatureMalleabilityDueToRawEcrecover => {
Some(Box::<EcrecoverDetector>::default())
}
IssueDetectorNamePool::DeprecatedOzFunctions => {
Some(Box::<DeprecatedOZFunctionsDetector>::default())
}
Expand All @@ -290,18 +294,20 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
IssueDetectorNamePool::UnspecificSolidityPragma => {
Some(Box::<UnspecificSolidityPragmaDetector>::default())
}
IssueDetectorNamePool::ZeroAddressCheck => Some(Box::<ZeroAddressCheckDetector>::default()),
IssueDetectorNamePool::NoZeroAddressCheck => {
Some(Box::<ZeroAddressCheckDetector>::default())
}
IssueDetectorNamePool::UselessPublicFunction => {
Some(Box::<UselessPublicFunctionDetector>::default())
}
IssueDetectorNamePool::UnindexedEvents => Some(Box::<UnindexedEventsDetector>::default()),
IssueDetectorNamePool::RequireWithString => {
IssueDetectorNamePool::RequireWithoutString => {
Some(Box::<RequireWithStringDetector>::default())
}
IssueDetectorNamePool::NonReentrantBeforeOthers => {
IssueDetectorNamePool::NonReentrantIsNotBeforeOthers => {
Some(Box::<NonReentrantBeforeOthersDetector>::default())
}
IssueDetectorNamePool::BlockTimestampDeadline => {
IssueDetectorNamePool::BlockTimestampIsWeakDeadline => {
Some(Box::<BlockTimestampDeadlineDetector>::default())
}
IssueDetectorNamePool::UnsafeOzERC721Mint => {
Expand Down Expand Up @@ -378,10 +384,10 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
}
IssueDetectorNamePool::UncheckedSend => Some(Box::<UncheckedSendDetector>::default()),
IssueDetectorNamePool::MisusedBoolean => Some(Box::<MisusedBooleanDetector>::default()),
IssueDetectorNamePool::SendEtherNoChecks => {
IssueDetectorNamePool::SendsEtherAwayWithoutCheckingAddress => {
Some(Box::<SendEtherNoChecksDetector>::default())
}
IssueDetectorNamePool::DelegateCallUncheckedAddress => {
IssueDetectorNamePool::DelegateCallOnUncheckedAddress => {
Some(Box::<DelegateCallOnUncheckedAddressDetector>::default())
}
IssueDetectorNamePool::TautologicalCompare => {
Expand Down Expand Up @@ -417,7 +423,9 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
IssueDetectorNamePool::ConstantFunctionsAssembly => {
Some(Box::<ConstantFunctionContainsAssemblyDetector>::default())
}
IssueDetectorNamePool::BooleanEquality => Some(Box::<BooleanEqualityDetector>::default()),
IssueDetectorNamePool::RedundantBooleanEquality => {
Some(Box::<BooleanEqualityDetector>::default())
}
IssueDetectorNamePool::TxOriginUsedForAuth => {
Some(Box::<TxOriginUsedForAuthDetector>::default())
}
Expand Down
5 changes: 4 additions & 1 deletion aderyn_core/src/detect/high/avoid_abi_encode_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ impl IssueDetector for AvoidAbiEncodePackedDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::AvoidAbiEncodePacked)
format!(
"{}",
IssueDetectorNamePool::HashCollisionDueToAbiEncodePacked
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/high/block_timestamp_deadline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl IssueDetector for BlockTimestampDeadlineDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::BlockTimestampDeadline)
format!("{}", IssueDetectorNamePool::BlockTimestampIsWeakDeadline)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl IssueDetector for DelegateCallOnUncheckedAddressDetector {
}

fn name(&self) -> String {
IssueDetectorNamePool::DelegateCallUncheckedAddress.to_string()
IssueDetectorNamePool::DelegateCallOnUncheckedAddress.to_string()
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/high/send_ether_no_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl IssueDetector for SendEtherNoChecksDetector {
}

fn name(&self) -> String {
IssueDetectorNamePool::SendEtherNoChecks.to_string()
IssueDetectorNamePool::SendsEtherAwayWithoutCheckingAddress.to_string()
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/assert_state_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl IssueDetector for AssertStateChangeDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::AssertStateChange)
format!("{}", IssueDetectorNamePool::StateChangeInAssert)
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/boolean_equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ issue_detector! {
severity: Low,
title: "Boolean equality is not required.",
desc: "If `x` is a boolean, there is no need to do `if(x == true)` or `if(x == false)`. Just use `if(x)` and `if(!x)` respectively.",
name: BooleanEquality,
name: RedundantBooleanEquality,

|context| {
for binary_operation in context.binary_operations() {
Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/cache_array_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl IssueDetector for CacheArrayLengthDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::CacheArrayLength)
format!("{}", IssueDetectorNamePool::ArrayLengthNotCached)
}
}

Expand Down
5 changes: 4 additions & 1 deletion aderyn_core/src/detect/low/ecrecover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ impl IssueDetector for EcrecoverDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::Ecrecover)
format!(
"{}",
IssueDetectorNamePool::SignatureMalleabilityDueToRawEcrecover
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/non_reentrant_before_others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl IssueDetector for NonReentrantBeforeOthersDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::NonReentrantBeforeOthers)
format!("{}", IssueDetectorNamePool::NonReentrantIsNotBeforeOthers)
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/require_with_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl IssueDetector for RequireWithStringDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::RequireWithString)
format!("{}", IssueDetectorNamePool::RequireWithoutString)
}
}

Expand Down
2 changes: 1 addition & 1 deletion aderyn_core/src/detect/low/zero_address_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl IssueDetector for ZeroAddressCheckDetector {
}

fn name(&self) -> String {
format!("{}", IssueDetectorNamePool::ZeroAddressCheck)
format!("{}", IssueDetectorNamePool::NoZeroAddressCheck)
}
}

Expand Down
10 changes: 5 additions & 5 deletions reports/adhoc-sol-files-highs-only-report.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8d5fdc3

Please sign in to comment.