DSS

DSS 2026 / Day 1 / Pearl Hall

Guarding the Guard: Engineering a Deny-by-Default Policy Engine for Safe

Shebin John

13:35 · Recording

Watch on YouTube ↗Open recording viewerOriginal programme entry
Download plain textDownload timestamped JSON

Source: YouTube automatic caption track · Exported 2026-11-16. Timestamps link to the source video. Cue end times were not supplied.

Transcript

0:00Okay, better.

0:02So, what I was saying, so every safe can

0:04install a guard and

0:07that is one of the best defense

0:09contracts out there for a safe.

0:11At the same time, that is one of the

0:13most dangerous contract because it can

0:15basically refuse any transaction even

0:17with an owner signature.

0:19So,

0:21if that is the case

0:23and any transaction which is being

0:25executed is checked by a guard, who

0:28checks the transaction which removes a

0:30guard?

0:31Is it the owners? Is it something else?

0:34And that is the paradox we are trying to

0:36figure out for the next few minutes.

0:39So, before

0:41want to make sure that everyone

0:43understands how a safe works. So, there

0:46is a set of owners, usually an of M is

0:49the configuration and N signers has to

0:52sign for a transaction to be executed

0:55and I usually mention it as the front

0:57door for the safe. Then we have the

0:59modules who have its own configuration.

1:02It has its own logic and that is

1:04basically the side door. Now, to protect

1:07these two doors, we have the guard which

1:10basically can be considered as the

1:12bouncer for the safe.

1:16From say 1.3.0, we have the transaction

1:19guard and from

1:21say 1.5.0, we have also the module

1:23guard.

1:25So, these are the three guards which we

1:28built over the last year and basically

1:31the guard rail is just a deny for a

1:34delegate call transactions. Then we have

1:36the fiducia which is

1:39some allow list as well as the co-signer

1:41and then we have the holy grail of

1:43guards which is the policy engine.

1:46So, as an analogy, you can think that

1:48guard rail is just a single tool, let's

1:50say a screwdriver. Fiducia is like the

1:52Swiss Army knife. It can do a lot but

1:54not everything and then we have the

1:57policy engine which is a toolbox for a

2:00and the limits are just the imagination

2:03of the developer.

2:05So

2:06there are two ways through which we can

2:08use the policy engine. The first one is

2:11fail open and the second one is the fail

2:13close. So what are those? So fail open

2:16is when you only deny certain

2:19transaction in the policy engine and the

2:21rest is allowed.

2:22And the fail closed is when any

2:25transaction which you want to be

2:26executed is approved specifically and

2:29then the rest is denied by default.

2:32And based on the coloring you can see

2:34that I align a bit to more towards on

2:37the fail close because this provides the

2:39highest amount of security for a safe.

2:45So before we move forward, how a

2:47transaction moves through safe? Let's

2:50look at that. So if it's a normal

2:52transaction, the owner signs it, then

2:55the safe

2:56goes through the execution through the

2:57exit transaction.

2:59The policy guard checks if that is an

3:02allowed policy or within the allowed

3:04policy or not and then the execution is

3:06allowed.

3:07Same goes for the module. If

3:10based on the logic of the module, if the

3:12transaction is allowed,

3:13then it goes through the safe, then it

3:16goes to the guard and the policy guard

3:18checks if any policies allows these

3:20module, then the execution is allowed.

3:24How do we select each transaction? How

3:27do we select each policies? Is based on

3:29something we called as the access

3:31selector.

3:32Right now it is based on three things,

3:34two

3:35selector and the operation.

3:37Two is the target address where the

3:39transaction is being called.

3:41Selector is the function which we are

3:43going to call and the OP is the

3:45operation whether it is called or a

3:47delegate call.

3:48There are some zero bytes which we have

3:50reserved for future developments.

3:53So how do we select the policies based

3:55on this access selector? So let's say

3:57that we have a USDC transferred to say

4:00XYZ account. So we look at the token

4:03address, the selector that is transfer,

4:05and the operation that is called, and

4:07then we execute the transaction if there

4:09is a policy for that.

4:11If not, we fall back to the fallback

4:13policy, which

4:15may allow or may not allow based on its

4:18own particular logic. And even

4:21these two policies are not allowing this

4:23transaction, then the access is denied.

4:27So, policies are basically small

4:28contracts. So, there are like gated

4:31policies like allow policy, deny policy,

4:33and one-time allow policies. Shape of

4:36the call is another big factor, that is

4:38whether it is a transfer call, whether

4:40it's an approve, or it is something

4:42else. Then we have the extra approval

4:45policies like co-signer policies or

4:48increase threshold policy, and one of

4:50the best things is Safe Net policies,

4:52which we will talk further.

4:54And of all these things, there are

4:57sometimes batch transaction which is

5:00which Safe is known for. And that is

5:02where we use the multi-send policy,

5:04which basically distributes it to its

5:06own particular policies. Let's say that

5:09multi-send policies have multiple

5:11approve and transfer, then it goes to

5:12the shape of the call policies.

5:15So, let's look at the Safe Net as a

5:17policy. So, why this is important,

5:20especially in the context of policy

5:21engine, is that

5:22policy engine is much more static,

5:24on-chain. It's much more rigid, and that

5:27is by design. It is not a bug.

5:29And this is where Safe Net comes in. And

5:32Safe Net allows the flexibility which

5:35the policy engine requires. So, how the

5:37Safe Net works is mainly depending on

5:40three factors or three parts. The first

5:43one is the sentinel, which basically

5:46checks the transaction which needs to be

5:48executed, whether it is malicious or

5:50not, whether it should be allowed or

5:51not.

5:52If there is a unanimous approve, then it

5:55goes to the validators, which does a

5:57frost attestation. We use frost

5:59threshold signature scheme.

6:00And once that attestation is

6:03received, we can use that same

6:06in the guard which is within the policy

6:08engine as a policy. We call that as a

6:10safe net policy.

6:13So let's look at an example. So you have

6:16a treasury which you own and you usually

6:19do a USDC transfer or a stable coin

6:21transfer and by human mistake or you

6:24were lazy at that day or something else

6:26happened, you approved a transaction

6:29which was malicious

6:30and you didn't knew that until the safe

6:33net

6:34or the policy engine guard

6:36caught it. So there are two

6:39different scenarios here. One, you

6:41allowed a transaction which was not

6:43supposed to be allowed and that gets

6:45executed which can basically drain your

6:47wallet and the another one is with the

6:50policy engine and that basically caught

6:53it and you were saved by the tree.

6:56So now until now we looked at how the

6:59guard can actually save you.

7:01Now we also want to look at how the

7:03guard can hurt you because that is one

7:05important step we need to consider.

7:08So

7:09first thing is that you installed a

7:11guard which was only on the transaction

7:13side of things, not on the module side

7:15of things. So basically you open

7:18you have a bouncer on the front gate but

7:20not on the side gate. So you need to

7:22make sure that when you install a guard

7:24you need to install it both on the

7:26transaction path as well as on the

7:27module path.

7:28Then the second one is not on the most

7:31dangerous side but also a bit on the

7:34annoying side is

7:36on the configuration part. So before you

7:39install the guard in install the policy

7:41engine guard, you need to also configure

7:43it and you need to configure based on

7:45all the transaction which you do and if

7:48you do that that's much more easier when

7:50you install the guard those transactions

7:52are already allowed and the rest of it

7:54is denied. If not it's a bit annoying,

7:57not the worst case scenario. It's just

7:59that you need to now configure it

8:01and wait for the delay.

8:04So how does changing the rule happens?

8:06You request a configuration, you need to

8:08wait for a delay. This is the public and

8:11the slow period where you as an owner

8:14can take action if it's not a

8:18required configuration or if it is a

8:20malicious configuration and things like

8:22that.

8:23Once the delay passes, you have a

8:25certain window which you can

8:29implement or apply this configuration.

8:31And why this certain window is there is

8:34because so that you added a

8:36configuration and the delay happened and

8:40now you wait for another year for that

8:42application to be

8:43configured. So this is why we have this

8:46expiry added.

8:48And once this

8:49application is done within this expiry

8:52period, the policy is alive on the

8:56policy is alive on the

8:57policy engine.

8:58So

9:00where what you have to look at it here

9:02is that that when you do a

9:05when you

9:06apply a configuration,

9:08you can have that particular delay

9:10period where you can basically remove

9:13this configuration if it is let's say a

9:16malicious one or if it is something

9:17non-intended or the circumstance has

9:20changed.

9:21But once these policies are alive in

9:24safe and through the policy engine,

9:27it takes a delay for these to be

9:29changed.

9:31So now what the delay buys? We need to

9:34make sure that we understand what it

9:36does and what it does not. So first

9:38thing is time.

9:40It basically gives you the particular

9:42delay period to react.

9:44It is visible in public blockchain. So

9:47any change you make it is

9:49online on chain. So you have the time to

9:52react to these things.

9:54And

9:55also if let's say that the configuration

9:57was the malicious transaction,

9:59it is not one step draining of account.

10:02You have more steps. You have to wait

10:05out for these things to happen.

10:07Now what is

10:08not promised?

10:10So this is

10:11the part where you need to focus when in

10:14terms of the policy engine, what it does

10:16and what it does not.

10:18So

10:19immunity is one thing. If let's say that

10:21all the owners are compromised,

10:24then in that case those owners or the

10:26malicious owners now can wait out the

10:28delay.

10:29The second is judgment and

10:32this is based on human judgment. Let's

10:34say that you approved a configuration

10:36after a particular delay and that was a

10:38malicious recipient or something like

10:40that. This is something which you cannot

10:42avoid through policy engine.

10:44The third is rescue. So the guard cannot

10:48refuse a transaction. It can only let

10:51say that block it for certain time or

10:53certain degree.

10:55And then

10:56the most important thing is monitoring.

10:58If let's say that you don't monitor your

10:59safe through this configuration, then

11:02any policy change is basically something

11:05which you didn't notice and it can get

11:07executed.

11:09So

11:10where the checks and the execution

11:12diverge in terms of even policy engine.

11:13So there are things which we can improve

11:16on the policy engine. Some of these are

11:18mentioned in the screen.

11:19One thing which I want to

11:21stress is about the multisend which was

11:24I think found by Certora itself during

11:27an audit is that a pre-state within the

11:30multisend

11:31cannot

11:32be checked after the pre- after the

11:34post-state. So let's say that you in a

11:36multisend change the owners on the first

11:38transaction.

11:40The rest of the transaction is checked

11:41still on the pre-state, not on the

11:43post-state of that owner change, which

11:44is a known thing which we may improve in

11:47the future.

11:50So

11:51today after you are going home from this

11:54talk, I want to ask these five I want

11:57you to ask these five questions to

11:59yourself, to your own setup.

12:02Where does your safe fail? Is it open or

12:04is it closed?

12:06What are the lockout paths?

12:08Half installed states and things like

12:09that.

12:10How fast you can change something in

12:12your own safe?

12:14What joins as a trusted thing in your

12:17safe and what is actually promised and

12:19what is only implied in your safe?

12:24So

12:25we started with the paradox saying that

12:28a guard

12:31is checking its own transaction to be

12:33removed.

12:34Who checks the guard? And the answer is

12:36not let's say a clever transaction or a

12:40clever contract. It is basically some

12:42habits.

12:43One of it is deny by default. So

12:46anything which you haven't specified

12:49gets refused in the safe.

12:52One policy per call so that all the

12:55rules which you have mentioned

12:57is abided by within the safe.

12:59And the last one is any change in the

13:02configuration

13:04it is public

13:05and it is loud. So anything which you

13:09haven't configured you get the time to

13:11change it. You you get the time to react

13:13to it and that is the monitoring

13:15ability.

13:16All the code which I have spoken today

13:19is audited and it is public. I would

13:22love you to take a part and get back to

13:24me with some feedbacks. And to conclude

13:27I want to say that a guard you can

13:29quietly loosen is not a guard. Thank

13:32you.

Source and accuracy details

Source export SHA256: 742cb12a3f3566eaeda4f55e74a4d2c256974f816f1cfb400cc7da2a74325737