> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leverine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Security

> BunnyBridge's security model on one page: one privately bound listener, two strictly separated tunnels, the full token lifecycle, and what Tunnel 2 can and cannot reach.

The security model, in one page. BunnyBridge gives an AI the ability to run real commands on your phone. The design does not hide that — it makes the scope visible and controllable instead.

## The model at a glance

* **One listener, privately bound.** The app runs a single HTTP service bound to the phone's Tailscale address only. It never binds the LAN or a public interface, in any state. Tailscale down means nothing is listening.
* **Two tunnels, strictly separated.** Tunnel 1 (tailnet) and Tunnel 2 (chatbot) share that one listener but nothing else: separate tokens, separate surfaces, and each tunnel's tokens are rejected on the other tunnel.
* **No accounts, no cloud.** There is no BunnyBridge account and no Leverine server in the command path. The app collects no analytics and no telemetry; the only outbound call it makes on its own is the update check to Leverine's update channel, which carries nothing about you.
* **Everything is on the record.** Every run lands in Activity with the token's name, the tunnel, the time, and the result. Tunnel 2 runs are flagged as public-tunnel origin.

## Tokens — the whole lifecycle

### Creation and storage

* Tokens are **named** (3–64 characters: lowercase letters, numbers, dashes, underscores) and **scoped to one tunnel** at creation.
* The value is **shown exactly once**, in the reveal sheet / connect block at creation. It is never displayed again, and there is no "show my token" screen — by design, not by omission.
* At rest, token records are encrypted with **AES-256-GCM**, with keys held in the **Android Keystore**. Values never appear in the app's event log (they are registered as secrets and scrubbed before anything is written) or in any plain file.
* Authentication compares tokens in **constant time**, so a caller can't probe the value byte by byte.

### Using tokens well

* **One token per caller.** An agent, a script, a laptop — each gets its own name. That is what makes Activity readable and revocation surgical.
* Send Tunnel 1 tokens only as the `X-Token` header; on Tunnel 2, as `X-Token` or the Bearer token in your connector's auth settings. Never put a token in a URL, a repository, or a log.
* Tokens **do not expire**. Control is by revocation, not by lifetime — there is deliberately no "Expires" field in the app.

### Edit, rotate, revoke

* **Edit** renames a token or moves it between tunnels. The value never changes and is never re-shown. A tunnel move takes effect immediately — from the moment it saves, the value fails on the old tunnel and works on the new one. Moving a token *to* Tunnel 2 asks for a plain-words confirmation first, because the move widens where that token works.
* **Rotate** issues a new value for the same token. The old value keeps working for a **10-minute grace window**, so a connected agent is never stranded mid-task; after the window, only the new value authenticates.
* **Revoke** kills authentication *immediately* — current and in-grace values alike. For 5 seconds the Tokens screen offers **Undo**, which restores the token exactly (same value, tunnel, and grace state — the grace clock is not extended). After the window, the deletion is final.
* There is **no token management over HTTP** on either tunnel. Creating, reading, rotating, and revoking tokens happens only in the app, by the phone's owner.

## What Tunnel 2 can and cannot reach

Tunnel 2 is the tunnel that faces the public internet (through the relay or your front door), so its surface is deliberately smaller:

| A Tunnel 2 token can | A Tunnel 2 token cannot |
| - | - |
| Run commands on the phone (`/door2/run`, MCP `run_command`) | Reach any Tunnel 1 endpoint — `/run`, `/status`, `/log` all refuse it |
| Read the full diagnosis (`/door2/health`) | Read the event log — there is no `/door2/log` |
| Read its reduced status: version, uptime, its own name | See the token list, the tailnet address, or host names |
| Fetch the OpenAPI schema | Create, rotate, or revoke tokens — or itself |

And the surface itself is gated: while Door 2 is off in the app, every `/door2/` path answers `403` "door 2 is off", token or not. Rate limits (30 authenticated calls/minute per token, 2 concurrent runs) bound what a leaked Tunnel 2 token could do before you revoke it — and revocation is one tap in the app, effective immediately.

**Relay mode is stricter still:** a command arriving as a pasted block cannot execute at all until you approve it in the Agent Inbox. There is no setting that changes that.

## Updates you can verify

The in-app updater downloads only over https, checks the update manifest's fields strictly, and verifies both the byte size and the **SHA-256 fingerprint** of the APK against the manifest before the installer is invoked. A mismatch deletes the download and installs nothing. A download interrupted partway is likewise never installed: the partial copy is detected, discarded, and fetched again cleanly, and the updater's state survives the app being closed, so an update can never dead-end in a "downloaded but interrupted" loop. Updates are never downgrades: only a strictly newer version is ever offered. The standard Android installer still asks you to confirm the install.

## Best practices

* **Keep Tunnel 2 off** unless you are actively using a chatbot connection. Off is the default for a reason.
* **Name tokens after their caller** (`chatgpt-main`, `laptop-scripts`) so Activity reads like a guest book.
* **Revoke what you stop using.** A token you no longer recognise in the list should not exist.
* **Rotate after sharing widely.** If a connect block went somewhere it shouldn't have — a screenshot, a forwarded email — rotate the token; the old value dies after the grace window.
* **Review Activity.** It is the complete record: who, which tunnel, when, what result. Anything you don't recognise is a revoked-token decision waiting to happen.
* **Guard the phone.** BunnyBridge's model assumes the phone itself is yours and locked; the app sandbox is the boundary commands run inside.
* **Front doors:** if you run the self-hosted Tunnel 2 pattern, forward `/door2/` paths only, and keep that machine patched like any internet-facing box.

**Honest scope.** A token is a real capability: whoever holds one can run commands on the phone (and, through Tunnel 2's smaller surface, only what that surface allows). BunnyBridge's answer is not to pretend otherwise — it is named tokens, visible activity, instant revocation, and tunnels that stay shut until you open them.

***

*Source: Leverine/Leverine-BunnyBridge\@902c77c — `docs/site/BunnyBridge/security.html`.*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.