Client (apps/even-client): pure interaction reducer with generation-based stale-result rejection, HUD renderer, measured pagination, Even Hub SDK 0.0.16 adapter, bridge HTTP client, phone pairing/status/diagnostics page. Bridge (services/bridge): device pairing and revocable expiring credentials, turn engine with idempotent submit, cancel, deadlines and restart recovery, Hermes Runs API adapter, OpenAI-compatible STT adapter, operator CLI. Contract (packages/contracts): versioned schemas, types and error codes. Tests: 122 unit/integration (fakes), 6 simulator scenarios (Even Hub simulator 0.9.5), 9 scenarios against a real Hermes v0.23.1 gateway with a stub model. No real STT, real model or physical device has been exercised; see docs/test-evidence.md and docs/device-test-plan.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
78 lines
5.9 KiB
Markdown
78 lines
5.9 KiB
Markdown
# Security and threat model
|
|
|
|
Scope: the single-user slice. One owner, one bridge, one Hermes profile, one or a few paired
|
|
devices. Not reviewed by anyone but its author yet; see `docs/handoff/`.
|
|
|
|
## What is being protected
|
|
|
|
| Asset | Why it matters |
|
|
|---|---|
|
|
| The Hermes API key | It gives full use of the agent, "including terminal commands" per Hermes's docs. |
|
|
| The ability to make the agent act | A forged or replayed turn could run tools. |
|
|
| Voice recordings, questions, answers | Private by nature. |
|
|
| The STT provider key | Billing and access. |
|
|
|
|
## Trust boundaries
|
|
|
|
1. **Phone WebView to bridge.** Untrusted network. The client holds only a device credential.
|
|
2. **Bridge to Hermes and to STT.** The bridge holds the real secrets. Both must be HTTPS unless
|
|
on loopback; the bridge refuses to start otherwise.
|
|
3. **Bridge host.** Whoever can run the CLI or read the SQLite file is the owner.
|
|
|
|
## Controls in this slice
|
|
|
|
| Threat | Control | Tested |
|
|
|---|---|---|
|
|
| Hermes key or STT key leaks through the client | Neither is in the client code, bundle or any API response. The production bundle was searched for them. | yes |
|
|
| Stolen device credential | Scoped to one device and one profile; cannot name a Hermes session; expires in 7 days; pairing ends at 90 days; revocable from the phone or the bridge host; stored on the bridge as SHA-256 only. | yes |
|
|
| Guessing a pairing code | 10 characters from a 31-symbol alphabet (about 49 bits); valid 5 minutes; single use; a new code voids the old one; 5 wrong guesses burn every outstanding code; 5 attempts per minute per client address. | yes |
|
|
| Client picks someone else's agent session or profile | Requests with unknown fields are rejected. The Hermes session id is generated by the bridge and never leaves it. A device is valid only for the profile it was paired under. | yes |
|
|
| One device reads or cancels another's turn | Every lookup is scoped to the authenticated device; a foreign id answers 404, not 403. | yes |
|
|
| Duplicate or replayed submit runs a tool twice | Client request id is the bridge's idempotency key; the bridge forwards a derived key to Hermes. | yes, including against real Hermes |
|
|
| Blind replay after a timeout | A sent-but-unanswered request ends as `unknown`, never as retryable. | yes |
|
|
| Oversized or malformed input | 32 kB JSON limit; audio capped at capture length + 1 s; schema validation; only one audio format accepted. | yes |
|
|
| Request flooding | Per-device turn limit, per-address pairing limit, general per-device limit. | yes |
|
|
| Cross-origin browser abuse | CORS allows only exact configured origins and sends no credentials mode. CORS is not treated as authentication: every route still needs the bearer credential. | yes |
|
|
| Secrets or content in logs | Logs carry ids, states, codes and timings. Request logging is off, a redaction list backs it up, and Hermes's own diagnostic text is never relayed or logged. | yes |
|
|
| Recordings retained | Audio exists only in memory for the length of one transcription call and is never written to disk by the bridge. | by construction; not independently audited |
|
|
| Agent approves its own privileged action | The bridge never calls Hermes's approval endpoint. | yes |
|
|
| Markup injection from an agent answer into the phone page | The page is built with `textContent` only. | by construction |
|
|
| Administrative access over the network | There is none. Pairing codes and revocation are CLI-only. | by construction |
|
|
| Accidental public exposure | Binds 127.0.0.1 by default; a non-loopback bind needs an explicit setting. | yes |
|
|
|
|
## Known gaps and accepted risks
|
|
|
|
Stated so they are not mistaken for protections.
|
|
|
|
1. **The device credential is not in secure storage.** Even's app storage is not described as
|
|
encrypted, and the public SDK offers nothing better. The mitigation is that the credential is
|
|
narrow, expiring and revocable, not that it is safe at rest. Anyone with the unlocked phone, or
|
|
with developer access to the app's storage, can use it until it is revoked.
|
|
2. **Renewal needs only the current token.** A thief who renews before the owner notices keeps
|
|
access until revoked or until the 90-day pairing lifetime ends.
|
|
3. **Audio leaves the device and, with a hosted STT provider, leaves your network.** A
|
|
self-hosted Whisper endpoint avoids this. The provider's own retention is outside our control.
|
|
4. **In the simulator, raw audio frames are echoed to the WebView console.** Whether the phone
|
|
does the same is unknown and is on the device checklist. If it does, recordings would be
|
|
visible to whoever can read that console.
|
|
5. **TLS is not terminated by the bridge.** A reverse proxy or private network must provide it. A
|
|
misconfigured proxy could expose plain HTTP.
|
|
6. **Rate limits are in memory** and reset on restart. Behind a proxy, per-address limits are only
|
|
meaningful with `HERMEVEN_TRUST_PROXY=true` and a proxy that sets the forwarded address.
|
|
7. **The 15-minute result cache holds question and answer text in SQLite in clear text**, as does
|
|
the pending request body for the moment between sending and recording the run id.
|
|
8. **The SQLite file and `.env` are protected only by file permissions** on the bridge host.
|
|
9. **No audit trail** of pairings and revocations beyond the log stream.
|
|
10. **The network whitelist puts the bridge origin into the packaged app**, where anyone with the
|
|
package can read it. The origin is not a secret and must not be treated as one.
|
|
11. **The agent's tool permissions are whatever the Hermes profile allows.** Hermeven does not
|
|
narrow them. Use a read-only or test profile until approval handling is proven on a device.
|
|
12. **Dependencies were not audited** beyond `npm install` reporting no known vulnerabilities on
|
|
2026-11-18.
|
|
|
|
## Operational rules
|
|
|
|
- Keep `.env` out of git (it is ignored) and out of screenshots.
|
|
- Never put a real key in a tutorial, a build-in-public post or an issue.
|
|
- Revoke a lost device from the bridge host: `npm run bridge:cli -- revoke <device-id>`.
|