Skip to content

Functions are first-party code; the sandbox is for fault isolation

Accepted. Owner ruling of 2026-10-21; it constrains every later function decision.

2026-10-21 (the contract it sits in was first written on 2026-10-19).

Functions are small programs the platform stores, versions and runs: webhook receivers, event handlers, schedules and HTTP endpoints. They run as WebAssembly modules (compiled languages, and TypeScript on an embedded JavaScript engine) or as JVM jars. Any system that runs stored code has to say who may write it, because the answer decides how much isolation is needed.

Running a stranger’s code safely is a product in itself. It needs machine-level isolation, per-tenant pools, enforced CPU and memory quotas, and a constant security-patching burden. Running your own team’s code needs far less: the code is reviewed, it is published by staff, and the risk is mistakes, not malice.

Functions are first-party code only. Everything a function runs is written, reviewed and published by the people who operate the platform, to provide services to their customers. Customers never publish or run their own code, and nothing may be built, documented, exposed or configured to allow it.

The sandbox (WebAssembly, declared capabilities, limits and deadlines) exists for three purposes:

  • Fault isolation: a function that loops forever, leaks memory or panics hurts only itself.
  • Least privilege: a function can reach only the hosts, databases, secrets and dispatch targets it declares.
  • Fair sharing between the operator’s own functions on one runner.

It is not designed, hardened or tested to contain a hostile author. Publishing and promoting versions are privileged operations for platform staff. Allowing a third party to run code is treated as a new product that needs a new decision first.

Several implementation choices lean on this ruling:

  • A runner may rely on a function to be well-behaved in ways it could not rely on a stranger. The JavaScript engine that the platform itself ships stops runaway calls cooperatively, with a host watchdog behind it, instead of paying for preemption on every call (see ADR 0032). Modules an author compiles are still preempted from outside.
  • The class loader filter for JVM functions is fault isolation, not a security boundary.
  • No feature is designed around a customer authoring a function.

Good:

  • The platform avoids the cost and risk of hostile-code hardening, and can spend that effort on speed and developer experience.
  • Cheaper deadline and memory mechanisms are acceptable, which makes JavaScript functions several times faster.
  • The scope is easy to state and to defend in a security review: operators write the code, so operators answer for it.

Bad:

  • A well-meaning but badly written function can still consume a thread or a runner’s capacity. Limits, watchdogs and health checks bound the damage; they do not remove it.
  • A business that wants customer-authored extensions cannot get them here. It needs a separate product or a separate deployment with real isolation.
  • A shared runner trusts every function on it. Teams that want separation should use separate pools.
Alternative Why not
Let customers publish functions behind the same sandbox The sandbox is not hardened for it. It would need VM-level isolation, per-tenant pools and CPU and memory quotas, which the system does not have.
Build hostile-author hardening in from the start Large cost for a use case nobody has asked for, and it would slow every function.
Leave the trust model unwritten Features would drift towards customer authoring without anyone deciding it.