feat: bind and guard the HTTP gateway #14

Merged
aleksei merged 1 commit from feat/gateway-guard into main 2026-10-21 23:30:50 +00:00
Owner

What this adds

The HTTP facade can be bound to one interface and guarded by the deployment,
which is what a service that exposes it needs and what the facade deliberately
does not decide by itself.

  • HttpGatewayUnit::with_bind(address) — binds one interface instead of
    every interface. The default is unchanged (0.0.0.0), so an existing
    deployment behaves the same.
  • HttpGatewayUnit::with_guard(guard) — a predicate over the message
    headers
    and the target. A request it rejects is answered 401 before
    the body is decoded and before the broker is reached; a WebSocket is refused
    before the upgrade. Without a guard nothing changes.
  • adr/op.md — the HTTP facade section states why the bind and the guard are
    deployment settings: a token, a signature or an operation allowlist is a
    deployment decision, so the facade stays one implementation.

Why

The facade forwards every path to every operation, including the mutations, on
every interface. A deployment that uses it as an observability surface (statuses,
records, the report) must be able to say "loopback only", "bearer only" and
"read-only", without a second gateway implementation and without forking the
adapter.

Tests

eve_e2e/tests/gateway/local.rs — the facade over the in-process broker, so
the test needs no service:

  • the configured bind is the loopback interface;
  • a request without the token is 401, with it is 200;
  • the socket is refused before the upgrade.

cargo test -p eve_e2e --test gateway local:: — 3 tests pass. The network
gateway tests are unchanged and need the standard backends.

## What this adds The HTTP facade can be bound to one interface and guarded by the deployment, which is what a service that exposes it needs and what the facade deliberately does not decide by itself. - **`HttpGatewayUnit::with_bind(address)`** — binds one interface instead of every interface. The default is unchanged (`0.0.0.0`), so an existing deployment behaves the same. - **`HttpGatewayUnit::with_guard(guard)`** — a predicate over the **message headers** and the **target**. A request it rejects is answered `401` before the body is decoded and before the broker is reached; a WebSocket is refused before the upgrade. Without a guard nothing changes. - **`adr/op.md`** — the HTTP facade section states why the bind and the guard are deployment settings: a token, a signature or an operation allowlist is a deployment decision, so the facade stays one implementation. ## Why The facade forwards every path to every operation, including the mutations, on every interface. A deployment that uses it as an observability surface (statuses, records, the report) must be able to say "loopback only", "bearer only" and "read-only", without a second gateway implementation and without forking the adapter. ## Tests `eve_e2e/tests/gateway/local.rs` — the facade over the **in-process** broker, so the test needs no service: - the configured bind is the loopback interface; - a request without the token is `401`, with it is `200`; - the socket is refused before the upgrade. `cargo test -p eve_e2e --test gateway local::` — 3 tests pass. The network gateway tests are unchanged and need the standard backends.
aleksei deleted branch feat/gateway-guard 2026-10-21 23:30:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/eve!14
No description provided.