# Threat model: bots that use a computer

Relay bots can ask to run commands, open a terminal, look at the screen and drive the mouse and
keyboard on a person's Mac or Windows PC. This is the riskiest thing Isolink does: it turns a
chat into a way to act on a computer. This document says who is trusted, what each tool can do,
what stops it, and what doesn't. Code: `packages/isolink_core/lib/src/engine/bot_tools.dart`,
`engine/bot_computer.dart`, `app/lib/services/bot_computer.dart`, `app/lib/services/bot_pty.dart`.
As of November 2026; not reviewed outside the project.

## How a bot works

A relay bot is an Isolink account whose keys live on a relay server. Chats with it are end-to-end
encrypted **to the relay**: the relay decrypts each message, answers with fixed text, a program
the relay's owners allowed, or an AI model (Anthropic, OpenAI or another provider the relay is set
up with), and sends tool calls back, encrypted, to the person's device. A message to a bot
carries the recent chat as the bot's memory.

So everything a person sends a bot, and everything a tool sends back (command output, terminal
screens, window outlines, pictures), is seen by:

- the relay server's operator, and
- the AI provider, when an AI model answers.

The device only takes tool calls from accounts that one of the person's own relays lists as its
bot (`isBotContact`). A person's contact can't send tool calls.

## Who could attack

| Attacker | How |
| --- | --- |
| **Prompt injection** | Text the model reads (a web page, a document in a window, a file's contents, a terminal's output, another chat member's message) tells it to do something else. This is the main risk, and it needs no compromise of anything. |
| **The relay operator** | Runs the bot, so can make it ask for anything, at any time. Can list any account as a bot. |
| **The AI provider** | Same as the operator, for the calls its model makes. |
| **Another device of the person's account** | Fully trusted: can answer asks, start no-ask time, and type into a running terminal on the computer (see below). A stolen phone that is still linked is therefore a way into the computer. |
| **Someone at the computer** | Out of scope: they already have it. |

## The tools and their gates

Every tool needs the person to turn it on for that bot, and computer tools are set **on each
computer only**, never synced from another device, and start at Never.

| Tool | What it can do | Gates |
| --- | --- | --- |
| `run_command` | Run one of the commands the person wrote down, by name, with arguments the bot gives | Default Never. Arguments reach the program as separate words or as `ISOLINK_ARG_<NAME>`, never read by a shell, unless the person marked the command as a shell line, where they arrive only as environment variables. Output to the bot capped at 4 KB. |
| `run_terminal` | Run **any command line** in the person's own login shell (`$SHELL -l -c`, PowerShell on Windows), in a real terminal, in their home folder or one they choose | Settings › Bots › Terminal off by default; the bot's grant Never by default. Each line asks, unless the person chose Run without asking for 5 min, 15 min, 1 h, 4 h, or **no limit** (until End, the terminal setting going off, or a restart). Time limit per command 10 s, 1 min or 5 min. Lines up to 2000 characters. Output to the bot capped at 16 KB. |
| `terminal_keys` | Type into the command it started, including Ctrl keys | Comes with `run_terminal`. |
| `see_screen` | A picture of the front window or the whole screen, up to 1600 px | Screen setting off by default; grant Never by default; asks unless Always. |
| `use_computer` | Read the front window as text through Accessibility / UI Automation; click, type, press keys, scroll, open and switch apps | Control off by default; grant is Ask or Never (Always is refused). Each use starts from a task the person reads and allows for 5 min, 15 min, 1 h or no limit. 90 steps a minute. A bar shows on every display with Stop and +5 min. The person's own mouse or keyboard pauses it at once. No time limit still ends after 10 minutes without a step. Isolink's own windows are excluded. |

## What the gates do not stop

These are the gaps a reviewer, and anyone turning these on, should know.

1. **`run_terminal` is arbitrary code execution as the person.** One allowed line can do
   anything their account can: read SSH keys, browser cookies and password stores, install
   software, send files anywhere. The ask shows the line, but a line can be long or obfuscated,
   and with "Run without asking" there is no ask at all. A prompt-injected model with no-ask time
   needs only one turn.
2. **"No limit" exists for both terminal and computer use.** `botTerminalApprovalMax` is 4 hours,
   but `botNoLimit` (3650 days) is accepted beside it, and only a restart, End or turning the
   setting off ends it.
3. **`use_computer` is as strong as the terminal.** `key` presses any shortcut and `open` starts
   any app, so a bot with Control can open a terminal app and type into it, with the terminal
   setting off. Its gates (an allowed task, a time, the bar, pausing on the person's own input)
   are the only ones.
4. **Password fields.** Typing into a field the Accessibility API flags as a password is refused
   only when the bot names the field by its tag. `type` with no tag types into whatever has
   focus, password or not. Password values are left out of outlines, but `see_screen` and
   pictures show whatever is on screen.
5. **Other devices of the account can approve.** A linked phone can answer a terminal ask for the
   computer, start no-ask time on it (including no limit), stop it, resize it, and type up to
   64 KB into the running command (`tool-answer`). The computer accepts these from any device of
   the account. So the account's weakest device is the computer's.
6. **The operator and the provider see the output.** Whatever a command prints, and every window
   a bot reads, goes to the relay and the AI provider. A bot asked to "check my disk" may send a
   home directory listing.
7. **The relay decides who is a bot.** A relay the person joined can list any account as its bot,
   which makes that account able to send tool calls. Grants still apply, and computer tools start
   at Never.
8. **Grants are per bot, not per task.** Always on a tool lasts until changed.

## What would make it safer

In order of how much risk each removes for the work:

1. Drop "no limit" for `run_terminal` no-ask time; cap it at the 4 hours the constant says.
2. Ask on the computer itself, not only on another device, before any no-ask time starts there,
   and before keys from another device are typed into a running command.
3. Refuse `type` with no tag when the focused element is a password field.
4. Show a running count of what has gone to the bot (bytes of output, windows read) on the bar.
5. Run `run_terminal` commands in a sandbox where the platform has one (macOS `sandbox-exec`
   profiles, a Windows AppContainer), with the home folder read-only unless the person opens it.
6. Let a relay's bots be marked as able to use computer tools only by the person, not by the relay.

None of these is built yet. Until they are, the safe advice is: turn on Terminal and Control only
on a computer that holds nothing you couldn't lose, and only for bots on a relay you run.
