Skip to content

Commit 7977c8c

Browse files
committed
Authorized Proxies
1 parent ccdc11e commit 7977c8c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/security-considerations.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,39 @@ Note that ``.send()`` does **not** throw an exception if the call stack is
193193
depleted but rather returns ``false`` in that case. The low-level functions
194194
``.call()``, ``.delegatecall()`` and ``.staticcall()`` behave in the same way.
195195

196+
Authorized Proxies
197+
==================
198+
199+
If your contract can act as a proxy, i.e. if it can call arbitrary contracts
200+
with user-supplied data, then the user can essentially assume the identity
201+
of the proxy contract. Even if you have other protective measures in place,
202+
it is best to build your contract system such that the proxy does not have
203+
any permissions (not even for itself). If needed, you can accomplish that
204+
using a second proxy:
205+
206+
.. code-block:: solidity
207+
208+
// SPDX-License-Identifier: GPL-3.0
209+
pragma solidity ^0.8.0;
210+
contract ProxyWithMoreFunctionality {
211+
PermissionlessProxy proxy;
212+
213+
function callOther(address _addr, bytes memory _payload) public
214+
returns (bool, bytes memory) {
215+
return proxy.callOther(_addr, _payload);
216+
}
217+
// Other functions and other functionality
218+
}
219+
220+
// This is the full contract, it has no other functionality and
221+
// requires no privileges to work.
222+
contract PermissionlessProxy {
223+
function callOther(address _addr, bytes memory _payload) public
224+
returns (bool, bytes memory) {
225+
return _addr.call(_payload);
226+
}
227+
}
228+
196229
tx.origin
197230
=========
198231

0 commit comments

Comments
 (0)