Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 824 Bytes

UniswapPublicCallback.md

File metadata and controls

40 lines (28 loc) · 824 Bytes

UniswapPublicCallback

Info

Spec

  • Severity: High
  • Confidence: High

Description

Callers of callback functions are not exclusively restricted to the contract itself.

Sample

abstract contract BaseHook is IHooks {
    modifier selfOnly() {
        if (msg.sender != address(this)) revert NotSelf();
        _;
    }
}

contract Hook is BaseHook {
    uint count;

    constructor(IPoolManager _poolManager) BaseHook(_poolManager) {}

    function foo() external {
        poolManager.lock(abi.encodeWithSignature("callback()"));
    }

-    function callback() external {
+    function callback() external selfOnly {
        count++;
    }
}

For any callback functions that are called by lockAcquired using external calls, there should be an only-self check (no need for internal callback).