A major bank approved a mini-program because the sandbox meant the code could not touch the host's session or file system. That is the textbook win, and it is real. But the sandbox is a boundary around the operating system, not around the data. The attacks that actually cost teams in 2025 and 2026 are exactly the ones a process sandbox was never built to stop: a malicious mini-program reading a token another mini-program left in shared storage, and an AI agent holding a payment credential with a scope nobody reviewed.
Shared storage is the leak the sandbox trusts
The sandbox separates the mini-program's code from the host's native layer, but it does not automatically separate mini-program A from mini-program B — not when the host runs them in the same WebView context, or in a WebView configured with shared localStorage. If the host does not isolate storage per mini-program, then program B's localStorage.getItem('auth_token') can return the token program A wrote. In one self-hosted runtime, the operator assumed "separate folders means separate origins" — it did not, until an audit surfaced a cross-program read request and laid it bare.
An agent with a credential is more dangerous than a person
The new variable in 2025 is agent payments. OpenAI and Stripe shipped the Agent Commerce Protocol; Visa and Mastercard followed with their own frameworks; Ark projects a quarter of transactions handled by AI agents by 2030. An agent that can complete a purchase holds a payment credential. If that credential's scope is "spend freely in this catalog," then an injected prompt or a broken agent is a blank check with no human reviewing it. The sandbox cannot distinguish "this agent was authorized" from "this agent was induced" — it only sees a valid credential.
| Attack surface | Sandbox blocks it? | Real defense |
|---|---|---|
| Touch host file system | Yes | The sandbox itself |
| Cross-program token read | No | Per-program isolated storage |
| Agent over-scope spend | No | Least privilege plus human loop |
What least privilege actually looks like
Rules only count once they reach configuration. Tokens should be bound to an audience (usable only in this mini-program) and set with a short lifetime, so a leak expires quickly; an agent's payment credential should be limited to one merchant and one amount window, not the whole catalog, with anything above a threshold routed to a human for approval. One team, after being burned, pulled agent credentials from "catalog-level" down to "single-order-level" and forced large amounts through manual review — a line the sandbox never intended to guard.
Auditing saves more than the sandbox does
The two attack classes the sandbox cannot stop are caught by a different mechanism: audit and monitoring. Record "which mini-program read which token" and "which merchant and amount window an agent credential was used at" as a queryable event stream, and anomalous use — a token appearing in a context it should not — can be alerted instead of discovered after losses. One team used exactly this audit to find a partner mini-program reading auth_token in an unexpected context and revoked its permission before any real leak. The sandbox gives a boundary; the audit gives something to chase afterward. Both are required.
The host's isolation promise is a contract — audit it
The trap is assuming the host isolates storage per mini-program because the documentation says so. In the self-hosted runtime case, the operator believed separate folders meant separate origins until an audit proved otherwise. The defense is to verify, not trust: run a cross-program read test in CI, and alert when one mini-program can see another's storage. A team that added this check found a misconfiguration where a partner's mini-program could read the primary app's auth_token, and closed it before any real exposure. Isolation you did not test is isolation you do not have.
The bottom line
The sandbox answers "can the code touch the system." It does not answer "can the data be read by the next-door program" or "can the agent overspend." Those are what actually cost money in 2026, and only architectural isolation and least privilege close them — the sandbox will not.