ERC-8511: Policy-Enforced Agent Accounts

Hi all. We’d like feedback on a draft ERC for a problem we hit while running agent accounts in production: there is no standard way for an app, wallet or lender to tell whether an agent’s account is protected by an external policy signer, what that policy allows, or why something was refused.

What it adds: a read-and-evidence layer. It doesn’t define how anything is enforced.

  • Discovery (ERC-165 0xcc16d336): policySigner(account), policyOf(account), pendingPolicyOf(account), mandateOf(account), isStopped(account). Served by the account itself, or by a singleton registry for existing accounts such as Safes. With the registry, the account declares its signers itself, and only its declared publisher can post for it.
  • Policy commitments: the hash of the policy document, with an optional URI where anyone can fetch it and check it. The hash is keccak256 of the document’s RFC 8785 canonical JSON.
  • Pending loosenings: these are public with their effectiveAt, and the registry switches to them by time alone. A quiet loosening is the usual step before a drain, so watchers get the delay to react.
  • Reason codes: an append-only bytes32 list (TARGET_NOT_ALLOWED, OVER_TX_CAP, HUMAN_APPROVAL_REQUIRED, ASSET_UNSAFE…). Vendor detail goes in a separate namespaced detailCode. Names follow ERC-8226 where they mean the same thing.
  • Decision receipts: EIP-712, bound to the exact intent (chain, account, target, value, calldata hash), the policy hash and an expiry. They’re verified against the account’s declared receipt signer, with ERC-1271 for contract signers.

How it relates to existing work:

  • ERC-7579 and 7780 enforce inside the account. ERC-7710 delegates with caveats. The ISpendGate thread gates at the token. ERC-8226 stores mandates for regulated assets. ERC-8196 prescribes a whole wallet.
  • This proposal is complementary to all of them. It is how anyone reads what is enforced, whatever the enforcer is.
  • We didn’t find an existing standard covering an external policy signer, an on-chain commitment to an off-chain policy, or verifiable decision receipts. Pointers welcome.

It is live, not only a document:

  • The reference registry is deployed and verified on Robinhood Chain mainnet (4663) at 0x20D6B38B47F7cb765A2318a1f318ed54a6f87e92. There is no owner, no upgrade path and no funds.
  • A production enforcer (Palisec) publishes its accounts’ commitments there and signs receipts in this format.
  • Test vectors are checked in both TypeScript and Solidity.
  • A small client library (policy-enforced-accounts on npm) reads any compliant account and verifies receipts with no API key.
  • Guide and spec: Standard: Policy-Enforced Agent Accounts · Palisec

Open questions for the community:

  1. Is a registry the right default for existing accounts, or should we push accounts to implement the interface natively (for example as a 7579 fallback)?
  2. Should policySigner also carry a type tag (co-signer, module or guard), so readers know which configuration checks to run?
  3. Is the common-core policy vocabulary useful, or should schemaURI alone carry the format?
  4. Receipt lifetime: should the spec cap it?

The ERC pull request follows in a reply below.

The ERC pull request is open: Add ERC: Policy-Enforced Agent Accounts by palisec-dev · Pull Request #2196 · ethereum/ERCs · GitHub

The reference implementation and the test vectors are in its assets folder.

activate accepts any higher version and applies it at block.timestamp, and all the registry sees is a hash, so it can’t tell a tightening from a loosening. The delay is only as good as the publisher: an activate with a looser policy makes it current right away, and watchers alerting on PolicyPending see nothing. The same call also cuts a scheduled loosening short. activate with the pending version and hash clears the pending entry and makes it live at block.timestamp (cur is still the old active version, so effectiveAt isn’t kept), and no PolicyCancelled fires because hash and version match. If the delay should hold against the publisher too, the account could set a minimum in declare, keep immediate activate for calls from the account itself, and send every publisher change through setPending with at least that delay.

On receipt lifetime (question 4), verifyReceipt already caps it at 24h, but neither the verifier rules nor the client compare policyVersion with policyOf(account) or read isStopped. An ALLOW signed under the old policy keeps passing until it expires, after a tightening or an emergency stop. Nothing asks the verifier to remember decisionId either, so the same receipt covers the same transfer twice. Checking those at use time matters more than the cap.

For Safes, execTransaction with the same to, value and data can run as a call or a delegatecall, and both give the same intentHash today. The intent probably needs the operation, or the 7579 execution mode.

Building on Zealynx’s point about activate: two more pre-drain moves that a watcher of policyOf / pendingPolicyOf would not see.

  1. Standing authority outside the policy path. In most account drains we study, nothing in the policy changes. The funds leave through authority granted earlier and never revoked: an ERC-20 allowance or permit the account holds, an operator approval, an installed module or executor, or, for 7702 accounts, the delegation target itself. A reader checking only the commitment gets a clean answer while that path is open. It would help if the evidence layer exposed the live fund-moving surface it can see (for example installed 7579 executors and the current 7702 delegation target), or at least stated explicitly that the commitment covers only actions routed through the policy signer.
  2. Signer changes. Swapping the policySigner or the receipt signer is equivalent to loosening the policy to anything. Does a signer change through declare take effect immediately? If so, the minimum delay Zealynx suggests should cover signer and publisher changes too, with its own pending event, so watchers get the same window.

On question 2: yes to the type tag. A co-signer in the signature path, a module that can be uninstalled and a guard that can be removed have very different bypass surfaces, and a reader needs the tag to know which removal paths to check.

Checked the reference registry: declare can only be called by the account and applies at block.timestamp, so a signer or publisher swap is live in the same block. That also undercuts what I suggested in #3, since a fresh declare could reset the minimum along with the signers. For the minimum to hold, declare has to respect it as well: a rotation waits out the current minimum, and only clearing to all zeros (an open opt out) applies at once. signersAt already resolves the receipt signer at a receipt’s issuedAt, so the history side is covered.

Thanks, @Zealynx. We checked each point against the reference registry and the client library, and they all hold. Here is what changes in the next revision of the draft (PR #2196) and the reference implementation.

activate can apply a looser policy immediately. Correct: the registry only sees a hash, so it can’t tell a tightening from a loosening, and today the delay relies on the publisher behaving. We’ll take your proposal:

  • the account sets a minimum delay in declare;
  • every change from the publisher goes through setPending with at least that delay;
  • an immediate activate is accepted only from the account itself, or to confirm a pending change once its effectiveAt has passed.

The emergency stop stays immediate, since it can only restrict. We’re still working out how an urgent tightening reaches the chain quickly without reopening the same gap; ideas welcome.

Confirming a pending change early. Confirmed: activate with the pending version and hash before effectiveAt clears the pending entry, applies it at block.timestamp and emits no PolicyCancelled. That also breaks our own spec, which requires PolicyCancelled whenever a pending change is replaced or superseded. In the fix, confirming a pending change reverts before its effectiveAt, and every removal of a pending entry emits an event.

Use-time checks on receipts. Agreed, these matter more than the expiry cap. The verifier rules will say that a verifier acting on an ALLOW (rather than auditing it) MUST:

  • check that policyVersion and policyHash match the policy deciding now;
  • check that isStopped(account) is false at the time of use;
  • record decisionId and refuse a second use.

The client library’s verifyReceipt gets a use-time mode that does all three.

call vs delegatecall. Agreed. The Intent will include the operation type (and the call type of the execution mode for ERC-7579 accounts), so the two produce different intentHash values. That changes the Intent type hash and the EIP-712 domain version, and the test vectors will be regenerated.

Signer changes (#5). Agreed, and thanks for checking. declare will respect the minimum as well: a signer or publisher rotation, or a lower minimum, waits out the current minimum with its own pending event, so a fresh declare can’t reset it. Clearing to all zeros applies at once, as you suggest: it’s an open opt-out, and policySigner(account) then reads as not enforced, so nobody is misled. An account’s first declare also applies at once, since there is nothing to loosen yet.

The reference registry has no owner and no upgrade path, so these fixes mean a new deployment. We’ll post the new address here when it’s ready; the current registry stays readable for existing commitments and receipts.

Thanks, @Secrypta. All three points hold.

Standing authority outside the policy path. Agreed, and in practice it is probably the larger risk. Two steps:

  • Security Considerations will state plainly that a commitment covers only actions that need the policy signer, and list what a reader must check separately: token allowances and permits, operator approvals, installed modules and executors, guards and hooks, fallback handlers, and the ERC-7702 delegation target, with what to read for Safe, ERC-7579 and 7702 accounts.
  • We’ll look at an optional, signed snapshot of the fund-moving surface the enforcer can observe. We’d rather not store allowance lists in the registry, since it has no way to keep them accurate. We’d value your view on whether that snapshot belongs in this ERC or a companion one.

Signer changes are loosenings. Yes: today a declare applies in the same block. Signer and publisher changes will wait out the account’s minimum delay with their own pending event, so watchers get the same window as for a policy loosening (details in the reply to Zealynx above). For a leaked key, the account can engage the stop at once, so the signer allows nothing, while the rotation itself waits.

Type tag for policySigner. Agreed. Signers gains a type field (co-signer in the signature path, validator module, guard or hook, other), so readers know which removal paths to check.

1 Like

Thanks @palisec-dev, this all looks right to us.

On the signed snapshot: we would define it as a separate, companion ERC rather than folding it into this one. The core commitment here is valuable precisely because it is exact and verifiable at a point in time. A snapshot of the fund-moving surface (allowances, operator approvals, installed modules and executors, fallback handler, and the 7702 delegation target) is the opposite: it is accurate only at the block it is taken, and any approval or module change after that silently invalidates it. Binding it into the same commitment would let a reader treat stale data as a current guarantee, which is the false assurance we would most want to avoid.

As a companion it stays useful without that risk, and we are happy to review a draft once there is one. Two suggestions from us if you pursue it:

  • every snapshot carries the block number it was observed at and is labelled explicitly as point-in-time and advisory, never a standing guarantee;
    • the spec states what invalidates it (any allowance, approval, module, guard, hook, fallback, or delegation-target change after that block), so tooling can flag it as stale rather than trust it.

On urgent tightenings: the registry can only fast track a change it can check is a restriction without reading the policy, and today that is only the stop flag. So stop now, setPending the tighter version with the normal delay, and lift the stop once it is active. The cost is downtime in between. A scoped stop the registry stores in the clear, per target or selector, would be finer and still checkable.

The minimum on declare I suggested in #5 also removes the account’s way out of a leaked publisher key. Today the account can rotate in the same block and the new publisher cancels a pending loosening before it lands. Once rotation waits the minimum, a loosening queued before the rotation goes live first. setStopped and cancelPending are both onlyPublisher, so unless the account side activate in your fix can supersede a pending entry, the account has nothing that blocks it. The leaked publisher can also lift a stop in the same block. Letting the account call setStopped(true) and cancelPending itself would keep that way out explicit.

The fixes from the review above are live.

@Zealynx

  1. Publisher changes wait. Every policy the publisher posts goes through setPending at least the account’s minDelay ahead, and decides from its effectiveAt. Only the account itself can activate at once. On urgent tightenings, we accepted that the registry shows them only after minDelay. The enforcer still applies a tightening off chain at once, since stricter is always safe. Until the registry catches up, its receipts carry the newer version, which a use-time verifier refuses, so the gap fails closed.
  2. Confirming early now reverts (NotDue), and every removal of a pending entry emits PolicyCancelled. While testing, we found a related case: in v1, a pending change that was due but not yet confirmed was lost when a newer one was posted. v2 makes the due change active first.
  3. Use-time rules are in the spec. A verifier acting on an ALLOW must check that the receipt’s policy hash and version are the current ones, that the account is not stopped, and that its decisionId is used once, claimed in one atomic step. verifyReceipt(…, { use: true, seen }) does all three.
  4. The Intent includes uint8 operation: 0 for a call, 1 for a delegatecall, or the call type byte of the ERC-7579 execution mode. The EIP-712 domain version is now “2”, and the vectors include the same call as both.

@Secrypta

  1. Scope of a commitment. Security Considerations has a new section on it. It says a commitment covers only actions that need the policy signer, and lists what to check separately for Safe, ERC-7579 and EIP-7702 accounts: allowances and permits, operator approvals, modules and executors, guards and hooks, fallback handlers, and the delegation target.
  2. Signer changes wait too. After the first declaration, a new signer set applies minDelay later, including a lower minDelay. It is announced with SignersPending, and the account can cancel it. Clearing to all zeros applies at once, since it only withdraws the claim of enforcement. The account can now engage the emergency stop itself, which is the fast answer to a leaked publisher or receipt key while the rotation waits.
  3. signerType is in Signers: 1 co-signer in the signature path, 2 validator module, 3 guard or hook, 4 other.

On #8 and #9, which came in while this was being built:

  • @Secrypta: agreed, the surface snapshot goes in a companion ERC, not this one. When we draft it, every snapshot will carry the block it was observed at, will be labelled point-in-time and advisory, and the spec will list what invalidates it. Thanks for the offer to review.
  • @Zealynx, the account’s way out of a leaked publisher key. In v2 the account itself can call cancelPending, setStopped(true) and activate, so a loosening queued before a rotation can be cancelled by the account while the rotation waits. One gap you point out remains in v2: the publisher can lift a stop the account engaged. The account can still cancel each pending change itself, and anything the publisher posts waits minDelay, but the stop should hold. We’d make a stop engaged by the account liftable only by the account in the next revision. On urgent tightenings, your “stop now, then the tighter version with the normal delay” is the same order an enforcer can follow with v2. The scoped stop (per target or selector, stored in the clear) is a good idea for later.

The first registry, 0x20D6…7e92, is unchanged and readable. Its receipts can still be audited (domain version “1”), but under the updated spec they are never acted on as a gate, because their intent does not bind the operation. Both of our demo accounts moved to v2 through ordinary co-signed transactions:

Thanks again to you both.

Thanks @palisec-dev, and thanks for the invitation. v2 reads well. Glad to review the companion ERC on the surface snapshot when you draft it.

I put your account-owned stop rule into PR #1. It also covers the account taking over an existing publisher stop. 49 tests pass. This needs a new deployment; the live v2 is unchanged.

The immediate opt-out described in #10 seems to leave a way around minDelay. In v2, declare clears the signers immediately, and a declaration made while policySigner is zero also takes effect immediately. An account can batch those calls in one transaction to replace its signers and lower minDelay without waiting. Both declarations emit events, but watchers get no reaction window, and reads before and after the transaction show a nonzero signer. How should re-entry after an opt-out preserve the previous delay so this sequence cannot bypass it?

Checked v2 at b354ea9, and Revinand’s sequence works. Clearing sets minDelay to 0 and applies at once, and the next declare reads policySigner as zero at block.timestamp, so it applies at once too. Both fit in one transaction.

Whether that matters depends on who minDelay is meant to bind. activate from the account already applies any newer version at once, so today the delay binds only the publisher and the batch gives the account nothing it didn’t already have. If the spec means it as a promise to counterparties that the account can’t loosen faster either, both paths need to change: keep the delay in force at the moment of clearing and apply it to the first declare after it, and make account side activations wait the delay as well (setPending is publisher only today). Saying which of the two it is in Security Considerations would settle it for readers.

The fail closed handling of urgent tightenings in #10 reads well, and thanks @ted0x for taking the account owned stop into PR #1.

Registry v3: a stop the account engaged holds.

On Robinhood Chain (4663): 0x4d37D0aD95593b2C65A0c2A98D5676D51DF3FDAB. Source verified, no owner, no upgrade path, holds no funds. ERC-165 0xf594edcd. Robinhood Chain address details for 0x4d37D0aD95593b2C65A0c2A98D5676D51DF3FDAB | Blockscout

@Zealynx (#9)

  • A stop the account engaged can only be lifted by the account. The publisher’s attempt reverts with StopHeldByAccount, also after a publisher rotation.
  • A stop the publisher engaged can still be lifted by either. If the account engages it too, the stop becomes the account’s.
  • The only interface change is the read stopHeldByAccount(account), hence the new ERC-165 id.
  • A test runs your case on both registries: on v2 the publisher lifts the account’s stop, on v3 the same call reverts. A mainnet-fork test repeats it with the real demo Safe and its real publisher against the live v2.

@ted0x (#12): thanks for PR #1. v3 ships the same rule, including the account taking over a publisher’s stop, so I’ve folded it into #2196 rather than merging #1 separately.

@Revinand (#13) and @Zealynx (#14): confirmed, and it holds in v3 too: clearing, then declaring again, applies at once within one transaction. We take your first reading: minDelay binds the publisher, not the account. The account’s own authority is already immediate through activate, so delaying only declare would give counterparties a promise the account could still route around.

  • Security Considerations now says this plainly. Readers who need a delay on the account itself should watch SignersDeclared after a clearing, and PolicyActivated sent by the account. Enforcers should not let an agent’s key plus the policy signer’s co-signature call declare or activate for the account.
  • Making the account wait too (a remembered delay at re-entry, and account-side activations that wait) would be a different guarantee. If people want it, it fits a later revision.

The draft is updated in PR #2196: Add ERC: Policy-Enforced Agent Accounts by palisec-dev · Pull Request #2196 · ethereum/ERCs · GitHub
The client library policy-enforced-accounts 0.3.0 reads v3, v2 and the first draft, and returns stopHeldByAccount.

The demo accounts

v2 (0xCa3b…448d) is unchanged and readable, and its receipts keep the same format.

@Secrypta (#11): thanks, I’ll ping you when the companion draft on the surface snapshot is up.

@palisec-dev checked v3 at 331e14f and the hold works: the publisher’s setStopped(true) on an account-held stop returns early, so it can’t turn it back into a publisher stop and then lift it.

One thing left on the leaked publisher path is the version number. setPending only needs a version above the active one, so a leaked key can queue type(uint64).max. If the account misses the minDelay window and that entry settles, nothing replaces it: activate from the account needs a version at least the current one (and the same hash when equal), setPending needs a higher one, and declare never touches the active commitment, so clearing and declaring again leaves it in place. A missed window then becomes permanent on that registry, instead of a bad policy the account replaces at once.

Requiring version == active.version + 1 in setPending, or a small cap on the step, keeps the account’s activate as the way back.