Skip to content

Commit 96b40d0

Browse files
authored
Expose _isTrustedByTarget internally in ERC2771Forwarder (#5416)
1 parent 13781c1 commit 96b40d0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/famous-timers-compare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openzeppelin-solidity': minor
3+
---
4+
5+
`ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder.

contracts/metatx/ERC2771Forwarder.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,11 @@ contract ERC2771Forwarder is EIP712, Nonces {
302302
*
303303
* This function performs a static call to the target contract calling the
304304
* {ERC2771Context-isTrustedForwarder} function.
305+
*
306+
* NOTE: Consider the execution of this forwarder is permissionless. Without this check, anyone may transfer assets
307+
* that are owned by, or are approved to this forwarder.
305308
*/
306-
function _isTrustedByTarget(address target) private view returns (bool) {
309+
function _isTrustedByTarget(address target) internal view virtual returns (bool) {
307310
bytes memory encodedParams = abi.encodeCall(ERC2771Context.isTrustedForwarder, (address(this)));
308311

309312
bool success;

0 commit comments

Comments
 (0)