The security model
Each trust boundary, what it checks, and what it does not promise.
You open a Developer chat, attach a log, and ask the assistant to fix what failed. The browser can reach every saved chat once you sign in. The model can see the log you sent. The tool it asks for can reach only what its grant and execution environment permit. Each crossing has a different check.
In this chapter
- Trace what a browser session, a model call, and a granted tool can reach.
- Compare the host reader and the places where Developer can run commands.
- Identify where untrusted content enters a run and where the operator can limit its effects.
A session opens the whole workspace
- One operator’s installation
Select a box to see the check at its edge and what the operator still has to trust.
- Browser
Checks. Sign-in issues a session cookie. The host checks the request host and the Origin on writes. Exposure. Every session has the full workspace and can change its execution settings. Apps at other paths on the same origin share that browser boundary.
- UI extension
Checks. Installation pins a full Git commit, and the registry checks the extension’s shape. Exposure. The bundled code runs with the signed-in page’s privileges.
- Artifact preview
Checks. A sandboxed frame separates the preview from the workspace. A policy blocks ordinary fetches and external resources. Exposure. Its scripts can still use browser resources. The policy has no WebRTC restriction.
- UI extension
- Pipal host
Checks. Node listens on loopback. A reverse proxy supplies public HTTPS. Exposure. The service account’s operating-system permissions bound the host process.
- Host modules
Checks. TOML names the module to import, and model calls need a profile grant. Exposure. Module JavaScript runs with the process’s privileges at import time and during calls.
- Read roots
Checks. Project and workspace readers limit the paths they can resolve. Exposure. Keep credentials outside shared roots and control who can change their directory trees.
- This machine
Checks. The owner enables the location and Pipal checks the project binding and approval. Exposure. Bash runs as the Pipal service user, with access to that user’s files and network.
- Private state
Checks. Private file modes and a store lock. Exposure. The service account and the commands it runs can read the plaintext store.
- Uploads
Checks. The host checks filename, size, type, and image dimensions before saving. Exposure. An upload ID is shared across signed-in sessions.
- Uploads
- Host modules
- Model provider
Checks. The host uses a configured key or a saved OpenAI sign-in. Exposure. The provider sees the context of the call, including tool output in scope.
- Exa
Checks. The host sends a bounded query to a fixed search endpoint and filters the result URLs. Exposure. Exa receives the search terms. The returned excerpts are untrusted.
- Jina Reader
Checks. The host validates the HTTPS URL before passing it to the reader. Exposure. Jina Reader receives the URL, including its query string. The returned page text is untrusted.
- Docker
Checks. A fresh offline container handles ordinary Bash and file calls. The volume is its writable project storage. Exposure. The service account can control the engine. On a rootful engine that access is root-equivalent on the engine’s host.
- SSH machine
Checks. SSH verifies the host key and Pipal checks the account and project binding. Exposure. Bash has that account’s files and network access.
- Browser
- Browser → Pipal host · HTTP requests and the session cookie
- Browser → Artifact preview · Creates a frame when opened
- Pipal host → Model provider · Sends model context
- Pipal host → Exa · Sends public search terms
- Pipal host → Jina Reader · Sends a public page URL
- Pipal host → Docker · Starts project containers
- Pipal host → SSH machine · Runs tools over SSH
- Pipal host → This machine · Starts Bash as the service user
Browser
Checks. Sign-in issues a session cookie. The host checks the request host and the Origin on writes. Exposure. Every session has the full workspace and can change its execution settings. Apps at other paths on the same origin share that browser boundary.
Talks to
A trust boundaryA crossing where data or requests move between parts of a system with different permissions. is a crossing between parts with different permissions. At the browser boundary, Pipal assumes one trusted owner. A browser sessionA sign-in record in server memory that the browser refers to with a cookie. gives its holder the entire workspace. Signing in from a second device gives it the same view of conversations and uploads. There are no per-user ownership checks on those routes. app.ts
Any signed-in session can also change Settings → Workspace. Enabling the This machine locationThe place a chat uses for project tools, either the Pipal host, an account reached over SSH, or a Docker project. lets approved Bash calls reach the service user’s files, including the chat database and saved model login. app.ts DeveloperWorkspace.svelte
Pipal listens on loopback and checks the host before routing a request. Writes need the configured Origin, the address the browser is running under. Most API routes also need a live cookie. Public sign-in routes still check Origin on writes. Deploying Pipal shows where HTTPS ends and this check begins. config.ts app.ts
Token mode compares token digests in constant time and puts no throttle on sign-in attempts. Passkey mode requires user verification and the expected origin and hostname, and uses short-lived challenges. Its limits on pending enrollment and key-change flows and on concurrent verifications apply across the host. A live enrollment code from disk can enroll a passkey. The public access route reports whether any passkeys are enrolled and whether a recovery code is still active. The Hono server follows those sign-in flows. auth.ts passkeys.ts
Deep diveWhat the request gate and passkey verification actually check
The session ID is random and held in memory for 12 hours, with a cap of 32 sessions. Signing out revokes it. The cookie is host-only, HttpOnly and SameSite=Strict, scoped to the API under the build’s base path, and Secure for a configured HTTPS origin. There is no device binding. GET and HEAD skip the Origin check, so private reads depend on the session and browser cross-origin rules. Pipal’s built-in API routes add no CORS permission. Static client files and the health check are public. auth.ts app.ts
The middleware adds nosniff, no-referrer, frame restrictions, and no-store on the API. It caps API bodies. Built-in JSON endpoints validate their input shapes. WebAuthn credential objects accept additional fields, then verification builds a response from the fields it needs. Passkey sign-in uses an HttpOnly signed challenge cookie and records used challenges. Enrollment and key changes keep their pending flows in memory. Verification checks the user handle and signature counter. Registration requests no authenticator attestation, the proof of an authenticator’s provenance. app.ts passkeys.ts
The page’s Content Security Policy tells the browser which sources may supply script, network connections, and frames. The workspace limits each of those to its own origin. Assistant Markdown goes through a DOMPurify allowlist before rendering. These are checks on how browser content runs. A signed-in request still carries the authority of the operator. index.html Markdown.svelte
The model receives context and can request granted actions
When you send the log to a remote model, the provider can see it in the model contextThe instructions, messages, and tool information assembled for a model request.. That can include instructions, conversation history, attachments, and previous tool results. On supported requests, the optional hosted search grant lets Pipal offer the provider’s search tool. The provider credentials protect access to the account. They do not keep the submitted context from the provider. Profiles and models explains the two OpenAI credential paths. README.md hosted-search.ts
A file, service log, fetched page, or tool result can include instructions aimed at the assistant. That is prompt injectionInstructions embedded in material the assistant reads that try to redirect it from the operator’s task.. A model may act on those words even if you only asked it to read them. Core checks the active profile’s grant when an installed extension tool runs. If the tool is available and a workspace action needs approval, the call waits for your decision. Approvals and YOLO explains what the approval is tied to. index.ts
Developer’s optional public-web tools bring Exa search excerpts and pages from Jina Reader into the conversation. Developer’s profile tells the model to treat that material as untrusted when composing a reply. public-web.ts developer.md
Deep diveWhy validation and grants do different jobs
API keys come from the environment. For ChatGPT sign-in, Pipal delegates OAuth and the loopback listener to Pi. Pipal rejects an explicit callback host other than 127.0.0.1. Pipal checks that the authorization URL targets the expected OpenAI endpoint and redirect URI, checks the shape and state of a pasted callback, and maps sign-in failures to fixed messages. The pending prompt and callback belong to the browser session that started the attempt. Model discovery refuses redirects and sets a 20-second deadline. Those checks establish the connection. They do not classify the text later sent to the model. models.ts chatgpt-callback.ts provider-login.ts
Core starts the harness with an empty default extension selection. Each installed extension’s tools check the active profile grant when they run. A specialist receives the task text the parent supplies and uses its own profile grants. Workspace tool calls need a current binding to the chat’s location and project scope. The read tool can run without a separate approval, while writes, Bash, and clone calls need approval for that scope. index.ts delegate.ts
A YOLO grant permits automatic approval within that scope and removes the opportunity to spot an injected request on the card. On This machine, that means eligible Bash calls run with the service user’s access without per-call review. In Docker, Bash stays offline while command output can still reach a remote model in context. index.ts development-workspace.ts project-shell.ts
Both web extensions need an entry in extensions.enabled and a profile grant. Hosted search runs at the model provider. With pipal.public-web, the host sends the search terms to Exa or passes a URL to Jina Reader. read_url checks the URL’s form, drops the fragment and keeps the query string. A private value in that query string would still reach the reader. Keeping private material out of tool arguments depends on Developer following its instructions. developer.md public-web.ts
The location decides where a command can act
| Feature | Host reader pipal.project-read | Docker | SSH machine | This machine |
|---|---|---|---|---|
| Where does the tool run? | Pipal host. | Fresh containers for shell and file operations. | Persistent Linux account over SSH. | Pipal host, as the service user. |
| What can a granted tool change? | No file writes or Bash. | Project volume through Bash or file tools, subject to approval. | Approved file edits stay in the project. Approved Bash can change anything the development account can write. | Approved file edits stay in the project. Approved Bash can change files writable by the service user. |
| What can a command reach? | No command tool. | Bash has no network. Optional approved Git clone fetches with its project mount limited to a fresh staging directory. | The account’s network and anything its OS permissions let it reach. | The service user’s network and readable files, including the chat database and saved model login. |
| What can it publish from disk? | No file publishing tool. | A checked file from the volume, with pipal.coding and approval or matching YOLO. | A checked file from the selected project, with the same grant and approval rules. | A checked file from the selected project, with the same grant and approval rules. |
| What must you trust? | The operator-controlled root and its parent directories. | The image and engine, the engine’s storage, and the service account’s access to it. | The machine, account, SSH configuration, and anything that account can access. | The approved command and code it runs with the service user’s access. |
Choose up to two columns
Choose up to two columns
| Feature | Host reader pipal.project-read | Docker | SSH machine | This machine |
|---|---|---|---|---|
| Where does the tool run? | Pipal host. | Fresh containers for shell and file operations. | Persistent Linux account over SSH. | Pipal host, as the service user. |
| What can a granted tool change? | No file writes or Bash. | Project volume through Bash or file tools, subject to approval. | Approved file edits stay in the project. Approved Bash can change anything the development account can write. | Approved file edits stay in the project. Approved Bash can change files writable by the service user. |
| What can a command reach? | No command tool. | Bash has no network. Optional approved Git clone fetches with its project mount limited to a fresh staging directory. | The account’s network and anything its OS permissions let it reach. | The service user’s network and readable files, including the chat database and saved model login. |
| What can it publish from disk? | No file publishing tool. | A checked file from the volume, with pipal.coding and approval or matching YOLO. | A checked file from the selected project, with the same grant and approval rules. | A checked file from the selected project, with the same grant and approval rules. |
| What must you trust? | The operator-controlled root and its parent directories. | The image and engine, the engine’s storage, and the service account’s access to it. | The machine, account, SSH configuration, and anything that account can access. | The approved command and code it runs with the service user’s access. |
Host project files. The read-only project tools limit access to coding_root and exclude Pipal storage. The reader checks path components for symlinks and hidden names other than .gitignore. It rejects files with multiple hard links, meaning several names for the same file. Search filters the results before returning them to the model. These checks assume the directory layout is controlled by the operator. Anything readable within the allowed area can reach the model. coding-environment.ts project-search.ts
Workspace files. The separate pipal.workspace extension is a read-only text reader. Its resolved root must be a visible directory disjoint from the data directory. You can share a folder within your home directory. The home directory itself and any directory containing it are refused. A read follows a contained, visible path to a single-link regular UTF-8 file of at most 16 KiB, without NUL bytes. Its containment checks assume trusted parent directories, so keep untrusted local writers away from the tree and keep secrets outside the shared root. Three ways to touch a project explains how the host grants read access. workspace.ts
Docker project. A fresh container gets a read-only root filesystem, a project volume, all Linux capabilities dropped, and requested limits on memory, processes, and CPU. Ordinary Bash and file calls run offline. Approved Git clone fetches over the network with only a fresh staging directory from the project volume mounted. Bash can change writable files throughout the mounted volume. The Docker project follows the container and the clone path. project-shell.ts
Development workspace. The selected project gives Bash its starting directory. On This machine, Bash uses Pipal’s own account, including its access to the chat database and saved model login. On SSH machine, Bash uses the configured development account, with access to that account’s other projects and network. The development workspace covers both setups. development-workspace.ts development-runner.mjs
Deep diveSSH verifies the destination and the runner verifies the binding
Pipal runs SSH without a terminal and in batch mode. It requires strict host-key checking, clears forwarding rules, and disables agent and X11 forwarding. The runner rejects a root real or effective user ID, or a username different from the expected one. For SSH, inspect() rejects the remote account if its machine ID and Unix user ID both match Pipal’s. That check depends on the local machine ID and Unix user ID being available. The operator still has to arrange distinct permissions and keep the Pipal credentials and rootful engine out of the development account’s reach. development-workspace.ts development-runner.mjs deployment.md
const { identity, machine, uid } = JSON.parse(result.stdout);if (typeof identity !== 'string' || !identity || (!local && machine === localMachine.trim() && uid === process.getuid?.())) { throw new Error('Configure a development account separate from the Pipal service account.');}The binding incorporates the transport, destination, user, project name, and directory identity. The runner checks the canonical path and directory identity again when it operates. The file helper rejects .git, links, and paths outside the project. The Bash runner checks the initial working directory and then launches Bash with the selected account’s ordinary privileges. Directory checks and scoped approval do not add a filesystem or network sandbox to that account. development-workspace.ts development-runner.mjs project-files.mjs
An installed extension runs with the application’s privileges
The host imports only enabled modules with a configured path. It checks the export’s name and shape after import. A factory can receive a private directory, and the model needs a profile grant to call its tools. The imported JavaScript already has the service account’s files, environment, and network, including during startup. The directory is a place to keep module state. It does not restrict what the module can open. Tools and extensions shows how a module gets loaded. extensions.ts index.ts
An enabled module can also export an HTTP handler. Pipal requires a session and checks Origin on writes to the extension route, then strips Cookie and Authorization before forwarding the request. Any signed-in session can call that route regardless of a chat’s profile. app.ts
A UI extension has the browser half of that authority. Installation copies regular files from a specified full Git commit, the build bundles the extension, and the registry checks its shape after import. A slot can show a fallback when rendering fails. The extension still executes in the signed-in workspace page and can call its API. Extending the UI covers the installation path. ui-extension.mjs load-ui-extensions.ts ExtensionSlot.svelte
Downloads, previews, and uploads have different checks
Both kinds of artifact are saved by version. Signed-in requests can retrieve them through the publishing conversation or another chat with the same delegation root. Any signed-in session can open that conversation. Files in, artifacts out follows the delivery path. web-artifacts.ts app.ts
Only web artifacts have previews. The route checks for same-origin iframe headers. The sandbox gives the frame an opaque origin, keeping its scripts away from workspace storage and cookies. The policy blocks ordinary fetches, external resources, and form submissions. Inline script can still run and consume browser resources. WebArtifact.svelte app.ts
The preview policy leaves WebRTC available where the browser permits it. A preview can use it to expose network information or send data it already has. Downloads are attachments. The server sends HTML source as plain text and project files as raw bytes, even when the filename ends in .html. The application you open a download with determines how it is handled. app.ts
Uploads have type, size, and filename checks. Pipal serves originals with a restrictive sandbox policy. Its PDF parser runs in a separate process with bounded resources, and image preparation decodes and may re-encode the input. These checks address delivery and processing. An upload has no per-session owner, and anyone signed in can request it by ID. uploads.ts app.ts
Deep diveWhat file validation and process limits cover
For a publication, publish_file checks the relative path and filename before the worker opens the file. The worker rejects paths outside the project, .git components, symlinks, and multiply linked files. These checks constrain what the tool can open. Publication copies the checked file’s bytes unchanged into the conversation store. project-coding.ts project-files.mjs web-artifacts.ts
Upload type checks match the declared type against the file signature. Images are capped at 32 megapixels. A binary attachment is limited to 10 MiB, with four IDs and 20 MiB total per message. Filename validation rejects path separators and control characters. The server stores originals under UUID directories, and its preview response sends sandbox; default-src 'none'. Those checks do not scan for malicious content. The browser checks UTF-8 when importing a text file. The server receives decoded text and a name in JSON and checks the combined message length. uploads.ts app.ts attachments.ts index.ts
The PDF worker starts with an empty environment, a 256 MiB V8 old-space limit and a 20-second deadline. A worker thread samples resident memory and kills the process if a sample exceeds 1 GiB. Node is launched with a JavaScript filesystem read allowlist for the uploaded file and required code paths. Native canvas runs with the service account’s privileges. The original upload stays in the store, and prepared parts can enter model context. pdf.ts pdf-worker.ts uploads.ts
Private permissions protect plaintext on disk
The data directoryThe private folder on the host where Pipal keeps conversations, uploads, sign-in records, and other state. holds conversations, uploads, tool output, and saved provider credentials in plaintext. Startup sets a private creation mask, rejects data inside the web build, and on Unix rejects data directories with group or other permissions. The access token, passkey store, and ChatGPT credential file have their own checks. Pipal takes an exclusive SQLite lock in owner.sqlite to keep a second Pipal runtime out of the same store. Private file modes still let commands on This machine read the service user’s files. main.ts store-lock.ts development-workspace.ts
When that disk fails or the host stops mid-run, what do you need to recover the workspace? When things go wrong follows the saved state through failure and restore.
Recap
- A browser session opens the full workspace and can change execution settings. Other apps on that origin share the browser boundary.
- The provider sees the context it receives. Profile grants, scoped approvals, and the environment where a tool runs limit what a model request can cause.
- Host and UI extensions run with application privileges. Commands on This machine share the service user’s access to the data directory.
- You host an unrelated app at /notes/ and Pipal at /ai/ on the same origin. Can script in Notes make a signed-in request to Pipal?
- Yes, the browser shares the origin and sends the cookie to matching Pipal paths
- No, the cookie path confines the calling page
- Only if the app knows the access token
Answer and explanation
Yes, the browser shares the origin and sends the cookie to matching Pipal paths
The cookie path applies to the request destination. Both pages have the same origin.
- An approved Bash call starts in a project on This machine. What bounds the files it can read?
- The approval card’s displayed path
- The Pipal service user’s permissions
- A fresh Docker container
Answer and explanation
The Pipal service user’s permissions
The project gives Bash its starting directory. Bash runs as the service user and can read that user’s files, including the chat database.
- An artifact runs in its sandboxed preview. Which capability can still reach beyond the browser?
- Reading the workspace cookie
- Loading an external script
- Using WebRTC if the browser permits it
Answer and explanation
Using WebRTC if the browser permits it
The opaque origin separates workspace storage, and the preview policy blocks ordinary fetches. That policy has no WebRTC restriction.
You host an unrelated app at /notes/ and Pipal at /ai/ on the same origin. Can script in Notes make a signed-in request to Pipal?
An approved Bash call starts in a project on This machine. What bounds the files it can read?
An artifact runs in its sandboxed preview. Which capability can still reach beyond the browser?