CODY-001 Bridge URL must be HTTPS (HTTP only to loopback), in the client and
in manifest generation.
CODY-002 Even host calls stay serialised until the SDK call really settles;
a microphone start that completes after its timeout is followed by
a stop.
CODY-003 Request id is stored before the first submit and cleared only on a
definitive answer; lost replies are treated as ambiguous and
reconciled under the same id; HUD no longer claims "not sent".
CODY-004 Revoking a device cancels its in-flight turns, aborts
transcription and asks Hermes to stop, from HTTP and CLI paths.
CODY-005 Speech model pinned to a commit with per-file SHA-256; fetched and
verified ahead of time; verified on every load; never downloaded
at run time; no unpinned configuration.
CODY-006 State directory 0700, database/WAL/SHM 0600 regardless of umask.
CODY-007 credential_expired handled like unauthorized on every path.
CODY-008 Approval wait start and paused agent deadline persisted and
restored across restarts (schema v2).
CODY-009 Exactly one conversation create per epoch, sent in sequence, with
stale results dropped before persistence.
CODY-010 Wrong pairing guesses no longer consume the outstanding code;
failures are indistinguishable.
Checks: typecheck clean; npm test 182 passed; client build ok;
test:real-stt 11 passed (including with no network); test:real-hermes 9
passed; test:simulator 6 passed; git diff --check clean.
Not reviewed. No physical-device, droplet or production evidence.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
94 lines
8.0 KiB
Markdown
94 lines
8.0 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. Revoking also cancels every turn the device has in flight and asks Hermes to stop it, from the HTTP route and from the CLI alike. | yes |
|
|
| Credential or recordings sent in clear text | The app refuses any bridge address that is not HTTPS, except HTTP to loopback; the manifest generator refuses to package one. | yes |
|
|
| Guessing a pairing code | 10 characters from a 31-symbol alphabet (8.2 x 10^14 values, about 49 bits); valid 5 minutes; single use; a new code voids the old one; 5 attempts per minute per client address. At that rate one address gets 25 guesses per code: a 3 in 10^14 chance. Even a million guesses in the 5 minutes would be about 1 in 10^9. Wrong guesses do not consume the code, so nobody can void the owner's code by guessing; every failure returns the same answer. | 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 |
|
|
| Substituted speech-model files | The model is pinned to a commit id with a SHA-256 for every file. Files are fetched ahead of time and verified; the bridge re-verifies on every load, never downloads at run time, and reads from a directory that can be read-only. There is no unpinned mode. | yes, including with no network at all |
|
|
| State files readable by other users | The database is created owner-only before SQLite opens it (so its WAL and SHM files inherit that), in a 0700 directory; the systemd unit sets `UMask=0077`. | yes, under umask 0022 |
|
|
| 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.
|
|
1a. **Pairing brute force is bounded by entropy and a per-address limit, not by a lockout.** A
|
|
distributed attacker is limited only by how fast the bridge answers. That is still far short
|
|
of a useful chance (see the table), but it is a deliberate trade against letting anyone
|
|
cancel the owner's code.
|
|
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 phone for the bridge host.** With the default built-in speech model it
|
|
goes no further. With `STT_PROVIDER=openai-compatible` it is sent to that provider, whose
|
|
retention is outside our control.
|
|
3a. **The pinned hashes are only as trustworthy as the moment they were recorded.** They were
|
|
taken from the hub on 2026-11-18. They prove the files have not changed since; they do not
|
|
prove the files were benign then. The verified-then-loaded sequence also has a small window
|
|
between check and use, which a read-only model directory closes.
|
|
3b. **The speech model runs in a worker thread of the bridge process**, not a separate
|
|
sandboxed process. It no longer stalls the bridge (measured 3 ms), but a crash inside the
|
|
native runtime could still take the bridge down; systemd restarts it and in-flight turns are
|
|
recovered or failed honestly.
|
|
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>`.
|