# ADR-0003: Bellona Gateway Trust and End-to-End Encryption Model

- **Status**: Accepted
- **Date**: 2026-04-22
- **Authors**: Bellona Remote Control Working Group, Codex
- **Reviewers**: Bellona, Psyche, Yemaya, Oshun Platform, Oshun Security

## Context and Problem Statement

ADR-0001 selected a standalone Bellona Remote Gateway plus Remote Host
architecture. ADR-0002 then made the gateway, host, adapter, Control Room, and
agent trust boundaries explicit, but it left one foundational cryptographic
question open: is the gateway trusted to see remote-control plaintext, or should
agent-to-host traffic be end-to-end encrypted so the gateway only routes opaque
messages?

Phase 180 requires the gateway to enforce policy, create approvals, emit audit
records, build timelines, expose MCP tools, and support replay. Those features
depend on structured command, result, approval, session, policy, and audit
metadata. A zero-knowledge gateway would materially change those contracts and
would push more authority to agents, hosts, or a separate key service.

This ADR decides the trust model before later gateway, host, audit, replay, MCP,
Control Room, stream, and adapter work depends on ambiguous assumptions.

## Decision Drivers

- Preserve server-side policy, approval, audit, timeline, replay, and MCP
  enforcement without duplicating authority inside every agent.
- Keep command envelopes inspectable by the gateway so risk classes, permission
  scopes, adapter targets, idempotency keys, actor identity, approval state, and
  audit metadata can be validated centrally.
- Keep the Remote Host as a second enforcement point that validates gateway
  identity, envelope shape, session membership, replay controls, and local
  policy before adapter execution.
- Avoid a false sense of confidentiality for desktop pixels, browser pages,
  engine scene data, file paths, approvals, and operator-visible session state
  that must be shown in Control Room and replay surfaces.
- Leave a path for future high-confidentiality artifact or media lanes without
  blocking the Phase 180 MVP.

## Considered Options

### Option 1: Fully Trusted Gateway Command Plane

The gateway terminates transport security, reads structured command/result
payloads, evaluates policy, creates approvals, emits audit records, serves
timeline/replay views, and routes host traffic over authenticated TLS/WSS.

Pros:

- Matches ADR-0001 and ADR-0002 gateway authority.
- Keeps policy, approval, audit, MCP, and Control Room semantics centralized.
- Makes command denial and approval explanations inspectable and testable.
- Simplifies replay, incident response, support, and operator visibility.

Cons:

- The gateway is trusted with command payloads, result metadata, timeline
  events, and any content intentionally routed through it.
- A compromised gateway can observe plaintext unless additional content-specific
  encryption exists.
- Organizations that require zero-knowledge SaaS operation need a later
  extension or self-hosted gateway mode.

### Option 2: Zero-Knowledge Gateway for All Agent-to-Host Messages

Agent and host negotiate application-layer end-to-end encryption; the gateway
only routes opaque ciphertext.

Pros:

- Strong confidentiality against a gateway that is honest-but-curious or
  compromised only for read access.
- Aligns with messaging-style systems where intermediaries should not inspect
  payload content.

Cons:

- Conflicts with gateway-side policy, approval, audit, replay, MCP, and Control
  Room requirements unless substantial metadata remains plaintext or policy
  moves elsewhere.
- Creates new bypass risk if agents can encrypt commands that the gateway cannot
  inspect before dispatch.
- Requires group/session key exchange, device enrollment, key transparency or
  pinning, key rotation, offline recovery, multi-agent membership changes, and
  replay/audit hash design before basic remote control can ship.
- Operator consent becomes harder because the approval UI must either decrypt
  command details or trust host/agent summaries.

### Option 3: Trusted Gateway Command Plane with Future Sealed Content Lanes

The command plane is gateway-readable and gateway-authoritative. Future
high-confidentiality media, artifact, or secret-bearing subchannels may add
application-layer end-to-end encryption after a separate ADR defines key
exchange, policy-visible metadata, audit commitments, operator consent, replay,
and recovery semantics.

Pros:

- Preserves Phase 180 policy/audit/approval architecture.
- Gives organizations a credible path to sealed screenshots, stream tracks,
  artifacts, or file-transfer payloads where the gateway only needs metadata.
- Keeps command authorization inspectable while separating confidentiality needs
  by data class.

Cons:

- Requires two security models if sealed lanes are later adopted.
- Sealed lanes still need plaintext metadata for policy, consent, retention, and
  incident response.
- Replay and export tools must distinguish readable command records from sealed
  content references.

## Decision Outcome

Bellona adopts **Option 3: trusted gateway command plane with future sealed
content lanes**.

The Bellona Remote Gateway is a trusted policy, approval, audit, timeline, MCP,
and routing authority for Phase 180 command traffic. It may inspect structured
command envelopes, policy inputs, approval decisions, command results, progress
events, redacted evidence metadata, stream descriptors, and timeline events.

The gateway is not a passive zero-knowledge relay. Agent-to-host command
payloads must not be encrypted in a way that prevents gateway policy evaluation,
approval explanation, audit emission, replay indexing, or operator visibility.
Transport encryption remains mandatory, but application-layer opaque command
encryption is rejected for the MVP command plane.

Future sealed content lanes are allowed only for content classes where the
gateway can safely authorize and audit metadata without seeing the full payload.
Examples may include selected screenshot blobs, stream media frames, diagnostic
bundles, exported artifacts, or file-transfer payloads. Sealed lanes require a
separate ADR and must not weaken command-plane policy or approval enforcement.

## Normative Rules

- **Gateway-readable command envelopes**: command namespace, target adapter,
  risk class, permission scopes, actor chain, session ID, device ID, idempotency
  key, timeout, rollback metadata, approval references, and policy inputs remain
  readable by the gateway.
- **Mandatory transport security**: agent-to-gateway, Control Room-to-gateway,
  MCP-to-gateway, and host-to-gateway traffic uses authenticated TLS/WSS in
  production. Development exceptions must be local-only and documented.
- **Host validates the gateway**: the host must validate gateway identity,
  accepted protocol version, session membership, replay controls, envelope
  shape, command namespace, risk metadata, and local policy before execution.
- **No opaque privileged command bypass**: arbitrary shell, arbitrary Blender
  Python, Unreal console, desktop control, real browser profile access,
  destructive file operations, publishing, and financial actions cannot be
  hidden inside encrypted payloads the gateway cannot inspect.
- **Audit-visible metadata**: audit entries must include enough plaintext
  metadata to reconstruct who requested what class of action, against which
  device/session/adapter, under which policy and approval decision, even if a
  future content blob is sealed.
- **Operator-readable approvals**: approval prompts must show human-readable
  command intent, risk, target, expected effect, reversibility, and evidence
  handling. Approvals cannot be based solely on opaque ciphertext or
  agent-supplied summaries.
- **Secret minimization**: secrets, credentials, cookies, access tokens,
  password-manager data, and personal browser profile contents should not be
  sent through command payloads. Redaction and path/profile grants remain
  required even though the gateway is trusted.
- **Self-hosted high-confidentiality path**: organizations that cannot trust a
  shared gateway with command plaintext must use a self-hosted Bellona Gateway
  until a future sealed command-plane ADR exists.

## Future Sealed Lane Requirements

If Bellona later adopts application-layer E2E encryption for selected content
lanes, that ADR must specify:

- **Key exchange**: identity binding for human operators, agents, gateways, and
  hosts; device enrollment; key rotation; revocation; recovery; and membership
  changes for multi-agent sessions. MLS-style group sessions or Signal-style
  pairwise sessions are acceptable research baselines, but the chosen design
  must fit gateway-mediated approvals and host revocation.
- **Policy-visible associated data**: every sealed payload must bind plaintext
  associated data such as session ID, device ID, actor ID, command ID, artifact
  type, retention class, redaction class, and policy decision so ciphertext
  cannot be replayed into another context.
- **Audit integrity**: audit entries must record hashes or commitments for
  sealed payloads, command envelopes, approval decisions, result summaries, and
  retention decisions. Replay/export tooling must prove that sealed blobs match
  their audit commitments without requiring the gateway to decrypt them.
- **Operator consent**: the operator must know which payloads are sealed, who
  can decrypt them, whether replay/export will include decryptable content, and
  what erasure or retention limitations apply.
- **Failure behavior**: if sealed-lane key exchange, decryption, commitment
  verification, or consent capture fails, privileged commands fail closed and
  safe diagnostics remain available.
- **Support boundary**: support, incident response, and compliance workflows
  must clearly state which evidence the gateway can inspect and which evidence
  requires operator/organization-held keys.

## Architecture Implications

- Gateway storage schemas may store plaintext command, policy, approval, and
  timeline metadata, with redaction and retention controls added in later
  stages.
- Audit hashes should be designed over canonical command/result/approval records
  now so future sealed content can attach commitments without changing the audit
  model.
- The Remote Host must not treat gateway trust as sufficient by itself; it keeps
  local policy preflight and adapter allow lists as defense in depth.
- MCP clients remain clients of the trusted gateway. MCP tools cannot establish
  private command channels that bypass gateway policy and audit.
- Control Room can display command intent, policy decisions, approvals, and
  timeline state directly from gateway records.
- WebRTC media may use normal WebRTC transport encryption for MVP. Any
  additional application-layer media sealing is a future sealed-lane decision.

## Acceptance Criteria

- This ADR exists under `docs/domains/bellona/extras/remote-control/adr/`.
- The decision explicitly selects trusted gateway command-plane operation for
  Phase 180.
- The ADR rejects zero-knowledge opaque command routing for the MVP.
- The ADR defines the minimum requirements for any future sealed content lane,
  including key exchange, audit integrity, and operator consent implications.
- The tracker row and Phase 180 checklist item for `180.C.02.13` are updated.
- Markdown formatting verification passes for this ADR, the tracker, and the
  phase checklist.

## Consequences

Positive consequences:

- Bellona keeps one authoritative control plane for policy, approvals, audit,
  MCP tools, Control Room state, and replay.
- Later implementation can build deterministic tests around inspectable command
  envelopes instead of opaque ciphertext.
- The host remains a defense-in-depth checkpoint against compromised gateways or
  malformed commands.
- High-confidentiality payloads still have a future path without compromising
  MVP safety gates.

Negative consequences:

- Shared gateway deployments become high-trust services and must be protected,
  monitored, and governed accordingly.
- Some zero-knowledge SaaS expectations are explicitly deferred.
- Future sealed lanes will add complexity to key management, audit export,
  operator consent, support, and retention workflows.

## Related Decisions

- `docs/domains/bellona/extras/remote-control/adr/ADR-0001-standalone-remote-gateway-and-host.md`
- `docs/domains/bellona/extras/remote-control/adr/ADR-0002-remote-control-threat-model.md`
- `docs/domains/bellona/extras/remote-control/external-implementation-research-2026-04-21.md`
- Future `180.C.08` audit, observability, timeline, and replay work.
- Future `180.C.25` transport hardening work.
- Future `180.C.27` security, privacy, and governance work.

## References

- `TODOS/phase-180.md`
- `TODOS/phase-180-gaps.md`
- `docs/domains/bellona/extras/remote-control/implementation-tracker.md`
- RFC 9420, The Messaging Layer Security Protocol:
  <https://www.rfc-editor.org/rfc/rfc9420.html>
- Signal Protocol specifications: <https://signal.org/docs/>
- NIST SP 800-207, Zero Trust Architecture:
  <https://csrc.nist.gov/pubs/sp/800/207/final>
- OWASP Logging Cheat Sheet:
  <https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html>
