@@ -193,6 +193,39 @@ Note that ``.send()`` does **not** throw an exception if the call stack is
193
193
depleted but rather returns ``false `` in that case. The low-level functions
194
194
``.call() ``, ``.delegatecall() `` and ``.staticcall() `` behave in the same way.
195
195
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
+
196
229
tx.origin
197
230
=========
198
231
0 commit comments