Skip to content

🔒 Security: Fix pragma, zero-address validation, and ETH recovery#26

Open
canychan wants to merge 1 commit into
libevm:masterfrom
canychan:security-fixes-multiple
Open

🔒 Security: Fix pragma, zero-address validation, and ETH recovery#26
canychan wants to merge 1 commit into
libevm:masterfrom
canychan:security-fixes-multiple

Conversation

@canychan
Copy link
Copy Markdown

This PR addresses three low-severity security findings identified during an automated audit:

1. SWC-103: Floating Pragma

Files: contracts/src/Sandwich.sol, contracts/src/lib/SafeTransfer.sol

  • Changed pragma solidity >=0.8.0; to pragma solidity 0.8.19;
  • Pinning the compiler version ensures reproducible builds and prevents unexpected behavior from future compiler changes.

2. SWC-123: Missing Zero Address Validation

File: contracts/src/Sandwich.sol

  • Added require(_owner != address(0), "Invalid owner"); in the constructor.
  • Prevents accidental deployment with a zero address, which would permanently brick the contract.

3. SWC-105: ETH Locked

File: contracts/src/Sandwich.sol

  • Added recoverETH() function with owner-only access control.
  • Allows recovery of accidentally sent ETH that would otherwise be permanently locked in the contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant