# Agent server threat model

This page covers the Node agent server. The desktop app confirms sensitive actions on the user's computer. The server cannot see that click.

Each row names the abuse, the control, and the test that proves the control.

## Prompt injection

A file, a web page, a connector result, or an older chat message can tell the model to ignore its instructions or to send data somewhere else.

The assistant instructions tell the model to treat file contents and page text as untrusted data. Recalled older messages are labeled as past conversation, not as new instructions. The model can call only tools on that agent's allowlist.

The control is an instruction, not a filter that removes hidden text. A hostile page can still ask the model to call an allowed tool. Destructive shell commands are rejected before they are sent to the desktop. Writes, clipboard changes, screen capture, and opening an app ask the user in the desktop app.

## Tools

The model may call `run_command`, clipboard tools, screen capture, or a connector the user did not intend.

`run_command` rejects `sudo`, wiping the disk, `curl` or `wget` piped into a shell, and `git push`. The working directory must stay relative to the allowed folder. A tool result is applied only when the call id belongs to that same user and that same run. Another user posting the real call id while it is still waiting gets `404`, and the call stays open. A result for an unknown call is `404`.

`node --test agentic/tests/access-control.test.js` covers the block list and the owner check.

The server does not store the desktop Allow click. A modified desktop could still return a success for a call the server did request. That is a gap. Closing it needs a signed approval from the desktop.

## Files

A path can try to leave the folder the user allowed, and a secret in a file can be copied into a log.

File tools reject an absolute path, a drive letter, and any `..` segment before the desktop is asked to run them. `browser_upload_multiple_files` and `browser_save_page` use the same rule. Logs and stored tool results strip tokens and image bytes. Ordinary file text is kept in the tool result so the model can answer.

## Browser

A page can contain instructions, and an upload can point outside the allowed folder.

`browser_open` allows only `http` and `https`, and it rejects a URL that contains a username or password. Uploads use a relative path inside the allowed folder. Screenshot bytes are not written into the tool log. The image is sent to the model as image input for that turn.

## Connected apps

A connector result can contain a token or another user's private text.

Connector calls use the signed-in user's own Merge link. Chat memory search requires both that user id and that agent id. Failure logs, stored tool errors, and progress text replace bearer tokens, `sk-` keys, Slack and GitHub tokens, and `api_key=` values with `[redacted]`. Image and base64 fields are stored as an omitted-length marker.

## What a failure must not contain

Process logs, `agentic_tool_events`, run error text, and assistant error text must not contain the raw token or the image bytes. `node --test agentic/tests/failure-log.test.js` checks a failure line and a stored tool row.

## Left open

- The server cannot prove the person clicked Allow.
- Deleting another user's agent id does not delete it. The call returns the caller's own list. The test checks the owner's agent is still there.
- Recalled chat text is still shown to the model, marked as past conversation.
- Signed-in routes allow 300 requests a minute per user and 900 per IP. New messages allow 15 per user and 40 per IP. Public routes allow 120 per IP. A Redis miss does not block the request. `GET /api/agent/metrics` counts requests and reply time. A reply trace in the process log has the run, user, agent, status, and duration only.
