Skip to content

Commit 00e1628

Browse files
committed
First pass for blocking delegateCalls
1 parent 97b6d94 commit 00e1628

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/borgCore.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,18 @@ contract borgCore is BaseGuard, BorgAuthACL, IEIP4824 {
196196
lastNativeExecutionTimestamp = block.timestamp;
197197
}
198198

199+
// Block all delegate calls by default in blacklist mode
200+
if(operation == Enum.Operation.DelegateCall) {
201+
// Only allow if contract is explicitly whitelisted for delegate calls
202+
if(!policy[to].enabled || !policy[to].delegateCallAllowed) {
203+
revert BORG_CORE_DelegateCallNotAuthorized();
204+
}
205+
}
206+
199207
//black list contract calls w/ data
200208
if (data.length > 0) {
201209
if(policy[to].enabled) {
202210
if(policy[to].fullAccessOrBlock) revert BORG_CORE_InvalidContract();
203-
if(!policy[to].delegateCallAllowed && operation == Enum.Operation.DelegateCall) {
204-
revert BORG_CORE_DelegateCallNotAuthorized();
205-
}
206211

207212
if(!isMethodCallAllowed(to, data))
208213
revert BORG_CORE_MethodNotAuthorized();

0 commit comments

Comments
 (0)