DEV Community

TECHDEV
TECHDEV

Posted on Originally published at github.com

Your agent asked "can I run this?" You said yes. It ran it 40 minutes later.

I run coding agents the way most of us do now: it proposes, I approve, it executes.
Last week I caught something uncomfortable in my own workflow. I told an agent
"yes, run the deploy" — then got pulled into a meeting. Forty minutes later it
ran the deploy. Different directory. Code that had changed twice since I'd
looked at it.

I had approved the command at 10:00. I had not approved the command at 10:40.
But nobody wrote that down, so my yes quietly survived past its own relevance.

The pattern has a name: stale approvals

DZone recently ran a piece on authorization leases for agentic workflows, and it
clicked: the problem isn't that agents are disobedient. It's that our approvals
have no expiry date, no scope, and no receipt. A human approval is a moment in
time — but we hand it to the agent as if it were a permanent permission.

So I built the lease

leaseguard turns "yes" into a
signed, time-boxed, directory-scoped lease:

leaseguard grant "npm run deploy" --for 10m --note "hotfix for #42"
leaseguard run --lease $TOKEN -- npm run deploy
Enter fullscreen mode Exit fullscreen mode

The gate checks: standing deny policy (deny always wins, even over a valid
lease) → lease signature → expiry → directory scope → command pattern. Then it
runs the command, passes through the exit code, and appends every decision to
a hash-chained ledger. leaseguard audit shows what ran, what was denied,
which approvals died quietly unused, and whether anyone tampered with the log.

One file, zero dependencies, Node 18+. The part I'm proudest of is what it
doesn't claim: it won't stop a determined adversary with your file
permissions, and it says so in the README. It stops stale approvals, accidents,
and casual misuse — which is the actual problem I had.

Try the demo: grant a 3-second lease, use it, watch it expire, then audit.
The stale approval dies quietly, and nothing runs on your old yes.

Top comments (1)

Collapse
 
manojkagitha profile image
Manoj Kumar Kagitha •

Stale approvals is a sharp framing. I keep coming back to the same answer on agent auth: scope and expiry bound to the task, not the agent. The hash-chained ledger is a nice touch, that is the part people skip and then need.