How we secure Figma's multiplayer agent platform
Sandboxing untrusted code with real authority
Sandboxing untrusted code is familiar, but giving it authority to act on behalf of a user in a shared file isnât.
Hereâs how we isolate and limit agents in Figma Make and the Figma agent.
Figma has long used sandboxing. While we need to give an agentâs sandbox real authority to be useful, we also need to make sure itâs limited in what it can read, change, or disclose.
Hereâs how we secured Figmaâs multiplayer agent sandbox platform by keeping every agentâs authority narrow, isolated, and enforced outside its sandbox.
Weâll cover the credentials agents hold, what those credentials allow, where data can go, and how we keep collaboratorsâ authority separate.
Building agents for multiplayer files
In a multiplayer file, multiple editors and their agents collaborate on the same canvas and code.
Figmaâs AI products require tens of thousands of sandboxes to run untrusted code safely. Thatâs why we built Nimbus: a platform that makes sandboxes fast, reliable, and easy for Figma product teams and operators to manage.
That leaves two threats for us to control:
- A misaligned agent that acts against its own userâs intent through mistakes, bugs, or prompt injection-for example, uploading a file to a public file-sharing service while trying to help.
- A malicious collaborator trying to use shared file content to reach another editorâs credentials or connected tools.
Controlling what an agent can do
The first threat we focused on is agent misalignment. Since a misaligned agent can run arbitrary code inside its sandbox, we limit its capabilities and enforce authorization in trusted infrastructure outside the sandbox.
Least privilege is the principle of granting a user, process, or service only the minimum permissions needed to perform its intended task.
Multi-tenancy is an architecture where shared infrastructure serves multiple users while keeping their data and workloads isolated.
How agents use those capabilities changes how we think about least privilege. When trying to finish a task, agents will systematically probe every credential they can read and every API they can reach.
Least privilege used to serve as a guardrail around deterministic application code in multi-tenant systems, but now itâs a hard requirement for agent systems, which tend to exhaust whatever capabilities theyâre given.
Scoping agent credentials with FigJWTs
To do useful work, an agent needs to act on a userâs behalf by calling a model provider through our AI gateway or invoking a connected tool through its Model Context Protocol (MCP).
We achieved this with a credential we called the FigJWT, a signed JSON Web Token issued by our trusted backend services.
A FigJWT works with standard authentication headers while expressing who the agent acts for, which workload it runs, and which file it can access.
Figmaâs AI gateway and other receiving services validate the FigJWT on every request and decide whether to authorize the action.
As we built more agent experiences, FigJWTs became the canonical way for sandbox workloads to reach our services.
After a few months of organic growth, though, sandboxes with very different needs were sharing the same broadly capable token. An agent that needs LLM inference doesnât necessarily need external tools, and two workloads calling our backend rarely need the same routes.
To tighten permissions without breaking live workflows, we instrumented consuming services to log which capabilities each FigJWT actually exercised.
That telemetry showed where we could narrow access-for instance, the sandbox that builds cached Make previews only needed backend requests and never needed LLM inference, so its token could be restricted to those operations alone.
From there, we introduced token profiles and a set of granular capabilities to grant each profile. AgentControl, the service that coordinates agents, mints a FigJWT for each prompt with a profile identifying the workloadâs permission set.
Example FigJWT claims (abbreviated):
{ "sub": "user_123", "fileKey": "file_abc", "tokenProfile": "make-generic", "exp": 1767225600 }
Because the token is signed by the trusted issuer, code inside the sandbox can present it but canât alter its claims or edit a local config to grant itself extra permissions.
Consuming services enforce those profiles outside the sandbox using YAML policies. In its simplified form, the AI gateway maps each profile to its allowed capabilities:
profiles:
make-generic:
ai_gateway: [llm, mcp, backend]
make-cached-preview:
ai_gateway: [backend]
With this policy, cached-preview tokens cannot authorize inference or MCP requests.
Access to Figmaâs backend, Sinatra, is further narrowed by route policies-allowing the cached-preview profile on the thumbnail route, for example:
POST /api/internal/make/:file_id/thumbnail:
- make-cached-preview
Tightening permissions on live workflows required a careful rollout. We ran new policies in shadow mode first, checked which real requests wouldâve been blocked against each agentâs intended capabilities, and gradually enabled enforcement behind feature flags.
Limiting file access in the permissions system
To support Figmaâs editing workflows, agents need to read and modify Figma files through our internal APIs. Because an agent acts on a userâs behalf, those permissions can span every file in the userâs plan-far broader than the single file an agent needs to access while working with a user.
If a misaligned agent is steered off course by untrusted file content or makes a mistake, file scope limits its Figma API access to the active file.
We originally enforced file scope inside individual endpoints, but those checks left a gap. An endpoint could confirm that an agentâs token was scoped to file A, then call a helper that checked the userâs permission on file B. Because the user could access file B, the helper check succeeded even though file B was outside the tokenâs scope.
We considered requiring every endpoint to declare whether it needs a file-scoped token, but that wouldnât have closed the gap in shared helpers.
Instead, we moved file-scope enforcement to our pre-existing centralized permissions system. For example, this policy denies all file permissions when a FigJWT is scoped to a different file:
class DenyAccessToOtherFiles extends DenyPolicy(PolicyResourceType.FILE) {
applyFilter: ExpressionDef = and([
[FigJwtClaims.fileKey, '<>', null],
[File.key, '<>', { type: 'field', ref: FigJwtClaims.fileKey }],
])
permissions = getAllPermissionsForResource(FilePermission)
}
If the token is scoped to file A, this policy denies access to file B, even when the user owns both.
File scope only narrows a userâs existing Figma file permissions; separate controls govern what an agent can do through connected tools.
Controlling where data can go
A misaligned agent can also send data somewhere the user never intended. After ordinary requests to export assets, we saw agents try to upload files to public file-sharing services to give the user a link.
Nobody was attacking the system-the agents were trying to be helpful-but this underscored why we couldnât rely on intent alone to control egress.
We saw the same pattern with coding agents on our own engineersâ laptops. While working on routine tasks, agents searched home directories for private keys, suggested piping remote install scripts straight into a shell, and in one case, printed service credentials into a transcript while debugging.
Prompt instructions telling agents to inspect scripts before running them didnât hold. Just as our security teams needed external controls on laptops to restrict file access and flag risky commands, we needed to enforce outbound network controls outside the agentâs sandbox.
By default, Make and Figma agent sandboxes can send a request body only to hosts on their allowlist, such as package registries for pulling code dependencies.
Requests to all other hosts are limited to GET, HEAD, or OPTIONS with no body and URLs capped at 10 KB-enough for read-only actions like web search and reading documentation, while blocking agents from uploading files to arbitrary servers.
In practice, these restrictions keep agents âon the rails,â but read requests can still leak small amounts of data per request through their URLs and headers.
For Make and the Figma agent, organization admins who want stricter isolation can disable general internet access in the admin panel and only allow the hosts they choose and the small set of hosts agents need to operate.
Finally, we bound how long an agent can act. AI gateway FigJWTs expire after two hours, and sandbox lifetimes cap how long the environment itself stays alive.
Isolating credentials between collaborators
Coding agents face a similar isolation problem: Collaborators work on a shared code repository, but each agent runs in its userâs own environment with access to their filesystem and credentials.
In Figma, the shared state lives in a multiplayer file, and we give each user their own sandbox for that file.
The second threat we focused on is a collaborator using shared state in multiplayer files to reach another userâs authority: stealing their tokens, acting as them through connected tools, or accessing and exfiltrating their data.
Itâs tempting to think a shared file should have a shared sandbox. Much of Figmaâs infrastructure is multi-tenant: For example, our multiplayer service handles many usersâ files in a shared, memory-safe service, and other services execute untrusted code in sandboxes such as nsjail.
Agent sandboxes are different because they execute arbitrary code that collaborators can share and change, while also needing credentials and broader authority to act on the userâs behalf. If collaborators shared a sandbox, that code could read credentials from the shared environment and act as another user.
With separate sandboxes, agents can still collaborate on and commit changes to the same file using user-specific credentials. Every request draws from the driving userâs file permissions and credit budget, attributes file changes to that user, and stays bound by the permission and network controls above.
The same separation applies to connected tools: For MCP servers that use OAuth, our AI gateway looks up the connection belonging to the user in the FigJWT, so an editorâs agent can only ever use that editorâs own OAuth connections.
Even with isolated sandboxes, editors can modify shared file contents that another editorâs sandbox will later load and run. Therefore, we need to carefully consider when a sandbox receives credentials and provide them just in time, as the user prompts the agent to act on their behalf.
In Figma Make, when a collaborator with edit access opens a file, we provision a sandbox so they can build and preview the application right away, but opening a file shouldnât let collaborator-written code trigger LLM inference or MCP calls on their behalf.
Instead of injecting those credentials when the sandbox starts, we supply them just in time with each user prompt.
Binding FigJWTs to their sandbox
Isolating sandboxes keeps collaboratorsâ credentials separate, but a plaintext token inside a sandbox is still portable. Whether a FigJWT leaks through shared state or an agent mistake-or is copied out deliberately by a user-anyone holding it could authenticate to our AI gateway as that user and invoke their connected tools while the token remains valid.
Inference access has become a hot target for abuse across the industry, with copied credentials used to access models and resell access through proxy services-a pattern often called âLLMjacking.â
In our initial design, we exposed FigJWTs to sandboxes in an environment variable because we built on vendor infrastructure to move fast, and our sandbox providers didnât yet support routing outbound HTTPS traffic through our own egress proxy.
Over time, we noticed a pattern of new Figma accounts creating a Make file, copying FigJWTs from their own sandboxes, and reusing them outside the product against our AI gateway.
Short token lifetimes and plan spend limits enforced by the AI gateway bounded each token, but rotating through new accounts and tokens still let that reuse continue.
We needed FigJWTs that only worked from the sandbox they were issued to. Since code inside the sandbox only needs to attach the token to outbound requests, it didnât need access to the plaintext token at all.
To make that happen, we worked with our sandbox providers to route all outbound HTTPS traffic from sandboxes through our own egress proxy.
Comments
No comments yet. Start the discussion.