Skip to content

Commit

Permalink
removing interface safety (it makes no sense looking back)
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Jul 29, 2024
1 parent 94e47d8 commit d890496
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
11 changes: 1 addition & 10 deletions aderyn_core/src/detect/high/contract_locks_ether.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl IssueDetector for ContractLocksEtherDetector {
/// Handles tasks related to contract level analysis for eth
mod contract_eth_helper {
use crate::{
ast::{ASTNode, ContractDefinition, ContractKind, StateMutability, Visibility},
ast::{ASTNode, ContractDefinition, StateMutability, Visibility},
context::{
browser::ExtractFunctionDefinitions, investigator::*,
workspace_context::WorkspaceContext,
Expand Down Expand Up @@ -98,15 +98,6 @@ mod contract_eth_helper {
let contracts = self.linearized_base_contracts.as_ref()?;
for contract_id in contracts {
if let ASTNode::ContractDefinition(contract) = context.nodes.get(contract_id)? {
if contract.kind == ContractKind::Interface {
// In this case, to be safe, we assume that when the interface is implemented, it
// will allow for withdrawals. So we give it a pass. This is to prevent false positives

// However this is debatable...Maybe in auditor mode you don't want to assume this.
// Either case, I am making this comment so we're aware of this.
return Some(true);
}

let funcs = contract
.function_definitions()
.into_iter()
Expand Down
6 changes: 6 additions & 0 deletions reports/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,12 @@
"line_no": 44,
"src": "630:11",
"src_char": "630:11"
},
{
"contract_path": "src/eth2/DepositContract.sol",
"line_no": 58,
"src": "4547:15",
"src_char": "3059:15"
}
]
}
Expand Down
8 changes: 7 additions & 1 deletion reports/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ A deletion in a structure containing a mapping will not delete the mapping. The

It appears that the contract includes a payable function to accept Ether but lacks a corresponding function to withdraw it, which leads to the Ether being locked in the contract. To resolve this issue, please implement a public or external function that allows for the withdrawal of Ether from the contract.

<details><summary>4 Found Instances</summary>
<details><summary>5 Found Instances</summary>


- Found in src/ContractLocksEther.sol [Line: 5](../tests/contract-playground/src/ContractLocksEther.sol#L5)
Expand All @@ -1717,6 +1717,12 @@ It appears that the contract includes a payable function to accept Ether but lac
contract EmptyBlocks {
```

- Found in src/eth2/DepositContract.sol [Line: 58](../tests/contract-playground/src/eth2/DepositContract.sol#L58)

```solidity
contract DepositContract is IDepositContract, ERC165 {
```

</details>


Expand Down
11 changes: 11 additions & 0 deletions reports/report.sarif
Original file line number Diff line number Diff line change
Expand Up @@ -2522,6 +2522,17 @@
"byteOffset": 630
}
}
},
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/eth2/DepositContract.sol"
},
"region": {
"byteLength": 15,
"byteOffset": 4547
}
}
}
],
"message": {
Expand Down

0 comments on commit d890496

Please sign in to comment.