Skip to main content

๐Ÿ›ก๏ธ Dagster AuthKit

Python Version Build Status License Coverage PyPI Version Downloads

Community authentication wrapper for self-hosted Dagster OSS.

Authentication, RBAC, and Audit logs for Dagster without touching internal code.


๐ŸŽฏ What is this?

Dagster OSS has no auth. If you run it in a VPC or locally, anyone with the URL has full admin access.

AuthKit solves this by wrapping the dagster-webserver command to add:

  • โœ… Login Interface: Simple username/password flow.
  • โœ… RBAC (4 Levels): Granular control over who can do what.
  • โœ… Audit Logs: JSON logs for monitoring who is doing what.
  • โœ… Multi-Backend: Works with SQLite, Postgres, MySQL (via Peewee ORM) and Redis.

No code changes required. You don't touch your repository.py or dagster.yaml.


โœจ What's New in v0.4.0

๐Ÿ” Security Hardening (Breaking Changes)

  • SECRET_KEY is now required in production. The server will refuse to start if DAGSTER_AUTH_SECRET_KEY is not set and DAGSTER_AUTH_ENV=production. Auto-generated keys caused silent session breakage in multi-pod deployments.
  • Proxy mode now requires trusted IPs. Set DAGSTER_AUTH_PROXY_TRUSTED_IPS (comma-separated) or explicitly opt into the insecure default with DAGSTER_AUTH_PROXY_TRUST_ALL=true.
  • RBAC is now deny-by-default for unknown mutations. New GraphQL mutations added by future Dagster releases require ADMIN role until explicitly audited. Configure via DAGSTER_AUTH_UNKNOWN_MUTATION_ROLE.

๐Ÿ”„ Cross-Pod Session Revocation

  • DB-backed session_version column. change_password, change_role, and delete_user now invalidate sessions across ALL pods without Redis. A new session_version column is automatically added to existing databases on upgrade.
  • Dual rate-limiting (username + IP). Prevents both credential stuffing and brute-force on a single account.

๐Ÿ›ก๏ธ Attack Surface Reduction

  • CSRF protection on the login form (double-submit signed cookie).
  • WebSocket authentication โ€” GraphQL subscriptions at /graphql are now authenticated (pure ASGI middleware).
  • XSS prevention in login and 403 pages via HTML escaping.
  • Open redirect hardening โ€” protocol-relative URLs (//evil.com) are blocked.
  • Empty password rejection across all backends (prevents unauthenticated LDAP binds).

๐Ÿ—๏ธ Core Improvements

  • operationName support in GraphQL RBAC. Clients sending multiple operations in one document no longer trigger false-positive blocks.
  • Backend instance caching. Backend connections are reused across requests instead of being recreated per call.
  • Unified role serialization. to_dict() now uses role.value (int) for cross-backend consistency.

โš ๏ธ Upgrading from v0.3.x

  1. Set DAGSTER_AUTH_SECRET_KEY in your environment. Generate one with:
    python -c 'import secrets; print(secrets.token_urlsafe(32))'
    
  2. If using proxy mode, set DAGSTER_AUTH_PROXY_TRUSTED_IPS to your proxy's IP address.
  3. Database migration happens automatically on first boot โ€” no manual steps needed for SQLite/Postgres/MySQL. A session_version column is added to the users table.
  4. Role serialization changed from string ("ADMIN") to int (40) in session cookies. Existing sessions continue to work (backward-compatible from_dict).

๐Ÿ“‚ Ready-to-Run Examples

We provide ready-to-use stacks for different scenarios in the examples/ directory:

examples
โ”œโ”€โ”€ authelia              # NEW! Authelia + Caddy + LDAP SSO (Docker)
โ”‚   โ”œโ”€โ”€ Makefile
โ”‚   โ”œโ”€โ”€ docker-compose.yml
โ”‚   โ”œโ”€โ”€ Caddyfile
โ”‚   โ””โ”€โ”€ authelia/
โ”œโ”€โ”€ kubernetes            # NEW! Minikube deployment
โ”‚   โ”œโ”€โ”€ Makefile
โ”‚   โ””โ”€โ”€ k8s/
โ”œโ”€โ”€ ldap                  # Active Directory integration (**Experimental**)
โ”‚   โ”œโ”€โ”€ Makefile
โ”‚   โ”œโ”€โ”€ docker-compose.yml
โ”‚   โ””โ”€โ”€ ldap-bootstrap.ldif
โ”œโ”€โ”€ postgresql_redis      # Recommended production setup
โ”‚   โ”œโ”€โ”€ Makefile
โ”‚   โ””โ”€โ”€ docker-compose.yml
โ””โ”€โ”€ quickstart-sqlite     # Simple local testing
    โ”œโ”€โ”€ Makefile
    โ””โ”€โ”€ docker-compose.yml

How to run

Pick a scenario, go into the folder, and check the Makefile.

1. Authelia SSO (Docker) Complete SSO with Authelia, Caddy, and OpenLDAP:

cd examples/authelia
make up
# Access: https://auth.company.com (admin/password123)
# Then:   https://dagster.company.com

2. Kubernetes (Minikube) Same stack running on Kubernetes:

cd examples/kubernetes
make build  # Build the Docker image inside Minikube
make up     # Deploy everything
# In another terminal: make connect (runs minikube tunnel)
# Add to /etc/hosts: $(minikube ip) auth.company.com dagster.company.com

3. Standard Setup (Postgres + Redis)

cd examples/postgresql_redis
make up

4. Local Quickstart (SQLite)

cd examples/quickstart-sqlite
make up

5. LDAP/AD Testing โš ๏ธ EXPERIMENTAL

cd examples/ldap
make up

๐Ÿš€ Manual Installation (Python)

If you aren't using Docker, you can install via pip.

# For local testing (SQLite)
pip install dagster-authkit[sqlite]

# For server usage (Postgres + Redis recommended)
pip install dagster-authkit[postgresql,redis]

# For LDAP/Active Directory integration (**Experimental**)
pip install dagster-authkit[ldap]

Usage:

# Initialize the database and create the first admin
dagster-authkit init-db --with-admin

# Run Dagster (replaces the standard 'dagster-webserver' command)
dagster-authkit -f your_pipeline.py -h 0.0.0.0 -p 3000

# For proxy mode (Authelia/OAuth2 Proxy)
export DAGSTER_AUTH_BACKEND=proxy
export DAGSTER_AUTH_PROXY_LOGIN_URL=https://auth.yourcompany.com
dagster-authkit -f your_pipeline.py -h 0.0.0.0 -p 3000

โ˜ธ๏ธ Helm (Kubernetes)

Deploy on Kubernetes via the Helm chart in helm/dagster-authkit/:

helm upgrade --install dagster-authkit ./helm/dagster-authkit \
  --set image.tag="$(git describe --tags --abbrev=0)" \
  --set authkit.secretKey="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" \
  --set authkit.adminPassword="your-admin-password"

See values.yaml for all configuration options.


๐Ÿ” Roles (RBAC)

We provide 4 levels of access. Permissions are enforced via GraphQL query analysis.

Role Description
Admin Full access. Can manage users, settings, and all pipelines.
Editor Can modify assets and codebase (if allowed) and manage runs.
Launcher Can launch runs and re-execute jobs, but cannot modify code/assets.
Viewer Read-only. Can view runs and assets. GraphQL mutations are blocked.

How it works: AuthKit analyzes GraphQL queries using the official GraphQL parser to accurately identify mutations and block unauthorized actions.


๐Ÿ“ฆ Backends

Backend Implementation Status Use Case
SQLite Peewee ORM Stable Local / Simple. Single instance only.
PostgreSQL Peewee + psycopg2 Stable Production. Recommended for Docker/K8s.
MySQL/MariaDB Peewee + mysql-connector Stable Production.
Redis Native redis Stable Session Storage + Distributed Rate Limiting.
LDAP ldap3 library Experimental Active Directory / OpenLDAP. Community maintained.
Proxy Header-based Stable Authelia, OAuth2 Proxy, Traefik, Caddy.
OpenID Connect Header-based Experimental AuthKit supports OIDC providers (Google, GitHub, Okta, Keycloak) via Authelia

๐Ÿ› ๏ธ CLI Management

Manage users directly from the shell. Useful for CI/CD or admin tasks.

# Create a new launcher
dagster-authkit add-user bob --launcher

# Reset password
dagster-authkit change-password bob

# List everyone
dagster-authkit list-users

# View RBAC permissions matrix
dagster-authkit list-permissions

๐Ÿ”ฎ Roadmap

Current (v0.4.0)

  • โœ… Username/password auth (bcrypt)
  • โœ… 4-level RBAC (ADMIN/EDITOR/LAUNCHER/VIEWER)
  • โœ… SQLite, PostgreSQL, MySQL, Redis support
  • โœ… GraphQL mutation blocking with official AST parser
  • โœ… LDAP backend (experimental)
  • โœ… Proxy authentication (Authelia, Caddy, Traefik)
  • โœ… Kubernetes example with full SSO stack
  • โœ… Redis session revocation and rate limiting
  • โœ… Centralized UI templates
  • โœ… CSRF protection
  • โœ… Cross-pod session revocation (DB-backed session_version)
  • โœ… WebSocket authentication (GraphQL subscriptions)
  • โœ… Dual rate-limiting (username + IP)
  • โœ… Proxy trusted IP allowlist

Next

  • โ˜ธ๏ธ Helm chart for Kubernetes deployments (preview โ€” available in helm/)
  • ๐Ÿ”„ OIDC backend (beyond proxy mode)

What we will NOT do:

  • โŒ Inject React code into Dagster UI (too brittle)
  • โŒ Complex enterprise features (that's what Dagster+ is for)

๐Ÿค Contributing

Found a bug? Want to add a feature? Open a PR. If it works and keeps things simple, we'll merge it.

Especially needed:

  • People with Active Directory experience to validate the LDAP backend
  • Testing on different Dagster versions
  • Helm chart contributions

๐Ÿ“„ License

Apache 2.0 - see LICENSE


๐Ÿ™ Credits

Built by Demetrius Albuquerque because self-hosting Dagster shouldn't mean no auth.

Inspired by the community's need for a middle ground between "no auth" and "pay for Dagster+".

Download files

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

Source Distribution

dagster_authkit-1.0.0.tar.gz (117.8 kB view details)

Uploaded Source

Built Distribution

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

dagster_authkit-1.0.0-py3-none-any.whl (82.4 kB view details)

Uploaded Python 3

File details

Details for the file dagster_authkit-1.0.0.tar.gz.

File metadata

  • Download URL: dagster_authkit-1.0.0.tar.gz
  • Upload date:
  • Size: 117.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dagster_authkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b958c9ee6a2af0264d0f7b3724be590f4715623ddd7109d4a1b65821711464b4
MD5 fb6715a477a4313b59c59e2bbfb50792
BLAKE2b-256 7fd77f381a412fa7c1c97a72255eeadbcdba0de3b38d348007aff78425c6b978

See more details on using hashes here.

Provenance

The following attestation bundles were made for dagster_authkit-1.0.0.tar.gz:

Publisher: publish.yml on maltzsama/dagster-authkit

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

File details

Details for the file dagster_authkit-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dagster_authkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf4111b329628bfb2348157bb2c93007aaa0a619fcb69457c7c3ce8756293fa6
MD5 b2cc47d9722c7ad0e7a24517a67e5cd9
BLAKE2b-256 80eb7c344d419ecafe7ccb19bbd641d97d9738da326db4b15c953bbc2a0a1415

See more details on using hashes here.

Provenance

The following attestation bundles were made for dagster_authkit-1.0.0-py3-none-any.whl:

Publisher: publish.yml on maltzsama/dagster-authkit

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

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

Supported by

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