Safeguard
Security Guides•

Who can run code in Apache Airflow, and who should you trust with it?

Airflow treats Dag authors as trusted to run arbitrary code. Learn the roles in its security model and what that means for who may commit Dags.

Safeguard Security Team
3 min read

In Apache Airflow, Dag authors can run arbitrary code, and Airflow does not check or sandbox it. The security model treats them as trusted. So the practical answer is that whoever can merge a Dag file can run code on your workers, so protect your Dag repository like production code.

The roles in Airflow's security model

The Airflow documentation describes several roles:

  • Deployment Managers install and configure Airflow and control its permissions. The docs say they can potentially delete the entire installation and have access to all credentials.
  • Dag authors write and change Dag files. The docs say that code is neither verified, checked nor sand-boxed by Airflow. They can also see and modify every Dag, with no per-Dag restriction.
  • Authenticated UI users have power depending on their role, from admins down to read only viewers. A connection configuration role can write credentials but not read them, and Airflow 3 masks sensitive values at the API level.
  • Unauthenticated users are not supported by default, apart from the health and login endpoints.

Where Dag code runs

ComponentWho controls the codeNote from the docs
Local executorDag authorsRuns on the scheduler machine and can affect the whole installation
Celery workersDag authorsTasks on the same worker can influence each other unless queues are separated
Kubernetes podsDag authorsEach task gets its own pod, so tasks are isolated
TriggererDag authorsOne shared instance by default
Dag File ProcessorDag authorsParses Dag files and has direct metadata database access
Scheduler and API serverShould not run Dag author codeThe docs say no Dag author code should ever run there

Limits worth knowing

Workers use the Execution API and do not receive database credentials. The docs say the Dag File Processor and Triggerer have software guards against accidental database access, but these do not stop a malicious Dag author, since they run as the same Unix user. Execution API tokens do not carry per Dag authorization, so a running task can reach state changing endpoints for any Dag. Multi team mode is described as experimental and still shares signing keys, connections and variables.

What to do with this

  1. Gate the Dag repository. Require pull request review and branch protection for the branch Airflow reads.
  2. Keep the author group small and review membership regularly.
  3. Isolate where you can. Per task pods give isolation that a shared Celery worker does not.
  4. Do not rely on the UI roles to contain a Dag author. They are a different trust level.
  5. Separate environments. Do not let a team with a test deployment share secrets with production.
  6. Scan Dag dependencies, since Dag code imports libraries from your image. See Airflow providers and updates.

Quick check

Is Airflow a sandbox for untrusted Dag code?

No. The docs say Dag code is not verified, checked or sandboxed. Use Dag authors you trust.

Does read only UI access protect against a Dag author?

No. UI roles are a separate matter. A Dag author's power comes from code that executes in Airflow components.

Safeguard policies can gate changes to dependency files in pull requests, which helps when Dag authors add libraries. 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.