Dev.to Security 🔐 Cybersecurity 👁 0 📖 8 min read

A plugin sandbox that can't be hidden from

A static scanner that reports what your plugin wants, and a runtime where the missing method throws. Most permission systems fail the same way: the things you forgot to ask for still work. You list what your code needs,

A static scanner that reports what your plugin wants, and a runtime where the missing method throws.

Most permission systems fail the same way: the things you forgot to ask for still work. You list what your code needs, someone reviews and approves it, and the grant is strictly weaker than the truth — because the runtime still hands every plugin the same general-purpose capabilities, and a permission just adds a line to a document. Nothing in the request from your code to that capability says "you didn't declare this."

That gap has a name, once you're in it: ambient authority. The code didn't request the capability, it merely used it, and the grant never reconciled with what actually ran.

Agent plugins are a bad place for that gap. A plugin is code you didn't write, running with your agent's reach, often on a schedule you're asleep for. I write for AgentParley, so read the product parts of this knowing that. The engineering below is the part I'd argue for in any runtime that loads third-party extension code.

What actually has to match

There are two ways a runtime can know what a plugin reaches, and they fail in different directions.

Read the code and derive the reach. This is a static answer: it can be shown before install, and it covers code paths nobody exercised. It's also a claim about code, and a program can do things its text doesn't show — build a name at runtime, fetch a URL and call something named in the response.

Enforce at the point of use. This is a dynamic answer: it catches a call the scanner missed, because the call either succeeds or doesn't. It's only as good as the surface it guards, and it tells you nothing before the code runs.

Either alone gives you a version of the original gap. So the useful property is narrower, and it's the one I'd ask any agent platform about: can the derived permission and the enforced one be the same object?

At AgentParley, the code you write gets a single object called host. That is the entire capability surface — there is no fetch, no require, no process, no filesystem in the isolate, so host is the only way out. The static derivation is the parser over your source, and at run time the members are bound; anything you didn't derive simply isn't there. The answer to my question is that they are not two artifacts. They are two readings of the same table.

How the derivation works, and how it can be fooled

The scanner is deliberately dumb. At publish time your files are merged into one bundle, the bundle is parsed, and every literal member chain starting at host is recorded — host.agents.list, host.session.todo.create, host.fetch. Each recorded path maps, through a fixed table on the docs site, to one permission. The union of those paths is the plugin's permission set: one set for the whole package, shared by every capability in it.

Dumb is the right design here, and it has a cost you can see in the same page: the scanner only sees literal access. This is not observed, and therefore not granted:

const agents = host.agents;   // alias → not seen
await agents.list();

const { workspace } = host;   // destructuring → not seen
host[area].list();            // computed name → not seen

An alias hides the call from the scan, so the permission never derives, so the member is never bound. For host.workspace, host.media, host.ssh and host.connection the member is undefined and the call throws. For host.session, host.agents, host.models and host.cronJobs the platform rejects the call with a 403. A scanner miss is not a silent grant; it is a runtime error, which is the failure mode you want.

That works because the surface is small and fixed. Every member is in that one table. If the API were open-ended — take a string, return anything — the parse would be a formality.

Where the static answer can't reach

Static analysis of a dynamic language has a documented limit, so it's worth being concrete about it. The permission set is derived from syntactic access. A plugin that reaches a member indirectly, and wants to, can declare it in manifest.permissions. That's an escape hatch that keeps working code working, and it moves the honesty back to the installer's screen — the declared permission appears in the same "what it can reach" list as the derived ones, because they're the same set.

The harder limit is host.fetch, which is the one capability that takes a value rather than a fixed member. Two separate mechanisms cover it:

  • The declare side. If the code calls host.fetch, the plugin must have a manifest.egress list, or publish fails.
  • The enforce side. Outbound HTTP is deny-by-default. Only hosts declared in manifest.egress, plus hosts the installer added through a setting, are reachable. The check is by host name and port, repeated on every redirect hop, and it refuses private, loopback, link-local and cloud-metadata addresses at the moment of connect.

This is the part I find most useful as a builder, and it has nothing to do with static analysis at all. A plugin can't fetch api.example.com and follow it into an internal address, because the redirect is checked like any other request. And the list of hosts is on the install screen next to the permission list, in the same human-readable form — so "this plugin talks to two hosts" is a sentence a reviewer can check against the gateway.

That's the honest reading of the whole model: the static pass decides what exists in the sandbox, and the runtime decides what each call may do. Neither one is a claim that the code is safe. A plugin with two tidy declared hosts and a hostile prompt still behaves badly.

What the end of a call does to the argument

There's a second question about static analysis that's less often asked: what does derived reach mean if state outlives the derivation?

If a plugin's call can write a cache in module scope and the next call reads it, then the permission derived from this file can be augmented by what the previous call stored — a payload arrives in one invocation and is executed by another. The scanner read the code; it didn't read the memory.

So the isolate is created per call and thrown away after it: no module-level variables, no caches, no timers survive. Persistence has to go somewhere explicit — the agent's workspace through host.workspace.*, which is its own derived permission and appears on the install screen, or a live connection's state, or the settings the user set. The derived permission set describes one invocation completely, because that's the only lifetime a call has.

There's a cost to that, and it's real: per-call isolation means latency you don't pay in a long-lived per-plugin process, and it means no cheap in-memory caching between calls. For third-party extension code I think it buys more than it costs, but that's an argument, not a measurement.

The update, which is where this usually leaks

Every version of a plugin records its access: its permissions, its egress hosts, the agents it adds, the schedules it adds, any hook that fails closed. When someone installs an update, the runtime compares that record to what the owner accepted.

  • Same or less: the install moves to the new version.
  • More: a new permission, a new host, a new agent or schedule, a hook that fails closed — the install stays on the old version, the plugin's page shows the update waiting, and it lists exactly what it adds. Nothing from the new version runs until the owner accepts.

That last sentence is the one worth testing as a user, because a lot of "permissions" systems quietly mean "permissions at install time" and treat updates as trusted. Here the derived set is what makes the comparison possible: you can diff two versions' access without running either one.

One caveat I'd rather state than leave for you to find: versions whose access is covered by what you already accepted can move to the newer one without asking. That's an update moving under the same grant — not the runtime silently widening it, but not a human re-review either. If you need every version pinned, pin it.

What to check in any plugin host

I'm not going to claim this is the only way to build it, and if you're building your own loader, three of these four are cheap:

  1. Is the capability surface small enough to enumerate? If a plugin can reach anything the host process can, no derivation will keep up with it. Count the entry points; if the answer is "whatever the language gives you", the rest of this is moot.
  2. What happens on a scanner miss — error, or grant? Ask to be shown the alias case: const x = host.thing; x.call(). If it works, the code was granted something its derivation didn't show.
  3. Is the network check per hop? A host allow-list applied only to the first request is a deny-list with a proxy-shaped hole.
  4. Can an update widen access without a human seeing it? Ask what happens to a new host in an update you didn't trigger.

Where this model is the wrong call

Being fair to the other side, because the trade is real. This design suits plugins whose job is to call an API, parse a response and hand back a result. It is a bad fit for anything that needs to hold a long-lived process, keep a large in-memory cache, load native binaries or local model weights, or walk a filesystem. If your extension model is "a program a user installs into their own machine", none of this applies, and self-hosted software handles it the way it should — with the user as the operator, which is a job.

And the honest limit: derived permissions describe reach, not behaviour. They tell you what the code can touch, and they're the reason the install screen can answer a question instead of offering a checkbox. They cannot tell you whether a plugin with exactly the right permissions does something stupid with them. That's a review question, and reviews don't scale to a marketplace.

What does scale is the arrangement above: a small surface, one table, a runtime where the undeclared member is missing rather than present-and-unmarked, and an update gate that measures access instead of trusting version numbers.

Disclosure: I write for AgentParley, the hosted crew of specialist agents described in this post, so the product parts above are not a neutral review. The mechanisms are all documented on the public pages linked below, including the limits I didn't try to paper over.

The comparison, including where self-hosting is the better pick: agentparley.ai/openclaw-alternative. Plans and limits: agentparley.ai.

Sources: sandbox model, plugin permissions — both read 19 November 2026.

Dev.to tags: #agents, #security, #javascript, #architecture

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.