Skip to content

Sluice

Sluice is a SQL gateway that enforces policies between your clients and your databases. Clients such as AI agents and BI tools send SQL over REST or MCP. Sluice parses each statement with the PostgreSQL grammar and denies it unless your YAML policies allow it. It adds row filters and column masks, runs the statement read-only in DuckDB and writes an audit record.

client (REST / MCP) ─▶ identify ─▶ parse ─▶ policy ─▶ rewrite ─▶ execute (DuckDB, read-only) ─▶ audit ─▶ rows

Example

This row filter limits each subject to the rows of its tenant.

apiVersion: sluice.bino.bi/v1alpha1
kind: RowFilterPolicy
metadata:
  name: filter-tenant
  priority: 80
spec:
  match:
    any:
      - resources:
          catalogs: ["shop"]
          schemas: ["main"]
          tables: ["customers", "orders"]
  combine: restrictive
  filter:
    predicate:
      column: tenant_id
      op: Equals
      value: "{{ subject.tenantId }}"

This API key belongs to tenant acme.

curl -s http://localhost:8080/v1/query \
  -H "X-Api-Key: sl_demo_hello.world" \
  -H "Content-Type: application/json" \
  -d '{"sql": "SELECT id, name, tenant_id FROM shop.main.customers ORDER BY id"}'

The table holds five customers. Sluice returns only the two acme rows.

{
  "query_id": "<query-id>",
  "columns": ["id", "name", "tenant_id"],
  "rows": [
    [1, "Alice", "acme"],
    [2, "Bob", "acme"]
  ],
  "row_count": 2,
  "truncated": false
}

What you can do

Where to start