Repository navigation
Security
🌐 English · 简体中文
This page documents Trizano's identity authentication, device pairing, session tickets, proxy isolation, Node channel permissions, and threat model. It is intended for operators evaluating self-hosted exposure and troubleshooting auth issues. Trizano is a personal self-hosted tool: its security model favors clear, auditable boundaries without heavy external dependencies—stating explicitly what it defends against and what it does not.
Each Hub generates a long-term ECDSA P-256 identity private key on first startup, stored in <data>/identity.pem (PKCS#8 PEM, mode 0600; see server/hub/auth/auth.go). The first 16 hex characters of the SHA-256 of its SPKI DER public key form its instance_id.
The Hub proves possession of this key via the public RPC AuthService.Hello(nonce): it signs "trizano-hello-v1\n" || b64(nonce) || "\n" || ts with its identity private key and returns its public key, millisecond timestamp, and signature.
-
Android and desktop: During initial pairing, the client verifies the
Hellosignature and pins the Entry's public key. Thereafter, before sending a session ticket to any Entry for the first time in a process, it callsHelloand requires the returned public key to match the pinned key (or that Entry's key in the Roster) with a timestamp within 5 minutes of local time. If verification fails, the ticket is never sent. -
Browser: Relies on HTTPS same-origin enforcement and the browser TLS certificate store rather than
Hellokey pinning.
New devices cannot self-register; every device must be explicitly approved by you via a 6-digit verification code before entering the Roster (server/hub/auth/pairing.go):
- The client calls
AuthService.StartPairingwith a device name and credential type (passkeyordevice_key), receiving a pairing ID, a random 6-digit code, and proof parameters (WebAuthn creation options or a 32-byte challenge). - The client completes the local proof and submits its signature or passkey credential via
AuthService.FinishPairing. Only proven pairings (proven = true) can be approved. The Hub logs the source IP, the 6-digit code, and the approval commandtrizano-carbon approve <code>. - You click Approve on the pairing card in any already-signed-in device, or run
trizano-carbon approve <code>on the Hub host. - The client long-polls
AuthService.AwaitPairing(up to 25 s per poll) to collectSignIn. The device is signed into the Roster only at the moment it claims the login result—an approved pairing that is never claimed expires cleanly without leaving a Roster entry.
Rate limits and anti-phishing differences between device pairing and Node/Entry enrollment:
| Dimension | Device Pairing (server/hub/auth/pairing.go) |
Node / Entry Enrollment (server/hub/enrollment.go) |
|---|---|---|
| Lifetime | 3 minutes | 3 minutes |
| Concurrency & rate limits | Up to 3 pending concurrently; up to 10 starts per 10 minutes | Up to 5 proven pending, 20 global per 10 minutes; up to 64 unproven in memory, 10 per IP per 10 minutes; 8 KiB body cap |
| 6-digit code visibility | Returned on the approval UI so you can compare and click Approve | Public ListNodeEnrollments and the event stream never return the 6-digit code—you must type the code displayed in the Node terminal manually into the web/Android approval card (invalidated after 5 consecutive wrong guesses) to prevent misclicks and phishing approvals; only local admin.sock returns the code for trizano-carbon pairings
|
| Code collision prevention | Device pairings and enrollments share deduplication checks so active codes never collide | Same |
After a paired device's ticket expires or you sign out, you can sign back in with the original credential (StartLogin challenges expire in 2 minutes) without re-pairing:
-
Browser Passkey (WebAuthn): Both registration and login enforce
ResidentKey = requiredandUserVerification = required(verified via Touch ID, fingerprint, Windows Hello, or another platform authenticator). Each passkey represents a separate device (user handleis the device ID), login uses discoverable credentials with no username prompt, and the Roster stores a frozen copy of the credential JSON without updating sign counts on subsequent logins. WebAuthnRPIDis derived from the--originhostname and requires a secure context that is not a bare IP address—so local browser access must usehttp://localhost:<port>(not127.0.0.1), and remote access must use HTTPS with--originconfigured. -
Device Key Signature (Android and desktop): Uses a local P-256 key pair, signing
trizano-pair-v1\n{pairing}\n{b64(challenge)}during pairing andtrizano-login-v1\n{login}\n{b64(challenge)}on login. Android stores the private key in the Android Keystore requiringBIOMETRIC_STRONGorDEVICE_CREDENTIALviaBiometricPromptfor every signature. Desktop stores the private key indevice_key.peminside its application data directory (without biometric gating).
After pairing or sign-in succeeds, the Entry signs a self-contained trizano.roster.v1.Ticket with its identity.pem (server/internal/roster/ticket.go, server/hub/auth/auth.go):
-
Format and lifetime: Encoded as
tt1.<base64url(body)>.<base64url(sig)>, containing the device ID, issuing Entry public key, issued-at and expiry timestamps, and a 16-byte random ID, valid for 30 days. Clients send it viaAuthorization: Bearer <ticket>or the browser cookietrizano_session(HttpOnly; SameSite=Strict, plusSecureover direct TLS or when a reverse proxy setsX-Forwarded-Proto: https). -
Automatic renewal: Once an authenticated request verifies a ticket older than 24 hours, the serving Entry automatically mints a fresh ticket and returns it in the
X-Trizano-Tokenresponse header (and a refreshedSet-Cookiewhen authenticated via cookie). Event streams and WebSockets deliver renewed tickets in their handshake response headers. Android and the desktop local proxy automatically persist renewed tickets fromX-Trizano-Token. Legacy 32-byte random tokens remain accepted during transition and are upgraded tott1.tickets viaX-Trizano-Tokenon every request. -
Logout (
AuthService.Logout): Records the ticket's 16-byte random ID in the current Entry'shub.dbticket_logoutstable (retained until the ticket's expiry and pruned on Hub startup) and clears the browser cookie. Logout applies only to the current Entry and is not replicated to other Entries. -
Revocation (
RevokeDevice/trizano-carbon revoke): Signs a RosterRemovestatement for the device. Once removed:- The local Entry deletes any legacy tokens for that device and calls
Auth.Cutto cancel all of its active request contexts, immediately closing event streams and terminal/preview/browser WebSockets; all future requests with its tickets returnUnauthenticated. - As soon as the Roster syncs to other Entries, they run the exact same cutoff logic.
- The local Entry deletes any legacy tokens for that device and calls
Additionally, server/hub/webui/webui.go serves static frontend /assets/* with Cache-Control: private, max-age=31536000, immutable and index.html with no-cache to prevent shared proxy caching. Source IP extraction (clientAddr) inspects the rightmost valid IP in X-Forwarded-For only when the TCP peer is loopback (a local reverse proxy or tunnel), ignoring forwarding headers on non-loopback peers. Source IPs are used strictly for logging and rate limiting—never for authorization.
The Hub auth middleware (server/hub/hub.go) is default-deny: except for explicitly exempted public paths, every /trizano.* and /nodes/* request must carry a valid device ticket.
| Path | Purpose & built-in protections |
|---|---|
/trizano.hub.v1.AuthService/* |
Hello, pairing, login, logout, and Me (Me validates the ticket internally) |
/trizano.hub.v1.NodeEnrollmentService/* |
Reverse Node and new Entry enrollment plus connect handshakes; 8 KiB body cap with per-IP and global rate limits |
/trizano.hub.v1.EntryService/* |
Entry-to-Entry SyncRoster; 4 MiB body cap, ±5 min timestamp check, P-256 signature bound to the receiver's public key, and active ROLE_ENTRY Roster membership check |
GET /nodes-connect |
Reverse Node WebSocket endpoint; atomically consumes a one-time challenge before upgrade (30 s TTL, caps of 8 per Node, 1024 global, 60/min per IP) and verifies the Node signature, then runs mutual TLS 1.3 pinned to both P-256 keys inside the WebSocket (ALPN trizano-node-h2) |
Paths outside /trizano. and /nodes/
|
Embedded static Web UI assets |
Every client request routed to /nodes/{node}/<procedure> passes through two isolation layers in server/hub/nodes/registry.go:
-
Blocked external paths (always return
403):-
/nodes/{node}/internal/*(prevents clients from impersonating agents calling internal orchestration endpoints) -
SystemService/Shutdown(restricted strictly to the Node's local owner channelrun/node.sock) -
SystemService/OpenControlBridge(restricted to the Hub itself for cross-Node control bridges) -
SystemService/SyncRoster(restricted to the Hub itself for Roster synchronization) -
SystemService/InstallBuild(restricted to the Hub itself for pushing builds to Reverse Nodes)
-
-
Credential stripping and response sandboxing:
- Before forwarding any request to any Node (local, SSH, or Reverse), the Hub strips
AuthorizationandCookieheaders so a compromised Node cannot steal device tickets or session cookies. - On responses returning from a Node, the Hub strips
Set-CookieandX-Trizano-Token(preventing a malicious Node from tampering with sessions or injecting forged tickets) and overwrites three security headers:X-Content-Type-Options: nosniffContent-Security-Policy: sandbox; default-src 'none'; img-src 'self' data:; media-src 'self'; style-src 'unsafe-inline'Cross-Origin-Resource-Policy: same-origin
This ensures that even a compromised Node serving malicious HTML/JS over
/rawor/mediacannot execute script in the Hub's origin. - Before forwarding any request to any Node (local, SSH, or Reverse), the Hub strips
-
Hub management channel:
<data>is created with mode0700and holdsadmin.sock, relying on OS user isolation instead of a static admin password. -
Node dual-socket isolation (
server/node/daemon.go):- Owner channel
~/.trizano/node/run/node.sock(0600): Servesattach,stop, andtrizano-h3 admin. Only requests arriving on this socket carry the owner marker required forSystemService.Shutdownor initially setting the Roster root. - Agent orchestration channel
~/.trizano/node/orch/s.sock(0600): A separateOrchHandler()exposes onlyPOST /internal/orch/{method}(2 MiBbody cap); neither the owner socket nor Reverse connections mount this route. At startup, the daemon copies itself toorch/trizano-h3(0700) so sandboxed agents only needorch/mounted to invoke the orchestration CLI—with no access torun/node.sock,state.db, ornode_key.pem.
- Owner channel
-
Per-session HMAC tokens (
server/node/session/token.go): On every startup, the Node generates a 32-byte in-memory secret and issuesmc_<base64url(session|hop)>.<HMAC-SHA256>viaTRIZANO_SESSION_TOKENto each agent process. Every/internal/orch/*request is verified in constant time, preventing a subprocess from spoofing another Session's identity or altering its cross-Node hop count (capped atMaxCrossNodeHops = 1). Read-only Sessions and Discussion Room participants are also blocked from write orchestration calls. -
Desktop local proxy:
127.0.0.1:47801permits only matchingHostandOriginheaders (blocking DNS rebinding and cross-site requests), and/_desktop/*control endpoints require the per-launch randomX-Trizano-Desktop-Secret.
Understanding these boundaries matters more than stacking complex defenses.
- Unauthorized external access and brute-force pairing: No Node or Session data is reachable without a valid ticket. Pairings and enrollments have 3-minute lifetimes plus concurrency and rate limits, and Node/Entry enrollments additionally require manually copying the 6-digit code.
-
Cross-site requests and DNS rebinding: Browser cookies use
HttpOnly; SameSite=Strict, WebSockets enforceOrigin, and the desktop local proxy enforcesHost,Origin, and a per-launch random secret. -
Eavesdropping on Reverse Nodes by outer proxies or plain-HTTP LANs: Reverse Nodes wrap traffic in mutual TLS 1.3 pinned to both P-256 public keys inside the WebSocket. Even over a third-party tunnel or
--allow-insecure-http, intermediaries cannot decrypt or tamper with Node traffic. - A compromised Node stealing credentials or attacking the Hub origin: Nodes never see device tickets; the Hub strips auth headers on requests, enforces CSP sandboxing on Node responses, and confines each Node to a single backend slot.
-
Prompt-injected sandboxed agents escaping to take over the Node: A sandboxed agent sees only
orch/, cannot reachrun/node.sock, cannot shut down the daemon, cannot forge another Session ID, and cannot recurse indefinitely across Nodes.
- Entries are fully trusted by browsers: A malicious Entry can serve arbitrary frontend code to a browser and perform any action as the signed-in user. Deploy Entries only on machines you trust.
-
Entries trust each other in a multi-Entry group: Every Entry in the Roster can admit new devices/Nodes and issue valid tickets. If an Entry is compromised, remove it from another Entry; if you suspect it admitted unauthorized members, run
trizano-carbon roster reseton the root Entry to start a new epoch. -
Unsandboxed agents have the same privileges as the Node's OS user: Both the Node daemon and agents run under your regular OS user account. An agent running without a sandbox can read/write local files and connect to
run/node.sockdirectly;orch/isolation protects against sandboxed agents escalating privileges. - Every signed-in device is an administrator: There is no multi-tenancy or role-based access control. Any signed-in device can approve pairings, revoke devices, add/approve Nodes, and edit model pricing.
-
Approving a Node trusts its cross-Node delegation capability: Any approved Node can initiate a one-hop delegation call to itself or any other online Node over its control bridge (
MaxCrossNodeHops = 1prevents loops, not single-hop target selection). -
SSH connections can be reused by the same OS user: Non-Windows Hubs enable
ControlMaster=auto/ControlPersist=10m, so other processes running as the same OS user on the Hub machine can reuse control sockets under<data>/ssh/. -
Session tickets are 30-day bearer credentials: A stolen ticket can be used until it expires. To cut it off everywhere, revoke the device on any Entry (calling
Logoutonly invalidates the ticket on that single Entry). - The Roster is eventually consistent: During a network partition, an isolated Entry learns of a device or Node removal only after connectivity returns and Roster sync completes, at which point it immediately cuts active connections.
If you discover a security vulnerability, please do not open a public issue. Report it privately through GitHub's Private vulnerability reporting on the repository. Security fixes are provided for the latest released version.
English
Getting Started
Deployment & Networking
Architecture & Nodes
Agents
Clients & Development
Project & Community
中文文档
新手指引
部署与网络
架构与节点
智能体
客户端与开发
项目与社区