Skip to main content

Access control for DuckLake lakehouses

Project description

ducklake-guard

Experimental — ducklake-guard is under active development. It works, but has not been audited. Review carefully before using in sensitive or production environments.

PyPI CI License: MIT Python 3.12+ Ruff DuckDB DuckLake Hetzner Cloud

Per-table access control for DuckLake lakehouses on Hetzner Cloud. A single CLI manages S3 bucket policies, Postgres catalog visibility (RLS), and catalog roles, with an audit log.

[!NOTE] I'll add AWS and Scaleway, make sure to follow the repo for any updates.

Installation

pip install ducklake-guard

Or with uv:

uv pip install ducklake-guard

From source:

pip install git+https://github.com/berndsen-io/ducklake-guard.git

System overview

graph LR
    DGA["dga CLI"]
    PG_GUARD["ducklake_guard DB<br/>(source of truth)"]
    PG_CATALOG["ducklake_catalog DB<br/>(RLS + roles)"]
    S3["Hetzner S3<br/>(bucket policy)"]

    DGA -->|manages grants| PG_GUARD
    DGA -->|pushes RLS + roles| PG_CATALOG
    DGA -->|pushes bucket policy| S3

Prerequisites

  • Hetzner server, PostgreSQL, Object Storage bucket. Recommendation, auto deploy with ducklake-hetzner.
  • S3 credentials for each user, created manually in the Hetzner Console (no API exists for credential lifecycle)
  • SSH access to the PostgreSQL server (for dga init)

Quick start

dga env > .env
# Fill in credentials

dga init                          # create guard DB, schema, enable RLS

dga user create tim \
  --access-key <KEY> \
  --project-id <PID>              # register user, create catalog role

dga allow tim --table customer --read-only
dga allow tim --table orders --read-write

duckdb -init init-tim.sql         # verify: SHOW TABLES, SELECT, INSERT

dga deny tim --table orders       # revoke access
dga user delete tim               # remove user, scrub policies, drop role

CLI quick reference

Command Description
dga init Create guard DB, schema, pg_hba, enable RLS
dga user create <name> Register user + S3 creds, create catalog role
dga user delete <name> Remove user, scrub policies, drop role
dga allow <user> --table T Grant read-only or read-write access
dga deny <user> --table T Revoke table access
dga sync Converge S3 + RLS to match grant state

Documentation

  • Architecture: enforcement layers, transaction flow, sync convergence, module dependencies
  • Usage: setup, user management, granting and revoking access, DuckDB verification
  • Schema: database tables, generated columns, composite keys
  • Design decisions: why separate Hetzner projects, RLS limitations, policy size bundling
  • Development: running tests, linting, pre-commit checklist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ducklake_guard-0.1.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ducklake_guard-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file ducklake_guard-0.1.0.tar.gz.

File metadata

  • Download URL: ducklake_guard-0.1.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ducklake_guard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f63378318902d1986429cee9f1cd590bf5c2f7f459352fc4ad1cbf007b1f11ca
MD5 cff6e2436a63862673e78dde5db3c2f0
BLAKE2b-256 f40f2a04221855ebaf6f6c4be48a261fa994f2dc1e998625cb9bdddc6115ee5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ducklake_guard-0.1.0.tar.gz:

Publisher: publish.yml on berndsen-io/ducklake-guard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ducklake_guard-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ducklake_guard-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ducklake_guard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca65ff1e204cdf698f28c478fbc530b441902b74422bc81e5a17183d835a973f
MD5 de9fe27483bf2c849df4becbf44cf51d
BLAKE2b-256 d32dec830ce337630a49fffb37bd3c4521a9d6f370c155bc8c4c9252c8d3de56

See more details on using hashes here.

Provenance

The following attestation bundles were made for ducklake_guard-0.1.0-py3-none-any.whl:

Publisher: publish.yml on berndsen-io/ducklake-guard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page