Skip to content

๐Ÿ›ก๏ธ Dagster AuthKit

Python Version Build Status License Coverage PyPI Version GitHub Repo stars Downloads 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 v1.0.0

โ˜ธ๏ธ Helm Chart

  • Production-ready Kubernetes chart under helm/dagster-authkit/, synced with the application's config (env vars, secrets, image tag) and versioned automatically on each release.

๐Ÿ”„ Automated CHANGELOG

  • CHANGELOG.md is now auto-generated on each release, alongside the version bump.
  • RBAC deny-by-default โ€” unknown GraphQL mutations require ADMIN by default.

๐Ÿ” Hardening & Fixes

  • Rebuild of the fix backlog from v0.4.2 across CSRF (per-client double-submit), fail-closed GraphQL batches, token-gated /auth/metrics, Redis 6-compatible atomic rate limiting, LDAP connection cleanup, session revoked-token caps, and detection-layer Starlette Middleware.cls compatibility.
  • Test coverage boosted 44% โ†’ 52% (+98 tests: detection layer, rate limiter, metrics gate, CookieBackend, CLI, LDAP, middleware).

โš ๏ธ 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)

The chart is published as an OCI artifact on GHCR, together with the container image:

helm upgrade --install dagster-authkit oci://ghcr.io/maltzsama/charts/dagster-authkit \
  --set authkit.secretKey="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" \
  --set authkit.adminPassword="your-admin-password"

See the chart README for configuration and examples.


๐Ÿ” 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.


๐Ÿ”’ LDAP TLS options

Variable Default Description
DAGSTER_AUTH_LDAP_USE_TLS false Use LDAPS.
DAGSTER_AUTH_LDAP_CA_CERT โ€“ CA bundle used to verify the server certificate. Without it the certificate is not verified (a warning is logged).
DAGSTER_AUTH_LDAP_TLS_VALID_NAMES โ€“ Comma-separated exact certificate identities (hostnames) to accept in the server certificate, in addition to the host in LDAP_SERVER. Use this when connecting through a TCP proxy or a Kubernetes service name that the directory's certificate does not contain. These are expected hostnames, not a way to disable hostname verification โ€” * is rejected, since ldap3 treats it as a wildcard that bypasses verification entirely. Only applies when CA_CERT is set.
DAGSTER_AUTH_LDAP_NO_TLS_V1_3 false Opt-in compatibility workaround for confirmed TLS 1.3 handshake failures: set to true to disable TLS 1.3 specifically. Only enable it if you've confirmed the handshake fails with TLS 1.3 and succeeds once it's disabled โ€” SSL: UNEXPECTED_EOF_WHILE_READING is one possible symptom but is not specific to TLS 1.3. The remaining allowed protocol policy still comes from the underlying SSL context/runtime, not from this flag.

๐Ÿท๏ธ Run attribution

Opt-in. When enabled, runs and backfills launched through the UI or the GraphQL API via one of the mutations below are tagged with the logged-in user, e.g. authkit/user=jdoe, so you can see who launched a run in its tags and filter runs by tag.

This is attribution for launches covered by AuthKit, not a complete or immutable audit trail: coverage is limited to the mutations listed below, a tag is a mutable run attribute that anyone with run-edit access could change afterwards, and runs started by schedules or sensors have no AuthKit user to attribute (see Limitations).

Variable Default
DAGSTER_AUTH_RUN_TAGS_ENABLED false Set to true to turn attribution on
DAGSTER_AUTH_RUN_TAG_USER_KEY authkit/user Tag key. Kept outside the dagster/ namespace Dagster reserves for its own tags

This works with every backend, not only LDAP.

How it works. The middleware already parses every POST /graphql body for RBAC. For the mutations that create runs, it adds the tag to the request before Dagster sees it. It uses only the public GraphQL schema, so nothing inside Dagster is patched. These mutations are covered:

Mutation Where the tag goes
launchRun, launchPipelineExecution executionParams.executionMetadata.tags
launchMultipleRuns each entry of executionParamsList
launchRunReexecution, launchPipelineReexecution executionParamsโ€ฆtags or reexecutionParams.extraTags
launchPartitionBackfill backfillParams.tags

Arguments given inline in the query, through variables, or mixed, are all handled, as are fragments, aliases and variable defaults.

Security properties - A tag with the same key sent by the client is removed first, so users cannot attribute a run to somebody else. - If a launch request cannot be tagged safely (unexpected shape), it is rejected with 400 instead of letting an unattributed run through. - RBAC is checked before tagging, so a user without launch permission is refused as before. - Dagster does not accept mutations over its WebSocket endpoint, so the HTTP path is the only one to cover.

Limitations. This is attribution for the launches AuthKit covers, not a complete or immutable audit trail โ€” treat it as a convenience for "who launched this", not as evidence that would hold up under tampering. - This only covers runs launched through AuthKit's middleware, i.e. POST /graphql requests it authenticates and rewrites. Runs created directly via the Dagster Python API (e.g. instance.submit_run, job.execute_in_process), by dagster-daemon schedules and sensors, or through any other path that reaches Dagster without going through that middleware have no AuthKit session to attribute, so they are not tagged. - Re-executing a backfill (reexecutePartitionBackfill) keeps the tags of the original backfill. - On re-execution the new user replaces the parent run's authkit/user tag because Dagster applies extraTags last. This was verified on Dagster 1.13; it relies on that ordering. - The tag is a mutable run attribute: anyone with run-edit access in Dagster can change or remove it after the fact, so don't rely on it where tamper-evidence matters. - The default tag key, authkit/user, is deliberately outside the dagster/ namespace Dagster reserves for its own tags. If you override DAGSTER_AUTH_RUN_TAG_USER_KEY back into that namespace, you take on the risk of colliding with a current or future Dagster-owned tag. - Only tested against the Dagster versions in CI; if you run a Dagster version near the edges of the supported range (dagster>=1.10.8,<2.0.0), verify attribution still works after upgrading, since it depends on the shape of Dagster's GraphQL schema.


๐Ÿ“ฆ 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
---

๐Ÿค– Service Token (API clients)

Non-interactive clients that poll /graphql (Prometheus exporters, CI scripts) cannot go through the login form. Set a static service token to let them authenticate with a header instead:

export DAGSTER_AUTH_SERVICE_TOKEN=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')
Env var Default Purpose
DAGSTER_AUTH_SERVICE_TOKEN unset Shared secret (min 32 chars). Feature is off when unset.
DAGSTER_AUTH_SERVICE_TOKEN_HEADER Dagster-Cloud-Api-Token Header carrying the token.
DAGSTER_AUTH_SERVICE_TOKEN_ROLE VIEWER Role granted to the token.
DAGSTER_AUTH_SERVICE_TOKEN_USER service-token Username shown in audit logs.
curl -H "Dagster-Cloud-Api-Token: $DAGSTER_AUTH_SERVICE_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"query": "{ version }"}' https://dagster.yourcompany.com/graphql

The token goes through the same RBAC as any user, so a VIEWER token can run queries but every mutation is denied and audit-logged. It is a static, non-expiring credential: keep it at VIEWER unless the client really needs more. Session backends only (ignored in proxy mode); WebSocket subscriptions remain cookie-only.


๐Ÿ› ๏ธ 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 (v1.0.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
  • โœ… Helm chart for Kubernetes deployments
  • โœ… 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
  • โœ… Token-protected /auth/metrics
  • โœ… Service token for non-interactive API clients
  • โœ… Automated CHANGELOG.md generation

Next

  • ๐Ÿ”„ 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+".