Security Model
Hippo treats every intermediate network, including public Wi-Fi, carrier networks, Cloudflare tunnels, and self-hosted relays, as untrusted. Authentication, confidentiality, replay defense, and filesystem boundaries are enforced at the application layer.
Threat Model
Hippo protects against:
-
Passive or active relay eavesdropping: Even a
compromised
hippo-relayonly observeshost_id,client_id, and ciphertext. -
Handshake & frame replay:
HandshakeInitchecks a 120-second timestamp window (MAX_HANDSHAKE_SKEW_SECS) and encrypted frames reject non-monotonic sequence numbers. - Path escape & symlink traversal: Every browse, read, and write resolves through canonical path verification inside allowlisted workspace roots.
-
Silent buffer overwrites: Mobile edits send
base_sha256before touching disk.
Device Identity & Pairing
Both hippo-daemon and hippo-app generate
persistent Ed25519 keypairs locally. Pairing uses a
short-lived one-time pairing_secret (18 random bytes,
URL-safe base64, default TTL 300s):
-
Running
hippo pairprints a QR code encoding a JSONPairingBundleinside ahippo://pair?d=...URI containinghost_id,host_ed25519_pk, direct/relay URLs,pairing_secret, and expiry. -
The mobile app scans the bundle, builds its
HandshakeInittranscript, and attachespairing_proof_b64computed via HMAC-SHA256 using domainhippo-pair-proof-v1. -
The daemon verifies the proof in constant time (
subtle::ConstantTimeEq), stores the mobile public key indevices.json, and clears the one-time secret.
Keep pairing QR codes private. Anyone who reads
the QR code before expiry can complete the initial pairing
handshake. Run hippo pair again to overwrite a stale
secret or hippo devices revoke <uuid> to remove
an unwanted device.
Session Handshake (X25519 + HKDF-SHA256)
Every WebSocket connection negotiates fresh ephemeral X25519 keys signed by both Ed25519 identity keys:
// Transcript signed by client Ed25519 key in HandshakeInit
"hippo-handshake-v1"
|| host_id (16 bytes)
|| client_id (16 bytes)
|| client_ed25519_pk (32 bytes)
|| client_name_len (4B BE) || client_name
|| client_ephemeral_x25519_pk (32 bytes)
|| client_nonce (16 bytes)
|| timestamp_unix (8B BE)
After verifying the client is paired, not revoked, and within
MAX_HANDSHAKE_SKEW_SECS = 120, the host replies with
HandshakeAck signed over
init_transcript || host_ephemeral_x25519_pk || host_nonce. Both peers derive directional 256-bit keys:
shared = X25519(my_ephemeral_sk, peer_ephemeral_pk)
salt = client_nonce (16B) || host_nonce (16B)
c2h = HKDF-SHA256(salt, shared, info = "hippo-e2ee-v1-c2h")
h2c = HKDF-SHA256(salt, shared, info = "hippo-e2ee-v1-h2c")
AEAD Framing & Replay Defense
All RPC messages serialize as JSON inside
EncryptedFrame { seq: u64, ciphertext_b64 } encrypted
with ChaCha20-Poly1305:
nonce = [0u8; 4] || seq.to_be_bytes()
aad = "hippo-e2ee-v1" (13B) || host_id (16B) || client_id (16B) || ("c2h"|"h2c") (3B) || seq (8B)
Each direction tracks recv_seq independently. Any frame
with frame.seq <= self.recv_seq triggers
CryptoError::ReplayDetected immediately.
Workspace Path Jail
resolve_jailed_path in
crates/hippo-daemon/src/workspace.rs enforces strict
isolation per allowlisted root:
-
Rejects null bytes, absolute paths, Windows prefixes, and any
..parent component upfront. -
Canonicalizes the workspace root, then walks every path segment
incrementally checking
fs::symlink_metadata. -
Rejects dangling symlinks, symlinks pointing outside
root_canon, and writing directly through a terminal symlink. -
Enforces safety limits:
512 KBread preview,16 MBhash cap,2 MBwrite cap, and1 MBdiff cap.
Optimistic File Concurrency
When saving an edit from mobile via WriteFile, if the
file on disk has changed since the last read, the daemon rejects the
write and returns ErrorCode::HashMismatch so concurrent
desktop changes are never overwritten blindly.
Process Cleanup & Revocation
-
Clean cancellation: Cancelling a job runs
kill_process_tree, signalinglibc::kill(-pgid, SIGTERM)on Unix ortaskkill /F /T /PIDon Windows so child agent processes cannot linger. -
Device revocation: Running
hippo devices revoke <client_id>setsrevoked = trueindevices.json, severing future access immediately.