Skip to content

Fix Lido withdrawal claim access control#243

Closed
TUPM96 wants to merge 1 commit into
OriginProtocol:mainfrom
TUPM96:fix/lido-claim-access-control
Closed

Fix Lido withdrawal claim access control#243
TUPM96 wants to merge 1 commit into
OriginProtocol:mainfrom
TUPM96:fix/lido-claim-access-control

Conversation

@TUPM96
Copy link
Copy Markdown

@TUPM96 TUPM96 commented May 25, 2026

Summary

  • restrict claimLidoWithdrawals to the configured operator or owner
  • wrap only ETH received by the current Lido claim instead of the full contract ETH balance
  • cover unauthorized callers and pre-existing ETH balances in the fork tests

Fixes #241

Verification

  • forge build --skip test script --force
  • forge test --match-path test/fork/LidoARM/ClaimStETHWithdrawalForWETH.t.sol --fork-url https://ethereum.publicnode.com -vv
  • node_modules/.bin/hardhat.CMD compile

Copilot AI review requested due to automatic review settings May 25, 2026 09:17
@TUPM96
Copy link
Copy Markdown
Author

TUPM96 commented May 25, 2026

Closing as duplicate of #242; the earlier PR contains the same mitigation and fuller validation notes.

@TUPM96 TUPM96 closed this May 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR tightens access control around claiming Lido withdrawals and prevents unrelated ETH held by the contract from being wrapped into WETH during claims.

Changes:

  • Restrict claimLidoWithdrawals to operator/owner and wrap only the ETH received from the claim (not pre-existing/donated ETH).
  • Add fork tests for the new authorization requirement and for “only wrap claimed ETH”.
  • Adjust a fork test utility to add ETH to a target address rather than overwrite its balance.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
test/fork/utils/MockCall.sol Changes sendETH utility to increase the target balance instead of replacing it.
test/fork/LidoARM/ClaimStETHWithdrawalForWETH.t.sol Adds revert test for access control and a regression test to ensure donated ETH is not wrapped.
src/contracts/LidoARM.sol Adds onlyOperatorOrOwner and wraps only the net ETH received from claimWithdrawals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


function sendETH(address target) external {
vm.deal(target, address(this).balance);
vm.deal(target, target.balance + address(this).balance);
Comment thread src/contracts/LidoARM.sol
external
onlyOperatorOrOwner
{
uint256 ethBalanceBefore = address(this).balance;
Comment thread src/contracts/LidoARM.sol
Comment on lines +174 to +175
uint256 ethReceived = address(this).balance - ethBalanceBefore;
if (ethReceived > 0) weth.deposit{value: ethReceived}();
Comment thread src/contracts/LidoARM.sol
Comment on lines +144 to +147
function claimLidoWithdrawals(uint256[] calldata requestIds, uint256[] calldata hintIds)
external
onlyOperatorOrOwner
{
assertEq(address(lidoARM).balance, donatedETH);
assertEq(lidoARM.lidoWithdrawalQueueAmount(), DEFAULT_AMOUNT);

stETHWithdrawal.getLastRequestId();
function test_RevertWhen_ClaimLidoWithdrawals_NotOperatorOrOwner() public asRandomAddress {
uint256[] memory emptyList = new uint256[](0);

vm.expectRevert("ARM: Only operator or owner can call this function.");
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.

Bug Report: claimLidoWithdrawals() Missing Access Control

2 participants