Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Put a Rust Proxy Between My App and PostgreSQL. Here’s What Happens to Every Connection

Описание и применение

Rust‑прокси Proxima Engine обеспечивает проверку контекста арендатора и маппинг на роли PostgreSQL, добавляя дополнительный слой изоляции в многопользовательском приложении.

Задача

Ensuring tenant isolation in a multi‑tenant application when using PostgreSQL, without relying solely on application‑level filters.

Результат

The proxy adds an extra enforcement boundary, ensuring that only verified tenants can establish connections and that tenant isolation is validated through negative tests.

Рабочий процесс

  • 1. Application connects to Proxima Engine using its PostgreSQL driver.
  • 2. Engine accepts PostgreSQL‑protocol connections and performs the startup handshake.
  • 3. Engine verifies signed tenant context (tenant ID, token expiry, signature).
  • 4. On success, engine maps tenant identity to a PostgreSQL role and establishes an upstream connection.
  • 5. Engine relays protocol messages between application and PostgreSQL.
  • 6. Health, status, and Prometheus metrics are exposed for operational visibility.
  • 7. Negative tests are run to confirm isolation (e.g., Tenant A cannot read Tenant B’s records).

Доказательства

Instead of relying entirely on application-level tenant filters, I built an open‑source Rust proxy that sits between an application and its existing PostgreSQL database.

Источник

When tenant enforcement is configured, the engine validates signed tenant context. That includes checking the tenant identifier, token expiry, and signature. Invalid or missing tenant context is rejected.

Источник

After successful verification, the engine maps the tenant identity to a PostgreSQL role. PostgreSQL grants and Row‑Level Security policies remain responsible for restricting database access.

Источник

A successful database connection doesn’t prove tenant isolation. You need negative tests. Can Tenant A read Tenant B’s records? What happens when tenant context is missing, expired, or invalid?

Источник

  • Дата записи: 2026-10-27T17:11:49.156Z