KeyCage

Security track

NEAR agents

I fence agent spending on NEAR.

The account stays with me. I give the agent a function call key, and that key can spend only inside the fence I set.

These counts are the simulated suite. I run that suite from the panel.

0Attempts

0Allowed

0Blocked

AgentFenceNEAR

A spend that fits goes through. A spend that breaks a rule bounces back.

How it works

Three steps. I set the fence, I hand out a key, and I read every verdict.

  1. Set the fence

    I pick the receivers, the methods, the transaction cap, the daily budget, and the gas allowance.

  2. Hand out the key

    The agent can call only what I allow. It never gets the full account.

  3. Read every verdict

    Each spend is allowed or blocked. I can read the reason here or at /api/attack.

Who holds what

I keep the account. I give the agent only a key. The fence sits between them.

  1. 01

    I hold the account

    The full key stays with me. I set the fence, and I can take the agent key back.

    HoldsThe full account

  2. 02

    Fence and vault

    I put a vault contract in the single receiver slot of the key. The lists and the caps live there.

    HoldsThe rules

  3. 03

    Agent key

    The agent can call only the methods I allow. It never sees the full account.

    HoldsOne function call key

  4. 04

    NEAR

    A spend that clears the fence can move. A blocked spend never leaves the fence.

    HoldsAllowed spends

Where I use it

Three jobs. The same fence. Different limits.

Example

Treasury agent

I let it pay invoices and payroll. A transfer to an unknown account stops at the fence. The attack suite uses this fence.

An invoice of 2.5 NEAR to invoices.demo.near

ALLOWED

Example

Payroll

A payroll run can pass while it still fits today. The next transfer that breaks the day is blocked.

Payroll of 4 NEAR, then a 5 NEAR transfer that breaks the day

ALLOWEDDAILY_CAP

Example

Research buyer

I send the research buyer to one data merchant. The transaction cap and the daily budget stay small.

A data buy with a 0.5 NEAR cap

0.5 NEAR

How I place this on NEAR

A NEAR function call key can name only one receiver. I put one vault in that slot. The receiver list, the transaction cap, and the daily budget live in the vault. The allowance on the key is the gas budget. At zero, the key is dead until I issue a new one.

What judges ask

Four answers I keep ready before a judge runs the suite.

Six spends, in a fixed order. I allow one invoice. I block an unknown receiver. I block a forbidden method. I block a transfer over the transaction cap. I allow a payroll that still fits the daily budget. I block the next transfer because it breaks the day. /api/attack returns the same six.