Safeguard
Security Guides•

How do you secure an Airflow Git Dag bundle? A short checklist

A checklist for Airflow Git Dag bundles: tracking refs, versioning, credentials in connections not kwargs, config exposure, and who can push to the branch.

Safeguard Security Team
3 min read

Secure an Airflow Git Dag bundle by protecting the branch Airflow tracks, keeping repository credentials in a connection instead of bundle settings, and leaving versioning on so every run records its commit. Whoever can push to the tracked ref can run code on your workers.

What a Dag bundle is

The Airflow docs define a Dag bundle as a collection of one or more Dags plus their supporting files. A local bundle points at a directory and does not support versioning, so tasks always run the latest code. A Git bundle fetches Dags from a repository and does support versioning.

A Git bundle is configured with a tracking reference, which can be a branch, a tag or a commit SHA. Optional settings include a connection id for credentials, a repository URL, a subdirectory and sparse directories.

Why it is a security boundary

Dag files run as code. The Airflow security model says Airflow does not sandbox Dag author code. So the tracked ref is effectively a deployment pipeline: a push to it becomes code execution on your workers after the next refresh.

Checklist

  1. Protect the tracked branch. Require pull request review, restrict force pushes, and limit who can merge.
  2. Consider tracking a tag or commit for production, so changes need a deliberate promotion rather than any merge.
  3. Keep versioning enabled. The docs say each Dag run records the Git commit it was created with, so a rerun can use the exact same code. Disabling bundle versioning removes that trail.
  4. Do not put credentials in bundle settings. The docs say to use a connection and a secrets backend instead.
  5. Mind config exposure. Bundle settings are exposed through the config API when config exposure is enabled, and anyone who can read the config sees those values verbatim.
  6. Narrow the checkout. Use the subdirectory or sparse directory settings so the processor sees only what it needs.
  7. Use a deploy credential with read only scope, tied to a service identity rather than a person's account.
  8. Decide the refresh interval deliberately. A short interval speeds up mistakes as well as fixes.
  9. Scan the repository for dependency changes and committed secrets in your normal review flow.
  10. Check impersonation settings. If you use run as user, the docs say shared group permissions and an appropriate umask are needed, and describe this as a temporary approach.

Dev versus production

Local bundles are fine for development. In production, a local directory without versioning means no record of which code ran. Prefer a versioned Git bundle.

Quick check

Where should the repository token live?

In an Airflow connection referenced by the bundle, with a secrets backend. The docs say not to put credentials in bundle settings.

Does a Git bundle record what code ran?

Yes, when versioning is on. Each Dag run records its commit.

Safeguard policies and gates can check dependency changes in a Dag repository on each pull request. Try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.