An open-source, faster Devin alternative
TypeScript
docs(microvm): document the real size enum (512MB-8GB, default 4GB, only the default pooled) instead of implying any size can be published, and rewrite the secrets page as an explicit before/after — the substituting proxy moved from the VM host into the guest as root, which changes only the blast radius of an in-sandbox privilege escalation
Brian Reardon1d5b941efd2d
diff --git a/docs/microvm/errors.mdx b/docs/microvm/errors.mdxindex 46eb38e0..55cfb8ea 100644--- a/docs/microvm/errors.mdx+++ b/docs/microvm/errors.mdx@@ -9,7 +9,7 @@ The runtime tries to make "retry" versus "change your request" obvious from the| Status | Meaning | Retry? ||---|---|---|-| `400` requested size not available | The size has no published image here. The message lists the sizes that do exist. | No — pick a listed size. |+| `400` requested size not available | That size is not published in this region, or is not one the platform offers at all. The message lists the sizes that do exist. | No — pick a listed size. || `503` out of capacity | A genuine shortage. | Yes, once something frees up. No `Retry-After`, because hammering a full region only adds rate limiting. || `503` rate limited | Creates are arriving faster than the provider accepts. | Yes — a `Retry-After: 1` header is set. || `429` concurrent sandbox limit | Your org is at its concurrency cap. | Yes, after ending a sandbox. |diff --git a/docs/microvm/migrate.mdx b/docs/microvm/migrate.mdxindex 15768b79..386310d3 100644--- a/docs/microvm/migrate.mdx+++ b/docs/microvm/migrate.mdx@@ -8,7 +8,7 @@ out ahead of time whether that move is a non-event or something you need to plan## Step 1 — answer four questions-Most workloads are unaffected. These four are what separate the two cases:+Most workloads are unaffected. These five are what separate the two cases:<Steps><Step title="Does any sandbox need to live longer than 8 hours?">@@ -20,6 +20,12 @@ Most workloads are unaffected. These four are what separate the two cases:restore will not bring it back. If they capture an installed environment, you are fine.See [Checkpoints](/microvm/checkpoints).</Step>+ <Step title="Does any sandbox need more than 8 GB of memory?">+ 8 GB is the largest size the platform offers, and memory cannot be changed after launch.+ If you run bigger sandboxes today, that work needs to fit in 8 GB or be split up. See+ [Sandbox sizes](/microvm/sizes).+ </Step>+<Step title="Do you call scale, autoscale, or mount anything?">None of these exist on the new runtime. See [What's not supported](/microvm/not-supported).</Step>@@ -28,7 +34,7 @@ Most workloads are unaffected. These four are what separate the two cases:</Step></Steps>-If all four are "no", your migration is a configuration change and you can stop reading here.+If all five are "no", your migration is a configuration change and you can stop reading here.## Step 2 — find the calls in your codediff --git a/docs/microvm/not-supported.mdx b/docs/microvm/not-supported.mdxindex c6030b98..fb3a93e4 100644--- a/docs/microvm/not-supported.mdx+++ b/docs/microvm/not-supported.mdx@@ -39,7 +39,7 @@ These are gaps in our implementation, not the platform's.| **Hibernate** | Suspends in place; hibernated time counts against the lifetime ceiling. || **Org halt** | Archives the filesystem and releases the host, rather than parking the sandbox. || **Idle timeout** | Clamped to the lifetime ceiling; the response tells you whether it was applied. |-| **Sizes** | Only published size tiers can be served. An unavailable size is refused with the list of sizes that exist. |+| **Sizes** | A fixed enum (512 MB – 8 GB, default 4 GB), and only the tiers published in your region. Anything else is refused with the list that exists. |## If something here blocks youdiff --git a/docs/microvm/sdk-differences.mdx b/docs/microvm/sdk-differences.mdxindex 17839629..f0c5bc41 100644--- a/docs/microvm/sdk-differences.mdx+++ b/docs/microvm/sdk-differences.mdx@@ -31,7 +31,7 @@ connection pool captured the upgrade, and WebSockets cannot be negotiated over H| `sandbox.hibernate()` | Suspends in place. The time still counts against the 8-hour ceiling. || `sandbox.restoreCheckpoint(id)` | Restores files onto a fresh boot — no live process state. || `sandbox.setTimeout(seconds)` | Clamped to the lifetime ceiling; check `applied` in the response. |-| `Sandbox.create({ memoryMB })` | Only published size tiers; anything else is refused with the list. |+| `Sandbox.create({ memoryMB })` | A fixed enum up to 8 GB, and only tiers published in your region; anything else is refused with the list. |## Unchangeddiff --git a/docs/microvm/secrets.mdx b/docs/microvm/secrets.mdxindex 61fd28db..b159ca3e 100644--- a/docs/microvm/secrets.mdx+++ b/docs/microvm/secrets.mdx@@ -1,59 +1,133 @@---title: "Secrets"-description: "Sealed tokens, host scoping, and where the real value lives"+description: "What changed, what didn't, and what it means for your threat model"----Secrets behave the same way from your code's point of view, and the protection model is the-same: your sandbox never holds the real value.+**Your code does not change.** Secrets are declared the same way, arrive the same way, and are+substituted the same way. What changed is *where the process holding the real values runs* —+and that has one consequence worth understanding before you migrate.-## How it works+## How secrets work (unchanged)-Put secrets in a store, then name the store when you create a sandbox:+Put values in a secret store, then name the store when creating a sandbox:```typescript-// the sandbox is created with the store attachedconst sandbox = await Sandbox.create({ secretStore: "prod-keys" });const out = await sandbox.exec.run('echo "$MY_TOKEN"');console.log(out.stdout); // osb_sealed_3cda2f3ca0a0e0509a338cab83298f43```-The environment variable holds a **sealed placeholder**, not your secret. When the sandbox-makes a request to a host that secret is scoped to, a proxy substitutes the real value into the-outbound request. Requests anywhere else carry the placeholder, which is worthless.+The environment variable holds a **sealed placeholder**, never your secret. When the sandbox+makes a request to a host that secret is scoped to, a proxy swaps the real value into the+outbound request. All three of these properties are identical on both runtimes:++<CardGroup cols={2}>+ <Card title="The sandbox never holds the value" icon="lock">+ Only an `osb_sealed_…` placeholder is present in the environment, on disk, and in any+ process the customer can read.+ </Card>+ <Card title="Bypass fails closed" icon="shield-check">+ Code that ignores the proxy and dials an upstream directly sends the placeholder — a+ worthless string — rather than leaking the key.+ </Card>+ <Card title="Substitution is host-scoped" icon="filter">+ A secret scoped to `api.github.com` is substituted there and nowhere else. Sending it to a+ server you control yields the placeholder.+ </Card>+ <Card title="Rotation needs no restart" icon="rotate">+ Updating a value takes effect on running sandboxes. The placeholder does not change — only+ what it resolves to.+ </Card>+</CardGroup>++## What changed++The proxy moved **from a host outside your sandbox to a root-owned process inside it.**++| | Current runtime | MicroVM |+|---|---|---|+| Where the proxy runs | on the VM host, outside your sandbox | inside your sandbox, as root |+| What your code sees | `osb_sealed_…` | `osb_sealed_…` (identical) |+| Who can read the real value | root on the VM host | root **in your sandbox** |+| Reachable by a sandbox escape? | no — it is across the VM boundary | yes, if code escalates to root |++### Why it moved++It had to. The old proxy ran on the VM hosts we operated. This runtime has no such host — that+is the entire point of it — so the proxy had to go somewhere else.++The obvious alternative was a shared proxy service per region. We rejected that: it would be a+single service holding **every customer's** secrets and a single point of failure on every+customer's egress path, bought specifically to defend against escalation *within one tenant*.+Concentrating everyone's secrets to mitigate a single-tenant risk is a worse trade.++So the proxy runs in the guest, owned by root, with your code running unprivileged.++### What that actually means++Your code runs as the unprivileged `sandbox` user and cannot read root's memory, so+day-to-day protection is unchanged.-That means bypassing the proxy fails closed — code that dials an upstream directly sends a-useless string rather than leaking your key.+<Warning>+The difference is the blast radius of a **privilege escalation inside your sandbox**. On the+current runtime, root in the guest still could not reach the proxy. Here, it can reach the+secrets scoped to that sandbox.+</Warning>-## Host scoping+Nothing else expands. A compromised sandbox still cannot reach another sandbox's secrets, and+the host-scoping rules still apply to whatever it does reach.++## Does this affect you?++For most workloads, no. If code in your sandbox can escalate to root, the secrets that sandbox+was already permitted to use are usually not the most valuable thing now reachable.++It matters if you run genuinely untrusted code — arbitrary user submissions, an agent executing+code it wrote — **and** that sandbox holds credentials worth more than the work it is doing.++If that describes you:++<Steps>+ <Step title="Scope each secret to the fewest hosts that work">+ Host scoping is enforced at the proxy. A secret usable only against one API is worth much+ less to an attacker than one usable anywhere.+ </Step>+ <Step title="Give untrusted workloads their own store">+ Do not share a store between untrusted execution and your trusted services. A sandbox can+ only reach the store it was created with.+ </Step>+ <Step title="Prefer short-lived credentials">+ The 8-hour lifetime ceiling makes this natural — no sandbox outlives a same-day token.+ </Step>+ <Step title="Keep the highest-value credentials out of sandboxes">+ Put them behind a service the sandbox calls, so the sandbox holds a token for your service+ rather than the credential itself.+ </Step>+</Steps>-A secret is only substituted for the hosts it is allowed to reach:+## Rotation-```typescript-// MY_TOKEN scoped to api.github.com-// a request to api.github.com -> the real value is substituted-// a request to anywhere else -> osb_sealed_... is sent instead+```+PUT /api/secret-stores/{id}/secrets/{name} {"value": "new-value"}```-## Rotation--Updating a secret's value takes effect on running sandboxes without a restart. The sealed-placeholder does not change — only what it resolves to — so nothing inside the sandbox needs to-know a rotation happened.+Running sandboxes pick the new value up without a restart, and the sealed placeholder in their+environment is unchanged — nothing inside the sandbox needs to know a rotation happened.-## The one real difference+<Note>+If you use secret rotation, this is worth re-testing after you migrate. On earlier builds a+rotation against this runtime returned `200` with `refreshed: 0` and the sandbox kept serving+the old value. That is fixed, and the response now reports how many sandboxes were actually+refreshed — check that number rather than the status code.+</Note>-<Warning>-On this runtime the substituting proxy runs **inside your sandbox**, as root, rather than on a-separate machine.-</Warning>+## Egress allowlists-Your code runs as the unprivileged `sandbox` user and cannot read root's memory, so the-day-to-day protection is unchanged. What changes is the blast radius of a privilege escalation-*inside* the sandbox: on the current runtime that would not reach your secrets, and here it-would.+A store can restrict outbound HTTPS to a set of hosts. Requests to anything else are refused,+and this is unchanged between runtimes. The sandbox also cannot use the proxy to reach cloud+instance metadata.-We made this choice deliberately over a shared regional proxy, which would have been a single-service holding every customer's secrets and a single point of failure on everyone's egress.-The reasoning, and what it means if you model this risk, is on-[Security model](/microvm/security-model).+<Card title="Security model" icon="shield" href="/microvm/security-model">+ Isolation boundaries, egress, and the full reasoning behind the proxy's placement.+</Card>diff --git a/docs/microvm/sizes.mdx b/docs/microvm/sizes.mdxindex 6b4ec35a..fd1f883d 100644--- a/docs/microvm/sizes.mdx+++ b/docs/microvm/sizes.mdx@@ -1,50 +1,92 @@---title: "Sandbox sizes"-description: "Choosing memory, and what happens when a size is unavailable"+description: "Which memory sizes exist, which are available to you, and what happens when one isn't"----On this runtime, a sandbox's memory is a property of the image it launches from. Each size we-offer in a region is a separately published image.+On this runtime a sandbox's memory is a property of the **image** it launches from, not a+parameter of the launch. The platform has no memory or vCPU field on the create call at all —+the only knob is the memory declared when an image is published.-```typescript-const sandbox = await Sandbox.create({ memoryMB: 4096 });-```+Two consequences follow, and they explain everything else on this page: the set of sizes is a+fixed list rather than any number you like, and a size cannot change after launch.++## Sizes the platform supports++These are the only values that can exist, on the `al2023-1` base image:++| Memory | vCPU | Notes |+|---|---|---|+| 512 MB | shared | |+| 1024 MB | shared | |+| 2048 MB | 1 | first size with a full vCPU |+| **4096 MB** | 1 | **default** |+| 8192 MB | 1 (peak to 4×) | largest available |-Omitting `memoryMB` gives you the region's default size, which is the one kept in the warm pool-and therefore the fastest to start.+<Note>+This is an enum, not a range. `3072` and `16384` are not "not yet published" — they cannot be+published, because the platform does not offer them. The largest sandbox available is 8 GB.+</Note>++CPU is not separately selectable. The platform allocates it with memory: a full vCPU from+2048 MB upwards, with peak bursting to roughly 4× on the largest size. **4096 MB is the default+specifically because it is the smallest size that reliably delivers a full vCPU.**-## Unavailable sizes are refused+## Which sizes are available to you-If you ask for a size that has no published image in that region, the create is refused — with-the sizes that *are* available:+Every size above is *possible*; which ones are *published in your region* is configuration.+A region typically publishes the default and a subset of the others.++There is no endpoint that lists them. The reliable way to find out is to ask for one — an+unavailable size is refused with the list of sizes that region actually offers:```json{- "error": "requested sandbox size is not available in this region: 16384MB was requested; this region offers 4096 MB",+ "error": "requested sandbox size is not available in this region: 8192MB was requested; this region offers 4096 MB","hint": "request one of the listed sizes, or contact support to have another published"}```<Note>-This is a `400`, not a `503`. The request names something that does not exist, so retrying will-never help — as opposed to a genuine capacity shortage, which is reported separately and is+That is a `400`, not a `503`. The request names something the region cannot serve, so retrying+never helps — as opposed to a real capacity shortage, which is reported separately and *is*worth retrying.</Note>-The important property is that you are never *silently* given a different size than you asked-for. Memory cannot be adjusted after launch, so a quiet downgrade would bill you for one size-and hand you another with no later point at which the mistake could be corrected.+If a size in the supported enum is not published in your region and you need it, ask us — that+is a matter of publishing another image, and it is quick. A size outside the enum is not.++## Choosing one++```typescript+const sandbox = await Sandbox.create(); // default, 4096 MB+const bigger = await Sandbox.create({ memoryMB: 8192 }); // if published in your region+```++Omitting `memoryMB` gives you the default. That is also the fastest option:++<Warning>+**Only the default size is kept warm.** Every other size cold-launches from its own image,+which takes a few seconds rather than the sub-second create you get from the pool.+</Warning>++Warm stock is per-image, so pooling every size would either multiply idle cost by the number of+tiers or split one pool between them and lose the latency the pool exists for. Deliberately, one+size is fast and the rest are correct.++## You are never silently given the wrong size-## Non-default sizes start colder+If a size cannot be served, the create fails. It is never quietly served from the default image.-Only the default size is kept warm. Another size has to cold-launch from its own image, which-takes noticeably longer than a pooled create. If start latency matters, prefer the default.+This matters more here than on the current runtime: memory is fixed at launch, so there is no+later point at which a wrong size could be corrected — you would simply be billed for one size+and running on another for the life of the sandbox.## Resizing is not possible<Warning>-`scale()` and autoscaling are not supported. Memory is fixed at launch by the image, so a-running sandbox cannot be resized.+`scale()` and `setAutoscale()` return `501`. Memory belongs to the image, so a running sandbox+cannot be resized.</Warning>-If you size sandboxes dynamically today, decide the size at create time instead.+If you size sandboxes dynamically today, that decision has to move to create time. See+[What's not supported](/microvm/not-supported).diff --git a/docs/microvm/whats-different.mdx b/docs/microvm/whats-different.mdxindex 7385f940..e99f03b3 100644--- a/docs/microvm/whats-different.mdx+++ b/docs/microvm/whats-different.mdx@@ -15,7 +15,7 @@ Everything not listed here behaves identically, and the same SDK code runs on bo| Hibernate | checkpoint to storage, wake anywhere | suspend in place || Hibernated time | does not count against a lifetime | **counts against the 8 hours** || Resize a running sandbox | supported | not supported |-| Sizes | requested at create | fixed per published size tier |+| Sizes | any memory value at create | a fixed enum, 512 MB – 8 GB, default 4 GB || Mounts (FUSE/NFS/overlay) | supported | not possible || Image builds | supported | not yet || Fork from a checkpoint | supported | not yet |@@ -24,13 +24,17 @@ Everything not listed here behaves identically, and the same SDK code runs on bo| Live migration | supported | not applicable || Exec, files, PTY, preview URLs, webhooks, signed URLs | — | identical |-## The two that will bite+## The three that will bite**The 8-hour ceiling** is the one to plan around. It is a property of the platform underneath,not a quota we can raise, and it counts hibernated time. A sandbox you hibernate for the nightdoes not come back in the morning. If you have work that assumes a long-lived box, read[Sandbox lifetime](/microvm/lifetime) before anything else.+**Memory tops out at 8 GB** and cannot be changed after launch. On the current runtime you ask+for whatever you need and can resize later; here the sizes are a fixed enum and the largest is+8 GB. See [Sandbox sizes](/microvm/sizes).+**Checkpoints don't capture memory.** If you use checkpoints to freeze a warmed-up process —a loaded model, an open connection pool, a debugger mid-session — restoring will not give thatback. You get the filesystem, and your process starts again. If you use checkpoints to capture