How to Integrate Dagster and Firestore Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use dagster and firestore together to run scheduled data jobs on document stores. Dagster orchestrates the pipeline runs while Firestore holds the live app records. This pairing lets data teams pull user events or push fresh scores back to the app. Still, linking an orchestrator to a live database brings real security risks. A bad script or a leaked key can wipe out production collections fast. You need clear rules for keys, roles, and logs before you run your first job. How dagster and

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use dagster and firestore together to run scheduled data jobs on document stores. Dagster orchestrates the pipeline runs while Firestore holds the live app records.

This pairing lets data teams pull user events or push fresh scores back to the app. Still, linking an orchestrator to a live database brings real security risks. A bad script or a leaked key can wipe out production collections fast. You need clear rules for keys, roles, and logs before you run your first job.

How dagster and firestore share keys and move data

Dagster uses a resource object to talk to external databases during a pipeline run. When a job starts, the worker loads a cloud service account to log in. This service account tells Google Cloud which collections the worker can read or write.

Data flows between the two tools in two main ways. First, an asset job can read raw documents from Firestore for analytics. The worker pulls a batch of records, transforms them, and sends them to a warehouse. Second, a job can write processed data back into Firestore for the app to read.

You should never hardcode service account keys inside your pipeline code. Instead, store the key in a cloud secret store or use workload identity. Workload identity ties the Dagster worker pod directly to a specific cloud role. This approach removes static key files from your worker nodes and developer laptops.

Common risks with shared keys and broad roles

Many teams start by giving one broad service account to the entire Dagster deployment. That single account often gets full read and write rights across all Firestore collections. If one pipeline has a bug, it can overwrite critical app tables by mistake. Worse, anyone who can run a job in Dagster inherits those broad database rights.

Shared accounts also ruin your audit logs during an incident check. When every job uses the same identity, cloud logs only show that one service account. You cannot tell which pipeline run or which engineer triggered a bad write. Unlogged queries also make it hard to spot large data exports until it is too late.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Sensitive user fields inside documents create another big risk for data teams. Firestore collections often hold emails, phone numbers, card numbers, or national IDs. When a pipeline pulls full documents for testing, that sensitive data lands in staging logs. Masking rules help here by rewriting matched fields in results before they leave the source.

Scoping roles and network paths for production jobs

Start by breaking your one shared account into smaller, job-specific roles. Give analytics read jobs a role that can only read specific collections. Give write-back jobs a separate role that only updates the exact target collection. Never let a staging worker use a role that touches production data.

Next, lock down the network path between your Dagster workers and Google Cloud. Run your workers inside a private subnet with strict outbound traffic rules. Use Private Google Access so database traffic stays on the cloud provider network. This setup stops outside networks from reaching your workers or stealing active tokens.

Finally, turn on data access audit logs for your Firestore project. Make sure your team logs both read and write operations for critical collections. Link those database logs with your Dagster run IDs so you can trace every query.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How should Dagster workers log in to Firestore in production?

Use workload identity to bind your worker nodes to a cloud service account. This method avoids static JSON key files and rotates short-lived tokens for each run.

How do we stop a staging job from writing to live collections?

Run staging and production workers in separate cloud projects with distinct service roles. Give the staging role zero rights on the production Firestore project.

How can we protect user PII during pipeline runs?

Limit which fields your pipeline reads and apply data masking to rewrite emails or card numbers. Also make sure your Dagster compute logs do not print raw document payloads.

The query runs. The emails stay hidden.