# Security

fctl runs code-writing agents with access to your repositories and your
Claude subscription. This page says what it protects, how, and what it
trusts.

## What it protects

| Asset | Where it lives | Who can use it |
|---|---|---|
| Passwords | argon2id hashes in D1 | nobody can read them back |
| Authenticator app secrets (two-factor) | encrypted (AES-256-GCM) in D1 | the control plane, to check codes |
| Recovery codes | HMAC-SHA256 hashes in D1, keyed by the master key (older ones SHA-256 hashes, until used or replaced) | nobody can read them back |
| Passkeys | public keys in D1; the private key never leaves the person's device or password manager | the person, with their fingerprint, face or screen lock |
| Sessions and tokens | SHA-256 hashes in D1; the secret only with its holder | the holder |
| Claude credentials | encrypted (AES-256-GCM) in D1, or, for tokens people keep on their runners, only in a file on those runners (mode 0600) | sessions their owner starts |
| Project secrets | encrypted in D1 | that project's sessions, as environment variables |
| Profile pictures (uploaded, or copied from Google or Gravatar) | images in D1 | anyone signed in to the instance, at an address with the person's user ID |
| Workspace avatars | images in D1 | the workspace's members, people it invited, instance admins |
| Attached files | the project's Durable Object | people who can see the session they were sent in; its runner and agent |
| Images agents read | the session's Durable Object, for 7 days | people who can see the session |
| Session snapshots (Claude's conversation and the work the agent hadn't pushed) | the session's Durable Object, or a bucket of your own where runners' `host.toml` names one (the control plane keeps only where), encrypted (AES-256-GCM) in the sandbox with the session's own key, which D1 keeps encrypted with the master key | the session's agent, on the runner that runs it |
| Published screenshots | the project's Durable Object, found by the SHA-256 of their links' tokens in D1 | anyone with a link, until it expires |
| GitHub App key | a Worker secret (outside Cloudflare, the server's environment) | the control plane, to mint short-lived tokens |
| GitHub webhook secret | a Worker secret (outside Cloudflare, the server's environment) | the control plane, to check that deliveries come from GitHub |
| Linear app's client secret and webhook secret | Worker secrets (outside Cloudflare, the server's environment) | the control plane, to install fctl's app in Linear, renew its tokens and check that deliveries come from Linear |
| Linear tokens (fctl's app in each Linear workspace) | encrypted (AES-256-GCM) in D1 | the control plane, for the projects of the fctl workspaces connected to that Linear workspace; never sandboxes |
| Slack app's client secret, signing secret and app-level token | Worker secrets (outside Cloudflare, the server's environment) | the control plane, to install fctl's app in Slack, sign people in with Slack, check that requests come from Slack, and open Socket Mode |
| Slack bot tokens (fctl's app in each Slack workspace) | encrypted (AES-256-GCM) in D1 | the control plane, for the fctl workspaces connected to that Slack workspace and their sessions' agents' `fctl slack` calls; never sandboxes |
| Web Push (VAPID) key | encrypted in D1 | the control plane, to sign notifications |
| Identity token signing keys (RSA) | encrypted in D1, a new one every 30 days; their public halves at each workspace's issuer | the control plane, to sign the tokens agents mint for their own sessions |
| Master key | a Worker secret (outside Cloudflare, the server's environment, or a file it made in its data directory) | the control plane |

Encrypted values are bound to their row (the AES-GCM associated data names the
owner and purpose), so a value copied between rows does not decrypt.

## Access

- Accounts exist only for allowlisted emails or domains. Each of an
  account's addresses was invited (or admitted) on its own, and any of them
  signs in to the same account, with the same factors. Removing an
  allowlist entry disconnects the addresses it admitted from their
  accounts, which leave the workspaces they are in as them, and disables
  the accounts none of whose addresses is admitted any more, revoking their
  tokens. Revoking an invitation takes back the entry it added, and
  demoting or removing an admin turns the entries that admitted their
  addresses as an admin into a member's, so that a Google sign-up, which
  needs no invitation, can't bring them back as one; disconnecting an
  address from an account does too, and an invitation signs up an admin
  only while the entry that admits its address still says admin; an
  admin's invitation that runs out unused leaves its address a member's
  entry.
  Disconnecting an address also uses up the account's password reset
  links, and revoking someone's tokens (a new password, a reset) refuses
  the CLI sign-ins they approved that no CLI has picked up yet.
- **Workspaces** keep their projects, sessions, files and secrets to their
  members: people outside one are told its projects and sessions don't
  exist, whatever they started there or was shared with them, and instance
  admins see inside only the ones they are members of. An invitation to a
  workspace counts only while the admin who sent it is still one, so
  that an admin who is removed, demoted or disabled can't come back
  through an invitation to another address of theirs. Starting a session
  makes someone its owner only while they may start sessions in its
  project: one made a viewer of it, or taken out of it, can't go on
  messaging its agent, resuming it or sharing it. On an instance that
  sends email, the password reset and invitation links admins make go to
  the addresses alone, never to the admin: a reset link signs in as its
  person, and an invitation's joins the workspaces that invited its
  address. Without email, admins hand those links over, so whoever runs
  such an instance can sign in as its people. A workspace sees
  only the address each member joined as. Only its admins create its
  projects, so its members' agents reach the repositories of the projects
  the admins made and opened to them, not every one its GitHub accounts
  cover.
- **Claude connections** are their person's: nobody else sees a token,
  the Claude account it belongs to or the label its person gave it. A
  workspace's admins see facts about the connection each member's
  sessions there run on, as much as the instance and the workspace let
  them ([Claude seats](https://fctl.sh/docs/organizations.md#claude-seats)): whether they have
  one and whether Claude still takes it, when its token runs out, whether
  their sessions wait for a usage limit to reset, and, with `details`, its
  kind and who set it, its plan, when Claude last answered it and how often
  their sessions in the workspace paused on limits. Each member reads in
  the workspace's Settings → You what its admins see. Instance admins see
  everyone's the same way only where the instance turns it on
  (`claude_instance_view`, off by default).
- Browser sessions are `__Host-` cookies (`Secure`, `HttpOnly`,
  `SameSite=Lax`). An instance served over plain http at an address other
  than localhost, which only [a control plane of your own](https://fctl.sh/docs/security.md#the-control-plane-without-cloudflare)
  can be, sets them without the prefix and `Secure`, which browsers refuse
  there. Requests that change state must come from the app's own
  origin (`Origin` / `Sec-Fetch-Site`) and carry JSON; WebSocket upgrades are
  origin-checked too.
- **Two-factor sign-in.** With an authenticator app set up (Settings, or
  `fctl account two-factor enable`), a sign-in with the password, and with
  Google when you or the admins choose that, takes a code from the app
  (TOTP) or one of ten recovery codes. Each code works once, and five wrong
  ones in a row make codes from the app wait a minute, doubling with each
  further one up to an hour; recovery codes still work meanwhile, and you
  get an email, since whoever it was knew your password. A reset link's new
  password takes effect only once a code checks out, so the link alone
  signs nobody in. Replacing the app, turning it off and getting new
  recovery codes take a current code; setting up an app takes the password
  unless the browser signed in within 15 minutes (with a CLI or access
  token, always), and on an account without a password, or whose password
  sign-ins ask for a passkey already, that sign-in.
  Admins can require it:
  accounts that sign in with a password, and with Google sign-ins asking
  too every account, then can do nothing until they set it up, in the
  browser or with their CLI and access tokens. An attacker who has the
  password of an account that hasn't set it up yet could set it up first;
  the email about it (when email is set up) and the audit log show that,
  and admins reset two-factor for people who lost their phone (the
  primary instance owner for admins; the owner's own takes a recovery
  code). A workspace's admins can require it of its members in the same
  way: a member without a second factor can't open the workspace until
  they set one up, and their sign-ins ask for it.
- **Passkeys** sign in without a password or code: the device checks it's
  the person (fingerprint, face, screen lock or PIN), and the signature
  works only for this instance's host name, so a fake site can't use it.
  fctl keeps the public key, each challenge works once for ten minutes, and
  a counter that goes back (a copied passkey's would) refuses the sign-in.
  Adding one takes the password unless the browser signed in within 15
  minutes, and a code from the authenticator app instead for an account
  that has one, so a stolen session can't add a way in, even with the
  password, and emails the person.
  Where two-factor is required, a passkey also counts as the second factor.
- **A domain's provider.** Where an instance's admins require one for a
  domain (Admin → Sign-in, `fctl admin sign-in require`; Google today),
  the accounts with an address there sign in only with that provider, as
  an address there that it vouches for: Google only where it hosts the
  address (a Google Workspace account's, never a personal account's that
  shows it). Each browser session keeps how it was made, and a CLI's, an
  access token's, an admin token's and a Slack link's take it from the
  sign-in that made them, so that every request checks it: passwords, passkeys alone
  (unless the admins allow them) and reset links stop working, and saving
  the rule deletes the sign-ins made otherwise, before it too. A covered
  account's first whole sign-in with the provider takes its password; a
  second account of the provider at the domain doesn't link to an account
  that has one; and its people can't disconnect an address there. The
  primary instance owner keeps their password and passkeys, the way in
  while the provider is down; an admin can't save a rule their own
  sign-in doesn't meet, and letting a domain go, or passkeys in, is a
  sensitive action. Closing someone's account at the provider stops their
  next sign-in, not the sign-ins they have: disable their account here
  too, or keep sign-ins short.
- **How long sign-ins last.** A browser's sign-in ends after 30 days
  unused, a CLI's after 180, and an access token when its maker chose.
  Instance admins can say less (Admin → Sign-in → Staying signed in,
  `fctl admin sign-in policies`): browsers signed in at most so many
  hours, however much they're used, and signed out after as little as 5
  minutes unused; CLIs at most so many days; access tokens no older than
  so many days, and made by admins alone. Every request checks its token
  against them, those made before too, and saving one ends the sign-ins
  it doesn't let last. Letting them last longer is a sensitive action.
- **Networks.** Instance admins can take sign-ins and requests only from
  some IP ranges (Admin → Sign-in → Networks): browsers, CLIs, access
  tokens, admin tokens and service accounts elsewhere are refused, while
  runners, webhooks and published links aren't held to them. The primary
  instance owner signs in from anywhere with a browser or the CLI; an admin
  can't save ranges their own address is outside of; and letting people in
  from more places is a sensitive action. The address is the one
  Cloudflare, or a self-hosted server's trusted proxies, saw.
- **A workspace's own requirement.** A workspace's admins can require
  Google of its members who are in it as an address at some domains
  (`fctl workspaces set --require-google acme.com`): such a member's
  request with a sign-in made another way, a password's or a personal
  Google account's, finds the workspace, its projects and sessions
  closed, as its two-factor requirement closes it, open sockets
  included, and so does a request from Slack whose link was made with
  such a sign-in, or found by address. It closes nothing else, so it
  needs no proof of the domains.
  An admin can't save one that would close it to their own sign-in, its
  primary admin can lift it whatever their sign-in, and requiring less
  is a sensitive action. Closing someone's Google account stops their
  next sign-in, not the sign-ins they have: remove them from the
  workspace too.
- **Sensitive actions take a passkey or a code**, where the primary
  instance owner turns that on (off by default): inviting and promoting
  admins, handing over the primary owner's and workspaces' primary admin
  roles, turning two-factor sign-in, codes on Google sign-in or this off,
  resetting someone's
  two-factor sign-in, removing a passkey, adding or registering a runner
  and replacing a runner's token, new access tokens and CLI
  sign-ins, connecting a Claude subscription (whose account a full login's
  sessions show in), linking a Linear account (whose delegations start
  sessions as you) or a Slack account (whose requests start them as you),
  exporting your data, deleting accounts, projects and
  workspaces, and, without email, making someone a password reset link.
  So a stolen browser session, CLI or access token can't do them alone.
  Connecting a Claude subscription and linking a Linear or Slack account
  also email the person, when email is set up. A passkey (which must verify the
  person), a code from the authenticator app or a recovery code confirms
  it, for 15 minutes, for the browser, CLI or token that confirmed; a
  sign-in with a passkey or a second factor counts. People with neither a
  passkey nor an authenticator app aren't asked, and only the primary
  instance owner turns it on or off, which takes confirming it too.
- The CLI signs in with a device flow (you approve a code in the browser) and
  gets a revocable token; Settings lists every device and token.
- **Access tokens** for scripts, CI and bots can be limited to reading,
  running sessions or everything their person may, to some workspaces and
  projects, and in what their sessions' agents may do on GitHub. A limited
  token reaches projects and sessions alone: one rule in the router refuses
  it the account, workspaces' people and settings, Claude connections,
  other tokens and administration before any handler runs, so a token that
  leaks from CI can't make itself another, and its roles in its projects
  are capped. It can't message or resume a session whose agent started
  able to do more on GitHub than it allows, and only a token that runs
  sessions may hold its agents lower: one that does everything could
  change the settings that steer them. Make them expire, and revoke one that may have
  leaked in Settings or with `fctl tokens revoke`.
- **Admin tokens** (`fctl_adm_…`) exist only where a self-hosted
  instance's deployment turns them on (`FCTL_ADMIN_TOKENS=1`): app.fctl.sh
  takes none, makes none, and a test checks that its configuration never
  sets the variable. An instance admin makes one, which takes confirming
  it's them where the instance asks for that, and it acts as them while
  they are an active admin. It reaches the admin API's people endpoints
  alone, by the same kind of rule in the router as limited tokens: it
  creates accounts, changes people's names, addresses, commit emails,
  pictures and Claude tokens, places them in any workspace and project,
  and disables and deletes them, but changes no roles, nor the allowlist,
  invitations, the instance's settings, or anything inside projects, and
  makes no other token. No token changes the primary instance owner's
  account or makes its password reset link, so that a leaked one can't
  point their address elsewhere, or reset their password, and take the
  instance over, and only the primary owner's change admins'.
  Whoever holds one can still take over any member's account (changing
  their address, then resetting their password), so keep it where you
  keep your identity provider's secrets, make it expire, and revoke it
  under Admin → Settings → Admin tokens, or with `fctl admin tokens
  revoke`, when it may have leaked; the audit log marks everything one
  did, and with which.
- **Service accounts** (`fctl_svc_…`) are a workspace's, for programs
  that start sessions for its people. A request names the person, and acts
  as them, held to what an access token that runs sessions does in that
  workspace alone, by the same kind of rule in the router: it never reaches
  the account, settings, the project's secrets through the API, other
  tokens or live connections, and of people it sees the workspace's
  members as their admins do (names, the addresses they're members as,
  roles and answers). Its sessions' agents, as any session's, have the
  project's secrets in their sandbox, and their events show what the
  agents print. Where the instance asks people first, as it does unless its
  admins turn that off (which takes confirming it's them), it acts only
  for members who allowed it, each service account on its own; allowing
  one emails you, and takes confirming it's you where the instance asks
  for that. Making one or a new secret for one does too. One works only
  while the admin who made its secret is an active admin of the
  workspace, so that someone who left can't use a secret they kept, and
  waits, as their own tokens do, while they have to set up two-factor
  sign-in first; another admin makes it a new secret, which stops the
  old one at once. Whoever holds one runs work as the people who allowed
  it, on their subscriptions, and steers the sessions they may steer:
  keep it where your program keeps its secrets, and give it a new one
  when it may have leaked. The audit log marks what each did, for whom.
- Sign-in, signup and reset endpoints are rate limited per address and per
  account; unknown emails take as long to fail as known ones. Signing up
  without an invitation, asking for a password reset or for early access,
  and inviting an address to a workspace answer the same whether the
  address has an account or can sign in, so that none of them tells who
  uses the instance (instance admins, who see that anyway, excepted).
- The web app ships a strict Content-Security-Policy (`script-src 'self'`, no
  inline scripts or `eval`; `'wasm-unsafe-eval'` lets its own scripts
  compile WebAssembly, which syntax highlighting runs, and nothing more),
  `frame-ancestors 'none'`, `Cross-Origin-Opener-Policy: same-origin`, HSTS,
  and renders agent output as text (Markdown is parsed into elements, never
  injected as HTML). Links in what agents and other people write open web
  pages in a new tab, and never the app's sign-in pages or API, however
  they name them (`textLink`).
- Notifications go through each browser's push service (Google's for
  Chrome, Mozilla's for Firefox, Apple's for Safari, Microsoft's for Edge),
  encrypted for that browser alone (RFC 8291): the service sees when one
  goes and how big it is, not what it says. They name the session and
  quote the start of the agent's last message, and show like any
  notification, on a lock screen too; people choose what notifies them in
  Settings. The control plane only sends to `https://` addresses of named
  hosts on port 443, follows no redirects from them, and sends to at most
  20 browsers per person.
- File uploads are `application/octet-stream` bodies, which browsers cannot
  send cross-site without asking first, and pass the same origin check.
  Attached files are served with `nosniff` and a sandboxing
  Content-Security-Policy; only PNG, JPEG, GIF and WebP display in place,
  everything else downloads, and only those and the videos the app plays
  keep their type, the rest being `application/octet-stream`, so an
  uploaded HTML, SVG or JavaScript file never runs as part of the app.
  Images agents read come from the sandbox, where anything may pose as
  the agent: the control plane keeps only PNG, JPEG, GIF and WebP images,
  as their bytes say, serves them the same way, and drops any `kept`
  reference an event comes with, so that a transcript names only images
  its own session keeps.
- GitHub's webhook (`POST /api/v1/github/webhook`) takes only deliveries
  signed with the webhook's secret (HMAC-SHA256, checked in constant time),
  and none without the secret. It takes from them only which pull requests
  or commits changed, then asks GitHub itself what became of the pull
  requests sessions list, so a replayed delivery changes nothing.
- Linear's webhook (`POST /api/v1/linear/webhook`) takes only deliveries
  signed with the webhook's secret (HMAC-SHA256, checked in constant time)
  whose `webhookTimestamp` is within a minute of the control plane's
  clock, up to 5 MB, and none without the secret. A delegation or mention
  there starts a session only as the fctl account that linked the Linear
  account it came from, in a project that takes the issue's team, of an
  fctl workspace connected to that Linear workspace, and only while that
  account may start sessions in the project, so nobody in Linear puts a
  ticket on someone else's session or subscription. A delivery for a
  Linear agent session fctl has seen starts nothing new; before its
  session starts, only the person who made it can start it again or
  choose its project, and once it has, replies reach its fctl session
  only from linked accounts that may message it. People link a Linear
  account with a Linear sign-in of their own, whose token the control
  plane uses once to read who they are and then revokes, so an address in
  Linear proves nothing on its own; a sign-in as fctl's app links nothing.
- What Slack sends fctl's app over HTTP (`POST /api/v1/slack/events`,
  `/interactivity`, `/commands`) counts only signed with the app's signing
  secret (`X-Slack-Signature`, HMAC-SHA256, checked in constant time),
  with an `X-Slack-Request-Timestamp` within five minutes of the control
  plane's clock, up to 512 KB, and none without the secret; over Socket
  Mode, it comes on a connection the control plane opened to Slack with
  the app-level token. A mention, a message to the app, `/fctl` or a form
  starts a session only as the fctl account that linked the Slack account
  it came from (or, where the instance and the workspace allow it, whose
  verified address it is), in a project of an fctl workspace connected to
  that Slack workspace that lets such requests start sessions, and only
  while that account may start sessions there, so nobody in Slack puts
  work on someone else's subscription. A thread reaches one session:
  before it starts, only the person who asked moves it on, and once it
  has, replies and answers reach the agent only from people fctl knows
  who may message the session; anyone else's stay in the thread as
  information. People link a Slack account with a Sign in with Slack of
  their own (OpenID Connect, with a nonce), whose token the control plane
  uses once to read who they are and then revokes. fctl takes no Slack
  guests, Enterprise Grid org-wide installs or channels shared with other
  organizations (Slack Connect), whose external people's messages would
  otherwise reach the app and click its buttons.
- Screenshots agents publish for pull requests are public to anyone who
  has a link, which is how GitHub's image proxy fetches them. A link holds
  256 random bits, of which D1 keeps only the SHA-256. The control plane
  publishes only PNG, JPEG, GIF and WebP images, as their bytes say, up to
  5 MB, and serves them with `nosniff`, a sandboxing
  Content-Security-Policy and `noindex`. Links stop working when they
  expire (30 days unless the project chooses 24 hours to 60 days), when
  people who manage the session delete them, and while the instance's
  admins or the project's maintainers turn publishing off; it is off for
  both until they turn it on. Anyone a link is shared with, or who can read
  the pull request, can pass it on.

- Identity tokens prove to an organization's own services and clouds
  that a request comes from one of its sessions
  ([Identity tokens](https://fctl.sh/docs/identity-tokens.md)). The control plane signs one
  only for a session whose sandbox runs, on the runner that runs it, as
  that runner's host asks with its runner token, and fills its claims
  from what it knows of the session: an agent chooses the audience and
  which facts make up the subject, never what they say. A token lasts 10
  minutes and names one audience; a session mints at most 30 a minute.
  Each workspace is an issuer of its own, and a token's signature covers
  its `iss`, so a service or cloud that trusts one workspace trusts no
  other's. Review agents get none, and a project's maintainers turn them
  off for its agents. Whatever runs in a sandbox can mint its session's
  tokens, and the runner's owner can for the sessions it runs, so a token
  proves where a request comes from, not what the agent meant: what it
  reaches is up to the service that trusts it, which can tell sessions
  apart by person, project, runner, GitHub access and what started them.
  The signing keys are sealed with the master key: whoever has both D1
  and the master key can sign tokens, as they can read every other secret
  there.

## Sandboxes

Each session runs in its own Linux VM (Apple container, Firecracker or
Lima) or container (Docker). The agent runs Claude Code with permission
prompts off, because the sandbox is the boundary: it can do anything inside
its VM, and nothing outside it except through these channels:

- **Firecracker VMs** have a kernel of their own, as Apple's and Lima's
  do, where a Docker container shares the host's: a kernel bug in the
  sandbox stays there. They share no filesystem with the host, and the host
  runs what it runs in them through their vsock, not SSH. In projects that
  share package caches, the host serves the project's cache directory to
  each of its VMs over 9P on the vsock (`fctl-agent share`, a process of
  the host's user beside each VM), which anything in the VM can reach: the
  server walks one name at a time without following symlinks, refuses `.`,
  `..` and names with `/`, opens only files and directories, and makes
  neither devices nor setuid files, so the VM reaches nothing of the
  host's but that directory, which its sandbox mounts anyway. Firecracker
  runs with its seccomp filters, as the host's user: a VM escape would run
  as that user, who can read the runner's token, as a container escape can
  with Docker. A host that runs as root runs each VM through Firecracker's
  jailer instead (unless `host.toml` sets `jailer = false`): as a user of
  its own, which no other running VM and nothing else on the machine runs
  as, in a chroot that holds only that VM's kernel, disks and sockets, and
  in a cgroup of its own, so that an escape reaches neither the host's
  files nor another VM's. The host reaches the VM's sockets through links
  of its own, so a jail can't send it to another VM's, and takes the VM's
  disk back from the jail's user when it stops. The state a VM saves as
  it stops is written in its chroot, and the host takes it out only as
  the files Firecracker made there, never through a link the jail put in
  their place, so a jail can't have the host read or change another
  file. Their images unpack in a VM of their own, so a crafted layer
  can't reach the host's filesystem.

- **fctl-agent** runs as root in the sandbox, and Claude and everything
  it runs as the image's user, so that the agent's commands can't stop
  the supervisor that passes on what it does, nor change its journal. The
  default image's user has `sudo`, so this keeps accidents from cutting a
  session short; it is no boundary against the agent. A host's owner who
  wants no long-lived root process in sandboxes turns it off
  (`agent_as_root = false`), and fctl-agent runs as the image's user,
  which the host then runs everything as in Docker, Apple container and
  Lima sandboxes. That gives this up: the agent's commands can stop
  fctl-agent, read and change its journal, state and socket in `~/.fctl`,
  and read its memory, which holds the session's credentials (as Claude's
  environment does anyway).

- **Lima VMs** get none of the mounts of Lima's templates, which give
  each VM the home directory of whoever runs the host (read only) and a
  `/tmp/lima` every VM writes to, and none of their port forwards, which
  put a VM's services on the host's loopback, where other VMs reach them.
  A VM still reaches the host's own loopback services
  (`host.lima.internal`), as Docker Desktop's containers do theirs.
  Lima hosts of fctl 0.14.1 and earlier cloned VMs that could read that
  home directory, with the host's runner token and the CLI's credentials.
  On such a host, remove its runner and install the host again (`fctl
  host uninstall`, `fctl host install`), sign the CLI in again (`fctl
  login`) and revoke its old tokens in Settings, and replace any other
  keys kept in that home directory.

- **Network.** Sandboxes have outbound network access (to install
  dependencies and reach GitHub and Claude). Do not run hosts on networks
  where an outbound connection from an untrusted process is a problem.
  Docker sandboxes join a network of their own, `fctl-sandboxes`, on which
  they reach the internet but not each other, so a session can't reach
  what another session on the host serves, which may be another
  workspace's; a Docker that can't make the network leaves them on its
  default one, and the host says so in its log. With Docker Desktop and
  OrbStack, containers still reach the host's loopback
  (`host.docker.internal`). Firecracker VMs each reach the network through
  a `passt` of their own, which makes their connections the host's: they
  reach neither each other nor the host's loopback. Apple's `container`
  VMs share its network: on a runner that serves more than one workspace,
  keep to Docker or Firecracker where that matters.
- **Cloud metadata.** A cloud machine's instance metadata service
  (`169.254.169.254`, and the addresses of ECS's task credentials, EKS Pod
  Identity, Alibaba Cloud and Tencent Cloud: `fctl_domain::metadata`)
  hands out the machine's own credentials and its user data, where boot
  scripts keep secrets such as an enrollment token, to whatever asks from
  the machine. Sandboxes don't reach it unless the host lets them
  (`allow_cloud_metadata = true` in `host.toml`; [ADR
  0093](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0093-hosts-keep-sandboxes-off-cloud-metadata-services.md)). A
  Docker sandbox gets routes that make those addresses unreachable in its
  network namespace, which a helper container adds with the host's own
  fctl-agent, alone in that namespace with `NET_ADMIN` alone; the sandbox
  runs without `NET_RAW`, so not even its root, which has neither, takes
  the routes out or sends raw frames around them. A Firecracker VM's
  frames to them are dropped on the host, between the VM and its `passt`,
  where the VM's root can't reach, but for DNS, which Google Cloud's
  metadata server answers as the machine's nameserver. A run whose sandbox
  can't be kept off them doesn't start, and says why; a Docker sandbox
  made before, with raw sockets, is replaced as its session next starts.
  Apple container and Lima VMs, whose root could take out anything the
  host set inside them, and the process driver aren't kept off them: on a
  cloud machine, use Docker or Firecracker. Image builds
  (`allowed_builds`) aren't kept off them either: build only repositories
  you trust. Agents that should use a cloud get credentials of their own
  through [identity tokens](https://fctl.sh/docs/identity-tokens.md).
- **GitHub.** Installation tokens for the project's repositories and no
  others, within the GitHub accounts and repositories its workspace may use,
  valid for an hour and refreshed on demand
  ([self-hosting](https://fctl.sh/docs/self-hosting.md#what-sessions-get) has the details):
  - one for the primary repository and the others listed as read and
    write, with what the session's agent may do on GitHub: write contents,
    pull requests, issues and workflows for one that pushes; write pull
    requests and issues, and read contents, for one that comments; none
    for one that only reads. git and `gh` use it.
  - one that can only read (contents, pull requests, issues and CI
    results) the repositories listed as read only, or every repository of
    the account the GitHub App can reach when the project grants that
    (`owner/*`); for an agent that only reads, the others too. git uses it
    for those repositories.

  An agent that pushes can push to, open pull requests in, and change the
  workflows of every repository it can write to, so list as writable only
  the ones it needs. Sessions that don't need to push, such as review
  agents and planners, can comment or only read (`fctl run --github`), and
  a project can hold its agents to that (`fctl projects set --github`):
  their tokens can't push, whatever they read asks of them. An agent that
  comments can still close, edit and approve pull requests and issues.
  GitHub lets only tokens that can push resolve review threads, so the
  control plane resolves them for such an agent with a token it keeps to
  itself, for that one repository, after checking that the session may
  write there. Reading a whole account includes its private repositories, as far
  as the workspace may use them. Running sessions lose a repository removed
  from the project, or an account taken from its workspace, when their
  tokens are next refreshed, within the hour. A session's tokens are minted
  for the runner the session runs on only: a runner serves the workspaces
  its owner added it to, and gets no token for a session in another
  workspace.

  The project's ticket tracker narrows the issues permission
  ([Architecture](https://fctl.sh/docs/architecture.md#ticket-trackers)): tokens carry it as
  above where the project tracks its work in the GitHub issues of every
  repository it writes to, which is the default, and nowhere where it
  tracks it in Linear or nowhere. Where it is one repository's issues,
  only a write token for that repository alone carries it, since a token
  has one set of permissions for all its repositories. Public
  repositories' issues stay readable to anyone, so there the agent's
  instructions keep it away from them. A session that a maintainer of
  the project, who may change its tracker, starts with `fctl run
  --github-issues` gets the issues permission as for the GitHub issues
  of every repository it writes to, whatever the tracker says, for as
  long as it runs, whoever messages or resumes it.
- **Ticket trackers.** `fctl ticket` reaches the project's tracker through
  fctl-agent and the control plane, which holds the tracker's access: a
  Linear token reaches every team of its Linear workspace as fctl's app,
  so it never enters a sandbox, and for one repository's GitHub issues
  the control plane mints a token for that repository's issues alone for
  each call and revokes it after. Each call is kept to the project's
  choice, its Linear teams (and projects) or a repository, and a ticket
  outside it answers as one that doesn't exist, as do the parents,
  sub-tickets and search results outside it. Review agents reach no
  tracker. In an hour, a session's agent comments at most 30 times, files
  at most 20 tickets, changes at most 60 and reads at most 300 times, and
  its writes fail at most 60 times, which also keeps one workspace's
  agents from using up the API of a Linear installation others share. What tickets and
  their comments say comes from whoever wrote them, inside the teams or
  not: agents are told to take it as what the work is about, not as
  instructions, and do what the person who delegated it asks.
- **Slack.** `fctl slack` reaches Slack through fctl-agent and the
  control plane, which holds fctl's bot token: the bot is in every
  conversation fctl's app was added to, every person's direct messages
  with it included, so the token never enters a sandbox. Before it reads
  anything, the control plane asks Slack what the conversation is
  (`conversations.info`), and lets a session read its own thread, in
  whatever conversation it started in, and the public channels its
  workspace's admins made readable, where its project reads them: never
  more of a private channel or of someone's direct messages than its own
  thread, never anyone else's direct messages with the app, and never a
  channel shared with another organization. It posts only in its own
  thread. What fctl posts there goes with link previews off, so that a
  link an agent writes (one that carries data in its address, say)
  doesn't unfurl, and with Slack's special mentions taken apart, so that
  nothing an agent writes notifies `@channel`, `@here`, `@everyone`, a
  group or a person. In an hour, a session's agent reads Slack at most
  120 times, searches it at most 30 times and posts at most 20 times.
  Review agents reach nothing in Slack. What Slack's messages say comes
  from whoever wrote them: agents are told to take it as information,
  not instructions, but for the messages fctl passed on as people's who
  may message the session, and to post no secrets in a channel's thread.

  Which accounts a workspace may use is its own admins' decision, and only
  within what they may touch on GitHub. A workspace's admin connects an
  account by signing in to GitHub with the instance's app, and the
  workspace gets what GitHub says that person may give: every repository of
  their own account, or of an organization whose every repository the app
  reaches and they administer all of; otherwise the repositories they
  administer. So no workspace reaches another account's repositories
  through the shared app, and an instance admin — who holds the app's key —
  connects nothing into a workspace, though they can take an account away.
  Installing the app on an account is necessary but not sufficient: it lets
  the instance mint tokens there, but no workspace uses it until one of its
  admins connects it with a GitHub sign-in
  ([ADR 0029](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0029-workspaces-connect-github-accounts-with-a-github-sign-in.md)).
  A connection is to the account, by GitHub's id, not its name: when a
  connected account is renamed or deleted and someone else takes its name,
  the workspace's sessions get no tokens there, and their pull requests no
  news from it, until its admins connect the account again. It is also to
  the installation of the app it was made through: uninstalling the app
  from an account ends every workspace's connection there, and installing
  it again brings none back, so that the account's admins can end what
  they let workspaces reach, a former admin's own workspace too. Each
  workspace's admins connect it again, with a GitHub sign-in that checks
  what they may connect then. Short of that, a connection keeps what its
  admin's sign-in gave it: fctl doesn't check their standing on GitHub
  again ([ADR 0029](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0029-workspaces-connect-github-accounts-with-a-github-sign-in.md)).
- **Claude.** A short-lived access token for the session's owner. Refresh
  tokens never enter a sandbox: when the access token expires, Claude asks
  the control plane for a new one through its host. A session gets the
  token only while the person it runs for is an active member of its
  workspace and may still run it: start sessions in its project, or message
  it through a share. Once they leave the workspace, are removed or
  disabled, lose their role in the project or the share, or the
  workspace's two-factor requirement closes it to them, the sessions
  that run on their subscription stop, get no more Claude or GitHub tokens,
  and a message to one doesn't start it on their subscription again (nor
  on their runners, with the project's secrets); resuming it, or taking
  it over, runs it on the subscription of whoever does. Unless its owner keeps it out of sandboxes (below), the token
  is in the sandbox, where the agent can read it, so
  whoever can message a session's agent (the project's editors, and people
  it is shared with to message) can have it hand over the token of the
  person the session runs as, as they can the session's GitHub tokens and
  the project's secrets: a full Claude login's token lasts hours, one from
  `claude setup-token` a year. Run sessions on a token from `claude
  setup-token` only where you would trust those people with it, or keep it
  out of sandboxes. Hosts
  replace every Claude token they know of, and anything shaped like a
  Claude access token (`sk-ant-oat…`), with `[Claude token, redacted by
  fctl]`, and anything shaped like a GitHub installation token (`ghs_…`)
  with `[GitHub token, redacted by fctl]`, in what agents send to the
  control plane, so a token an agent prints by mistake (`printenv`), or
  repeats in its reply, stays out of the transcript and of what viewers
  see live, also after the host restarted; one it is asked to send
  elsewhere, or to write in another form (spaced out, encoded), doesn't.
- **Keeping the Claude token out of sandboxes** (Settings → Claude, `fctl
  claude set --stand-in on`; experimental, off by default): Claude gets a
  stand-in that Anthropic refuses, and the host of the runner keeps the
  token and puts it in as Claude's requests leave for `api.anthropic.com`,
  on a channel that only that session's sandbox has
  ([Architecture](https://fctl.sh/docs/architecture.md#keeping-the-token-out-of-sandboxes)).
  Nothing in the sandbox has the token then, so an agent, root in its
  sandbox or not, can neither read it nor send it anywhere, whoever directs
  it. While the session runs, it can still use the token through the host
  for requests to the Anthropic API, as Claude does: its plan's usage, and
  whatever the token's scopes allow there. Claude trusts a certificate
  authority of the host's own for the API's name alone, whose key never
  leaves the host, and the host gives no sandbox the token once its owner
  keeps it out, whatever the sandbox says. Turning it off again takes
  confirming it's you, where the instance asks for that. Hosts of an fctl from before it ignore it and
  give the agent the token, until they update themselves, and so does the
  `process` driver, which isolates nothing.
- **claude.ai connectors.** A session on a full Claude login gets the
  connectors its owner has connected on claude.ai (mail, files, docs, chat),
  and the agent can use them with that person's access without asking, also
  when a repository or a web page tells it to. Long-lived tokens from
  `claude setup-token` don't reach connectors. The **claude.ai connectors**
  project setting turns them off for a project's sessions, and a
  repository's Claude settings can't turn them back on. New projects start with
  it off, in the app, from the CLI and through the API (turn it on in the
  form, with `fctl projects create --connectors`, or in Settings);
  projects from before the setting keep their connectors
  until a maintainer turns them off.
- **fctl.** No fctl credentials enter a sandbox. Through fctl-agent's
  session socket, anything the agent or the project's setup script runs
  can rename its own session and
  describe it (`fctl edit`); in projects that publish screenshots, publish
  images at public links (`fctl publish`); and in projects that keep a
  memory or ask for retrospectives, read the project's notes, add notes,
  mark them stale or duplicates of other notes, and record, list and
  update retrospectives of its session (`fctl memory`, `fctl retro`); in
  projects with a ticket tracker, read its tickets and, unless the agent
  only reads on GitHub, write them, where an agent that triages only
  labels them and comments on them (`fctl ticket`); and where the agent
  may comment on GitHub, resolve review threads of its repositories' pull
  requests (`fctl resolve`); and in projects that let their agents mint
  identity tokens (Identity OIDC, on by default), outside review agents'
  sessions, mint them for any audience (`fctl id-token`,
  [Identity tokens](https://fctl.sh/docs/identity-tokens.md#what-a-token-proves)); and nothing
  else. The control plane checks
  the values and the settings again. Turn publishing
  on only where anything the agents see may be shown to anyone with a
  link: text in a repository or on a web page can ask an agent to publish
  a screenshot, as it can ask it to send what it sees elsewhere.
- **Project memory** is text that the agent of every later session in the
  project starts with, and anything an agent runs can add to it, so text in
  a repository or on a web page that steers one agent can leave a note for
  the agents after it, past any review. `~/AGENTS.md` presents the notes
  as notes that don't override the person's request or fctl's rules; each
  note names the session that wrote it, the transcript shows it as it is
  kept, and the project's editors delete the ones they don't want, which
  the workspace's audit log records. Turn it off (`fctl projects set
  --project-memory off`) in projects whose agents read text from people
  you don't trust.
- **Schedules** start sessions that nobody watches start, on their
  owner's subscription: whoever may set one up may start sessions anyway,
  and a change by anyone else runs it on theirs. Runs that other tools ask
  for carry the tool's text (`context`), which anyone may have written,
  such as an issue's author: the agent gets it after the task, marked as
  information and not instructions, which makes it harder, not impossible,
  for that text to steer it. Give such a schedule the least GitHub access
  its task needs and a token that runs sessions in its project alone, and
  pause it to stop what tools start at once. For one that goes through
  issues, that is triage: its agent labels tickets and comments on them
  through fctl and can write nothing else, whatever an issue tells it,
  though it keeps the project's secrets, setup script and network, as
  other sessions do
  ([ADR 0075](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0075-agents-that-triage-write-labels-and-comments-through-fctl-alone.md)).
  A schedule that anyone on GitHub can start, on issues opened or on pull
  requests opened by anyone, runs at triage unless it sets more: doing
  more takes choosing `push` or `comment` for it, which the form warns
  about.
- **Review agents** run on their operator's Claude subscription, with
  their Claude access token in the sandbox like any session's (another
  owner who changes how they review takes them over, so nobody changes
  what runs on someone else's subscription), and read
  what pull requests say, which can steer them as any text can. Their
  GitHub token only reads, fctl posts what they find, and they get no
  secrets, setup script, memory, retrospectives, screenshots or
  connectors, which the control plane refuses them whatever their project
  allows and whatever their sandbox asks for. A pull request starts a
  review by itself only when its author may write to the repository, or
  one of fctl's agents or of the GitHub Apps the project's owners chose
  (Dependabot until they choose) opened it from a branch of the
  repository; anyone else's waits until someone in the project looks at
  it and asks for its review, since its text could otherwise have the
  agent hand the operator's token over
  ([ADR 0047](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0047-review-agents-review-outsiders-pull-requests-when-asked.md)).
  Where the owners turn summaries on, what the agent says of a pull
  request goes in that pull request's own description, which fctl writes
  between its marks, as plain sentences in a GitHub alert, without HTML,
  links, @-mentions or email addresses as a Markdown parser reads them,
  and the rest of the description stays as it is: a
  steered agent can mislabel a pull request's risk there, as it can in
  its findings, but not change what people wrote, link them elsewhere or
  notify anyone
  ([ADR 0067](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0067-review-agents-sum-pull-requests-up-in-their-descriptions.md)).
  An app's pull requests can carry text from outside all the same, such
  as the release notes Dependabot and Renovate quote, and installing the
  dependencies they update runs their code, so their agent installs and
  runs nothing of them: add only apps whose pull requests you'd have it
  read unasked
  ([ADR 0054](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0054-review-agents-review-dependabots-pull-requests-by-themselves.md),
  [ADR 0057](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0057-projects-choose-which-apps-pull-requests-start-reviews.md)).
- **Project secrets** are exported to the agent's environment. Treat them as
  readable by anything the agent runs.
- **The image and the setup script.** Whoever sets a project's image or
  setup script decides what runs in its sandboxes, beside the credentials
  of the people who start its sessions: their Claude access token and the
  session's GitHub tokens. A full Claude login's access token lasts hours;
  a token from `claude setup-token` is valid for a year. Maintainers and
  owners set both, and for an image built from the repository, so does
  whoever can push to its default branch. Hosts' owners decide which images
  their machines run and which repositories they build images from
  ([below](https://fctl.sh/docs/security.md#hosts)).
- **Package caches.** In a project that shares them (`fctl projects set
  --package-caches on`), its sessions on a runner share what their package
  managers download, in a Docker volume or, with Apple's `container`, a
  directory on the Mac that each sandbox mounts, or, with Firecracker, a
  directory on the runner that the host serves to each VM over 9P.
  Anything a session runs
  can change what they hold, and the project's later sessions on that
  runner build with it: package managers check a download against a
  lockfile's hashes as they fetch it, but most don't check again what is
  in their cache already, such as the sources Cargo unpacked. Projects
  never share caches, and review sessions, whose pull request could steer
  their agent, get none. Leave them off in projects whose agents run code
  from people you don't trust.
- **Attached files** are saved in the sandbox under `~/attachments/`, where
  anything the agent runs can read them, and Claude sees images in the
  message. An autopilot reads the files sent in the sessions of its
  project or workspace, as it reads their transcripts, and attaches them
  to the sessions it starts.

The `process` driver has no isolation at all and is for development only.

## Commits

Agents' commits are authored by the GitHub App's bot. They carry Claude's
`Co-authored-by` trailer unless the project turns off **Credit Claude in
commits**. They name the person who started the session only when that
person chose a commit email for the address they are in the workspace as
(Settings → Email addresses, or `fctl account set --commit-email`) and the
project credits people: a trailer then carries
their name and that address. Maintainers turn that off with **Credit people
in commits** in the project's settings (`fctl projects set --credit-people
off`); its sessions then don't receive the address at all. Everyone who can
read the repository sees the address in the commits, and
people who can see the session see it in the transcript; commits keep it
after it is removed or the account deleted. Settings and the API show the
address only to its owner, not to admins. fctl never puts sign-in emails in
commits.

## Billing

fctl is built so agents only ever use Claude **subscriptions**:

- `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL`, the
  Bedrock/Vertex/Foundry switches and any other `ANTHROPIC_*` variables are
  removed from the sandbox environment, and project secrets cannot set them.
- A repository whose `.claude/settings.json` sets `apiKeyHelper` or
  `ANTHROPIC_*` variables runs without project settings.
- The session refuses to start if Claude reports any API key as its
  credential source.
- When Claude reports that a turn draws on paid extra usage, the agent is
  interrupted and the session pauses until the plan's limit resets.

## Hosts

A runner's host is the `fctl host` service on it, which runs its sessions.
Hosts connect outbound to the control plane over TLS (rustls with the
Mozilla root store); they open no ports. A host authenticates with a runner token
that its owner can replace, and that its owner and instance admins revoke by
disabling or removing the runner: whoever holds a runner's token runs the
sessions of the workspaces it serves, so only its owner gets a new one, not
an instance admin outside those workspaces, and only while none of those
workspaces' two-factor requirement closes it to them: a password alone
gets no runner token. Registering a runner for a workspace and replacing a
runner's token take confirming it's you, where the instance asks for
that, as adding one to a workspace does. Hosts receive a
session's credentials only while it runs, and keep nothing secret on disk
but their runner token (`~/.config/fctl/host-token`, mode 0600), when
their owner keeps it there, their owner's Claude token
(`~/.config/fctl/claude-token`, mode 0600), and, once a session keeps its
Claude token out of its sandbox, the key of the certificate authority whose
certificate for `api.anthropic.com` that sandbox's Claude trusts
(`~/.config/fctl/claude-relay-ca.pem`, mode 0600).

**Claude tokens on runners.** Someone who would rather not give fctl their
Claude token keeps it on their runners (`fctl host claude set-token`) and
connects it there ("My runners keep it" under Settings → Claude's
long-lived token)
([ADR 0050](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0050-claude-tokens-can-stay-on-their-owners-runners.md)).
The control plane is never given the token and stores none for them, hosts
tell it only whether they keep one and when it was saved, and they take
the token out of what sessions send wherever it appears whole: a breach of
D1 and the master key, or an operator of the instance, doesn't get it,
short of an agent that was made to pass it on (below). The control plane sends that
connection's sessions only to those of its owner's runners that keep a
token, in every workspace, whatever **Only on my runners** says, and each
of those hosts puts in the token it keeps, so no one else's machine ever
has it. Without one of those runners online, the sessions wait. What it
doesn't change: the agent has the token in its environment, as above, so
the people who may direct it can still have it handed over, unless its
owner also keeps it out of sandboxes; and the
control plane decides what runs on a runner, so one taken over could start
a session there to the same end. The token is safe at rest and from other
people's machines, not from the sessions that run on it. Removing it from
a runner applies to the runs that start after, and doesn't revoke it: it
works until it expires, a year after `claude setup-token` made it.

**Enrollment tokens.** A workspace's admins make enrollment tokens with
which machines enroll themselves as its runners, without anyone signing in
on them
([ADR 0071](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0071-runners-enroll-themselves-with-a-workspaces-enrollment-token.md)).
Whoever has one enrolls machines that run everyone's sessions there, with
their code, secrets and tokens, so making one takes the same as adding a
runner for everyone's sessions: an admin of the workspace, open to them
under its two-factor requirement, who confirms it's them where the
instance asks for that. A token is limited by its expiry, the most runners
it keeps enrolled at once and its admins' revoking it, and enrolls only
while the admin who made it is still one, as an invitation counts only
while the admin who sent it is: an admin who is removed, demoted or
disabled can't enroll a machine of theirs with a token they kept. With
approval, it enrolls only machines an admin then lets in: a runner that waits gets
nothing of any session, nor a Claude sign-in, and approving it takes
confirming it's you too. The control plane keeps only the token's hash, a
token it doesn't know counts towards its caller's rate limit, and the token
does nothing but enroll: each machine gets a runner token of its own, so
removing, disabling or replacing one runner's token leaves the others
alone, and revoking the enrollment token leaves the runners it enrolled.
Such a runner belongs to the workspace, runs no other workspace's
sessions, and keeps no one's Claude token: the people who keep their
sessions, or their token, on their own runners never run sessions on it.
The admins see where each enrolled from, and the audit log records
enrollments, approvals and removals.

Any member makes an enrollment token for their own sessions
([ADR 0072](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0072-members-enroll-runners-for-their-own-sessions.md)):
the machines it enrolls are that member's runners and run only their
sessions there, as a runner they add for their own does, so whoever has it
reaches only what that member could read in their sessions, and the
Claude token they keep on their runners when their machines keep it. It
enrolls only while its maker is an active member of the workspace, the
same confirmation makes it, and with approval its maker, not the
workspace's admins, lets each runner in. The workspace's admins see these
tokens and revoke them, and take such runners out, which removes them;
they go when their owner leaves the workspace.

A runner takes only the sessions of the workspaces it is added to, and so
sees their code, secrets and the tokens of the people who start them: the
session's GitHub tokens and the Claude token of the person it runs as. Its
owner adds it to a workspace for everyone's sessions there only as one of
its admins; a member adds theirs for their own sessions alone, which show
the machine nothing they couldn't read in the session, and a demoted
admin's runners run only their own from then on. A workspace's admins take
any runner out of it. Each member chooses, per workspace, to run their
sessions only on runners they registered (**Only on my runners**, `fctl
workspaces own-runners on`), so that no one else's machine sees their
Claude token or their sessions' work. Once a runner no longer runs a
session (taken out of the workspace, its owner left it or was disabled,
or the session's person keeps theirs on their own runners), or the
person whose Claude connection the session runs on may no longer run it
(they left its workspace, were disabled, lost their role in its project
or its share, or its workspace's two-factor requirement closes it to
them) or removed that connection, the session stops, its runner's uplink
to it closes, and the runner gets no more tokens, messages or files for
it, whatever its host does, and makes no more of its agent's calls (the
project's memory, retrospectives and ticket tracker), uplinks or
screenshots for it: a stopped session stays with the runner it last ran
on, which would otherwise keep that person's reach in the project. A
Claude sign-in through a host, which passes the full login's long-lived
tokens through it, runs on one of the person's own runners when one is
online, else on a runner that runs their sessions. That runner's host
could keep those tokens, and it could also answer with a login of a
Claude account of its owner's choosing, which fctl can't tell from the
person's: it becomes the person's default, so that their sessions in
every workspace run on that account, and its claude.ai/code and Claude
apps show them, where they can be followed and steered (Remote Control).
So when a sign-in runs on a runner that isn't the person's own, the app
and `fctl claude connect --login` say which runner, and whose, before
they approve it (`ClaudeLoginJob.runner`), and the CLI asks whether to go
on. Where you don't trust that runner's owner with your Claude account,
start one of your runners first, or connect a long-lived token.

**Updates.** Hosts update fctl by themselves to the version the control
plane runs, unless `auto_update = false` in `host.toml` (`fctl host
auto-update off`)
([ADR 0053](https://github.com/hyperstructure/fctl/blob/main/docs/adr/0053-hosts-update-themselves-to-the-control-planes-version.md)).
The release comes from the host's own `download_base`, fctl.sh unless it
says otherwise: the control plane names only a version, which must be newer
than the host's, and never where to download it, so a control plane taken
over can't make its hosts install anything else, or an older fctl. The host
checks the archive against its SHA-256 and runs the new fctl before
anything changes, as `fctl self update` does. The checksum comes from the
same server, though: it catches broken downloads, not a release server
taken over. Leaving updates on trusts fctl.sh with what runs on the
machine, as installing from it does, without choosing when; with them off,
`fctl self update` updates the host when you choose, once you have looked
at the release. Turn updates off on machines where that matters.

Sessions run in their project's sandbox image or, without one, the host's:
by default `ghcr.io/hyperstructure/sandbox`, which the Image workflow of
the public [hyperstructure/sandbox](https://github.com/hyperstructure/sandbox)
repository builds, so anyone can read what goes into it. A host can use its
own build of it instead (`fctl host image build`) or a copy in another
registry (`image` in `host.toml`).

A project's own image runs only on hosts that allow it, and its build only
on hosts that build images from its repository: `allowed_images` and
`allowed_builds` in `host.toml`. Without `allowed_images`, a host runs any
image a project chooses, as hosts did before it, so set it on machines
where that matters. Without `allowed_builds`, it builds none. The control
plane schedules sessions by these lists, and the host checks them again
before it takes a session. To build, the host downloads the repository at
the tip of its default branch with the session's GitHub token, which the
build never sees, and runs the build in its container runtime's builder,
outside any sandbox, or with Firecracker in a VM of the project's own that
holds its builds' cache, apart from other projects' ([Sandbox images](https://fctl.sh/docs/sandbox-images.md#which-images-a-host-runs)),
from the repository's files alone: the host checks again that the
Dockerfile and the directory a project names are in the repository,
removes the repository's symbolic links that lead out of it, so that no
builder reads the host's files through one, and keeps each sandbox's
name to letters, digits and dashes, whatever the control plane sends. A
build starts `FROM` whatever image its Dockerfile names, or its
devcontainer.json does, whatever `allowed_images` says, so allowing a
repository's builds allows the images anyone who can push to its
default branch names. Hosts pull images with their own registry logins;
fctl stores no registry credentials.

## The control plane without Cloudflare

The standalone control plane ([Self-hosting](https://fctl.sh/docs/self-hosting.md#on-your-own-machine-or-cluster))
runs the same Worker, so the rest of this page holds for it too. What
Cloudflare does around the Worker, its server (`deploy/standalone`) does:

- **Addresses.** Sign-in rate limits and the audit log go by the address
  in `CF-Connecting-IP`. The server sets it from the connection, or behind
  `FCTL_TRUST_PROXY` proxies from what they added to `X-Forwarded-For`,
  and replaces any a client sends. It also drops headers that steer
  Miniflare (`MF-*`), which would take them from anyone, and answers
  `/cdn-cgi/`, where Miniflare has pages of its own, with a 404.
- **Secrets** are environment variables, or files (`<NAME>_FILE`).
  Without `FCTL_MASTER_KEY`, the server makes a master key and keeps it in
  its data directory, next to what it encrypts: a copy of the directory
  then has both. Set the key from a secret store to keep them apart.
- **TLS** is the reverse proxy's in front. Over plain http, anyone on the
  network in between reads sign-in cookies, CLI and runner tokens, and
  whatever the apps show; keep such an instance to a network you trust.
- **The data directory** holds D1 and every Durable Object as SQLite
  files: password hashes, encrypted credentials and secrets, transcripts
  and attached files. Encryption at rest is the disk's, and the server
  keeps the SQLite files' directory (`state`) to its own user (mode 0700),
  or says in its log that it couldn't, for one another user owns.
  One server at a time uses it (`server.lock`): two would each run the
  same sessions.
- **Webhooks** post only to an address that answered fctl's challenge
  as the webhook was added there or pointed there
  ([checking the address](https://fctl.sh/docs/automation.md#checking-the-address)), so that
  fctl doesn't post a workspace's events where nobody set up a receiver
  for them, or to someone else's server. They go out from the server's
  own network. fctl refuses
  addresses that name a private, loopback or link-local IP address or a
  local name, and the standalone server posts them through a network of
  their own, which connects only to public addresses and the IP ranges
  `FCTL_WEBHOOK_PRIVATE_HOSTS` lists, checking where a host name resolves
  as it connects: a public-looking name someone points at an address in
  the server's network reaches nothing there, and its answer, which a
  test shows, never comes from there. `FCTL_WEBHOOK_PRIVATE_HOSTS`
  lets webhooks reach the IP ranges and host names it lists, and
  `FCTL_WEBHOOK_HTTP` lets them post over plain `http://`
  ([Self-hosting](https://fctl.sh/docs/self-hosting.md#webhooks-to-your-own-network)): anyone
  who manages a webhook can then have the server post to any of those,
  and a host name it lists goes wherever it resolves, so list only
  receivers, never the server's own address, cloud metadata
  (`169.254.169.254`) or networks with admin interfaces. The server checks
  a webhook's address against them again before each post, so narrowing
  them stops webhooks that pointed past them. app.fctl.sh sets neither,
  and Cloudflare's Workers reach no private address. A webhook posts
  only while the person who chose its address (who added it, or last
  pointed it elsewhere or turned it on) still manages it: once they leave
  the workspace, lose the role or their account is disabled, fctl turns
  it off and says why, so that the workspace's events stop going where
  they chose.
- Errors the Worker throws come back as plain 500s, without the stack
  traces Miniflare shows in development.
- Request bodies are read as they come and refused once they pass their
  limit (1 MB of JSON, 5 MB for a webhook delivery, a file's size for
  uploads), whether or not the client says how large they are: the server
  passes bodies on chunked, and nothing in front of workerd caps them, as
  Cloudflare does.

## Retention

- Deleting a project deletes its sessions with their transcripts (the event
  logs in their Durable Objects) and the files attached to their messages
  right away; an hourly job retries any that fail. Uploaded files that no
  message sent are deleted after a day.
- The images agents read are deleted 7 days after they read them, and
  sooner when their session keeps more than 1,000 of them or 200 MB: its
  oldest first. Deleting the project deletes them with the transcripts.
- Expired browser sessions and tokens, password resets, sign-ins waiting
  for a second factor (ten minutes), device codes and invitations are
  deleted within the hour, and audit log entries after a year, as are
  passkey challenges (ten minutes). Turning two-factor off deletes the
  authenticator app's secret and the recovery codes; an admin's reset also
  deletes passkeys where they are the second factor required. A browser's notification subscription goes with the sign-in that
  made it (signing out, revoking or expiry), or when its push service says
  it is gone. A person's notifications wait in their Durable Object for at
  most a minute and are deleted once sent.
- Each session's pauses on Claude's usage limits, and Claude's refusals
  of the connection it ran on, are deleted after 30 days; when Claude last
  answered each connection, and when its token runs out, go with the
  connection.
- Deleting a workspace deletes its projects, as deleting each would, its
  audit log, its enrollment tokens and the runners that enrolled with them,
  its service accounts and people's answers to them;
  the instance's audit log records who deleted it.
- Webhooks' delivery logs (what was posted to each webhook: the event's
  payload, with session titles, the start of agents' replies and their
  questions, each attempt with who resent it or sent a test, and the start
  of the newest answer) are kept for 30 days, and at most each webhook's
  newest 1,000. A webhook itself keeps how its newest attempt went, with
  neither the answer nor who made it. Deleting a webhook deletes its log;
  deleting a project deletes what its events said in every log, and its
  own webhooks with theirs; deleting a workspace deletes them all. Webhooks' secrets are sealed with the
  master key, and reading one takes confirming it's you where the
  instance asks for that.
- A runner that enrolled keeps the address it enrolled from, and what its
  host said of the machine, until it is removed: by an admin or its owner,
  as its host uninstalls, once it stays offline longer than its enrollment
  token lets it, a week after it enrolled when nobody approves it, or, for
  a member's own, when they leave the workspace or delete their account. Revoked and
  expired enrollment tokens are deleted 90 days on, once no runner they
  enrolled is left.
- People delete their own account in Settings → Your data or with
  `fctl account delete`; admins delete members' accounts, and the primary
  instance owner admins' too. Both delete the account's addresses, sign-in methods, passkeys
  and two-factor sign-in, tokens, Claude connections, memberships, shares,
  follows and notification settings and browsers, and the workspaces only
  it is in, with their projects and sessions; the sessions that run on its
  Claude connections stop first. Sessions and projects it
  created that others still use stay, credited to "Deleted user": the
  account remains only as a disabled placeholder, without its name,
  emails, commit emails or picture. Commits already pushed keep the
  trailers in them. The primary instance owner hands the role over
  before they can delete their account.
- Settings → Your data (or `fctl account export`) downloads everything the
  instance keeps about you, as JSON, with the sessions you started in the
  workspaces open to you: not those of workspaces you left. The notes and
  schedules you wrote, and the sessions you follow, come from the projects
  and sessions you still see, since others keep them up to date. Files you
  attached are listed in the transcripts there; each downloads from its
  session. An export reads all of that, so each person can export once a
  week, counted from when one starts (`users.exported_at`); admins choose
  another wait, or none, under Admin → Settings → Data exports (`fctl
  admin set --export-interval`). One that fails on the control plane's
  side doesn't count.
- A Linear account people link stays until they unlink it (Settings, or
  `fctl account linear disconnect`) or delete their fctl account. fctl's
  tokens in a Linear workspace stay while an fctl workspace is connected
  to it; once none is, the control plane revokes them at Linear and
  deletes them (within the hour if Linear doesn't answer), and it forgets
  them as soon as Linear says the app was uninstalled or refuses to renew
  them, which ends every fctl workspace's connection to that Linear
  workspace: installing the app again, which takes one of its admins,
  connects only the fctl workspace it is installed from. A delegation waiting for someone to link their account keeps what
  Linear sent for an hour, and which Linear agent session reached which
  fctl session goes with the session.
- A Slack account people link, with how the sign-in that linked it was
  made (`slack_accounts.auth_method`, `auth_domain`), stays until they
  unlink it (Settings, or `fctl account slack unlink`), delete their fctl
  account, or something signs them out everywhere (a new password, a
  reset), or until the instance's sign-in rules no longer let that
  sign-in in. One a workspace matched by address stays while matching is
  allowed there, and while no sign-in rule covers them. fctl's bot token in a Slack workspace
  stays while an fctl workspace is connected to it; once none is, fctl
  uninstalls its app there and deletes it (the hourly job catches deleted
  workspaces), and it forgets the token as soon as Slack says the app was
  uninstalled or its token revoked, or refuses it. A request waiting for
  someone to link their account or choose a project keeps its text for an
  hour; which thread reached which session goes with the session, and
  threads that never started one are forgotten a month on. What agents did
  in Slack (`slack_calls`, without what) is deleted after an hour. What
  came from Slack into a session's transcript stays with it, unless its
  workspace drops what Slack's messages said once the session ends
  (Integrations → Slack → Transcripts), which leaves who wrote them where;
  Claude's own conversation in the session's snapshot keeps them until
  the snapshot goes.
- Hosts keep a stopped session's sandbox so it can resume, and remove it
  once it has been stopped for `keep_stopped_hours` (72 by default; 0 keeps
  them), or sooner when their disk has less free than `min_free_disk_gb`
  (20 GiB by default), which the sessions running there are told. Resuming
  after that starts a new sandbox on the session's branch, with everything
  that was pushed, and the session's snapshot where it has one, or else a
  new Claude conversation.
- A session's snapshot, saved as its sandbox stops, holds Claude's
  conversation (what the agent read and ran, and what it was told, images
  too) and each repository's work its agent hadn't pushed, its untracked
  files with it, but not what `.gitignore` leaves out. The agent encrypts
  it in the sandbox with a key of the session's own, which D1 keeps
  encrypted with the master key and the control plane gives only to the
  runner that runs the session: the control plane keeps it without
  opening it, but whoever has both the instance's storage and its master
  key can read it, as they can the other secrets. Its session's
  Durable Object keeps it for 30 days after it was saved, or the days its
  workspace chooses (1 to 365), and only the newest. Runners whose
  `host.toml` names a bucket of your own keep them there instead, where
  the control plane keeps only where each is, and your bucket's lifecycle
  rules delete them
  ([Session snapshots in a bucket of your own](https://fctl.sh/docs/self-hosting.md#session-snapshots-in-a-bucket-of-your-own)); the hourly job
  deletes it then, and within the hour once its workspace, or the
  instance, turns snapshots off; an upload that never finished goes a day
  after it started. Deleting its project deletes it with the
  transcript. Review agents' sessions save none. With less than 2 GiB
  free, Firecracker hosts pause their running sandboxes, which keep what
  their sessions wrote in memory until there is room.
- An identity token is kept nowhere by the control plane: it goes to the
  sandbox that asked, where it lasts 10 minutes. fctl-agent keeps the
  current one for each of its project's clouds in a file only the
  session's user reads. Signing keys are deleted two days after another
  takes over, once no token they signed can still be used.
- Hosts keep the package caches of projects that share them, with what
  their sessions downloaded, until no session of the project has started
  there for `keep_caches_days` (14 by default; 0 keeps them). They empty
  them sooner once they take more than `max_cache_gb` (10 GiB by default),
  and when the disk runs low.

## Reporting a vulnerability

Report it privately through GitHub: **Security → Report a vulnerability** on
[hyperstructure/fctl](https://github.com/hyperstructure/fctl/security), with
details and a way to reproduce. Please do not open a public issue. We will
acknowledge within three working days and keep you updated until it is fixed.
