# Security and Access Boundaries

> **Status:** CURRENT
> **Last verified:** 2026-11-28

## Owner-only control

**Required/current policy:** The documented owner Telegram ID is `8260131997`.
Only the owner may request or approve code, file, configuration, or
infrastructure edits. Regular users have no code/file edit access and must not
receive Hermes terminal, SQLite, cron, or equivalent privileged tools.

Hermes currently enables `terminal`, `sqlite`, `cron`, and `telegram_send`, so
its owner-only allowlist is a critical required control. The YAML field
`telegram.allowed_users` is blank/null; the runtime key `TELEGRAM_ALLOWED_USERS`
exists in the protected `.env` file. Its value was not read, and neither the
effective value nor environment-variable precedence over YAML was independently
inspected. Runtime enforcement is therefore not independently verified. Any
allowlist change requires owner approval and a protected runtime check; it must
never be inferred from a public document or a Telegram display name.

The Google legacy `ebtbridge.service` is not an owner-edit interface and must
not be treated as Hermes. The public Knowledge Sea retrieval API is read-only
and requires no API key.

## Secret handling

- Never print, echo, source casually, OCR, paste into prompts, or commit `.env`
  values.
- Document secret-bearing configuration by key name only. Use placeholders in
  examples, never realistic tokens.
- Keep `.env`, provider keys, Telegram tokens, session databases, and memory
  files out of public documentation, logs, screenshots, and Git history.
- Do not publish raw service journals or user message content. Use redacted
  signal counts when operational evidence is needed.
- Store secrets with restrictive permissions, least privilege, controlled
  backup, rotation, and revocation. A metadata-only Oracle inspection at
  `2026-11-28T00:39:19Z` verified mode `0600` for Hermes `.env`, `state.db`,
  `sessions/sessions.json`, `memories/MEMORY.md`, and `memories/USER.md`. No file
  contents were read; do not generalize this mode to unverified files.
- Run secret-pattern scans before committing documentation. A clean scan is a
  guardrail, not proof that a value is safe to publish.

## BYOK boundaries

BYOK means a registered user supplies their own model-provider key. It does not
mean the key may be sent to Telegram, Hermes, a public API, a browser log, or
another user's session.

Current boundaries:

| Surface | Key boundary |
| --- | --- |
| Public Knowledge Sea retrieval API | No API key; no model-provider credential |
| Account dashboard / relay (`acct.`) | Supplied verified baseline: separate Cloudflare Worker `gm-worker`; account/session protected |
| Google VM applications | Do not expose Worker-held user keys through VM routes or logs |
| Oracle Hermes | Provider keys restricted to the owner by policy; never reused for regular users |
| Telegram | Transport and identity only; never a key-storage or key-entry channel |

The `acct.` → `gm-worker` mapping is the supplied verified baseline, not a fresh
Cloudflare-side route-binding verification. Google tunnel ingress cannot prove a
Worker custom-domain binding; the Cloudflare dashboard/API binding was not
re-queried. See
[Architecture — Cloudflare Worker layer](architecture.md#cloudflare-worker-layer).

A future BYOK flow must accept keys only through authenticated HTTPS, encrypt
them at rest, isolate each account, and decrypt them only inside a trusted
server-side relay for the intended provider call. Keys must not be returned to
the client after submission, included in telemetry, or exposed through error
messages. Rotation and revocation must be supported without logging the key.

### Protected key relay requirement

Before any regular-user BYOK feature is enabled, a protected relay/storage
design is mandatory. It must enforce account ownership, per-account isolation,
provider-backed credential verification, encryption, secret-redacted audit
events, provider allowlists, rate limits, and revocation. A public endpoint that
accepts or forwards raw keys is not an acceptable substitute.

### Why a key hash cannot authenticate

A key hash is not proof that the presenter controls the original provider key.
If accepted as a credential, the hash itself becomes replayable; if the hash
store leaks, it can also enable offline guessing for low-entropy keys. A hash
may be used as a non-secret fingerprint for lookup or deduplication, but it must
not authenticate a user, authorize a relay call, or replace provider-backed
credential verification.

Credential acceptance requires provider-backed verification by the trusted
relay: use the submitted key in an authenticated request to the intended
provider and require a successful provider response before authorizing the
relay. A generic signed challenge or client-generated signature is not
sufficient. Only where the selected provider explicitly documents a signed
proof-of-possession mechanism may that provider-specific signed proof be
validated server-side; do not invent a generic signed-challenge scheme. The key,
verification result, and resulting authorization must remain inside the trusted
boundary.

## Per-Telegram-ID lifelong memory — PLANNED — NOT IMPLEMENTED

Persistent companions and lifelong per-Telegram-ID memory are **PLANNED — NOT
IMPLEMENTED**. The current `/home/ubuntu/.hermes/memories/` directory is owner
memory only; it is not a per-user companion service.

Any future implementation must:

- bind memory to a verified Telegram ID, not a display name or self-declared ID;
- obtain explicit consent and define what “lifelong” retention means;
- isolate each user's memory and prevent cross-user retrieval or tool access;
- provide export, correction, deletion, and revocation controls;
- keep memory encrypted/protected and never place provider keys inside it; and
- pass a security review before any capability is described as operational.

Until those controls exist, no regular-user companion, persistent per-ID memory,
or privileged edit capability may be claimed.
