Skip to content

Commit aab557b

Browse files
potiukamoghrajesh
andauthored
Clarify security model of Airflow (#61754)
* Clarify security model of Airflow There are some assumptions that security researchers and our users might have about security model of Airflow that do not hold true, but were not clearly spelled out in the model. This PR updates the security model with more clarity for those. * Apply suggestions from code review Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com> --------- Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
1 parent 1ceb7ed commit aab557b

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

airflow-core/docs/security/security_model.rst

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ Non-authenticated UI users
7878
..........................
7979

8080
Airflow doesn't support unauthenticated users by default. If allowed, potential vulnerabilities
81-
must be assessed and addressed by the Deployment Manager. However, there are exceptions to this. The ``/health`` endpoint responsible to get health check updates should be publicly accessible. This is because other systems would want to retrieve that information. Another exception is the ``/login`` endpoint, as the users are expected to be unauthenticated to use it.
81+
must be assessed and addressed by the Deployment Manager. However, there are exceptions to this.
82+
The ``/health`` endpoint responsible to get health check updates should be publicly accessible.
83+
This is because other systems would want to retrieve that information. Another exception is the
84+
``/login`` endpoint, as the users are expected to be unauthenticated to use it.
8285

8386
Capabilities of authenticated UI users
8487
--------------------------------------
@@ -109,7 +112,8 @@ Operations users
109112
................
110113

111114
The primary difference between an operator and admin is the ability to manage and grant permissions
112-
to other users, and access audit logs - only admins are able to do this. Otherwise assume they have the same access as an admin.
115+
to other users, and access audit logs - only admins are able to do this. Otherwise assume they have
116+
the same access as an admin.
113117

114118
Connection configuration users
115119
..............................
@@ -137,9 +141,12 @@ Those users should be highly trusted not to misuse this capability.
137141
About Sensitive information
138142
...........................
139143

140-
Sensitive information consists of connection details, variables, and configuration. In Airflow 3 and later versions, sensitive information will not be exposed to users via API, UI, ``airflowctl``.
141-
However, ``task-sdk`` still provides access to sensitive information (e.g., Use SDK API Client to get Variables with task-specific ``JWT`` token). Local CLI will only return keys except when using ``--show_values``.
142-
Sensitive information has been masked in logs, UI, and API outputs. In case of Dag author expose sensitive information in other way (e.g., via environment variables), those values will not be masked.
144+
Sensitive information consists of connection details, variables, and configuration. In versions later than Airflow 3.0
145+
sensitive information will not be exposed to users via API, UI, and ``airflowctl``.
146+
However, ``task-sdk`` still provides access to sensitive information (e.g., Use SDK API Client to get
147+
Variables with task-specific ``JWT`` token). Local CLI will only return keys except when using ``--show_values``.
148+
Sensitive information has been masked in logs, UI, and API outputs. In case of Dag author expose sensitive
149+
information in other way (e.g., via environment variables), those values will not be masked.
143150

144151
Audit log users
145152
...............
@@ -160,7 +167,8 @@ This role is suitable for users who require read-only access without the ability
160167

161168
Viewers also do not have permission to access audit logs.
162169

163-
For more information on the capabilities of authenticated UI users, see :doc:`apache-airflow-providers-fab:auth-manager/access-control`.
170+
For more information on the capabilities of authenticated UI users, see
171+
:doc:`apache-airflow-providers-fab:auth-manager/access-control`.
164172

165173
Capabilities of Dag authors
166174
---------------------------
@@ -172,7 +180,35 @@ code on the workers (part of Celery Workers for Celery Executor, local processes
172180
of Local Executor, Task Kubernetes POD in case of Kubernetes Executor), in the Dag Processor
173181
and in the Triggerer.
174182

175-
There are several consequences of this model chosen by Airflow, that deployment managers need to be aware of:
183+
Dag authors are responsible for the code they write and submit to Airflow, and they should be trusted to
184+
verify that what they implement is safe code that will not cause any harm to the Airflow installation and
185+
will not open way for security vulnerabilities. Since Dag Authors are writing Python code, they can easily write
186+
code that will access sensitive information stored in Airflow or send it outside - but also to open up new
187+
security vulnerabilities. Good example is writing a code that will pass non-sanitized UI user input (such as parameter,
188+
variables, connection configuration) to any code in Operators and Hooks, or third party libraries without properly
189+
sanitizing it first. This can open up windows for Remote Code Execution, Denial of Service vulnerabilities or similar.
190+
Dag authors should be trusted not to write such code and to verify that the code they write is safe and does
191+
not open new security vulnerabilities.
192+
193+
Limiting Dag Author access to subset of Dags
194+
--------------------------------------------
195+
196+
Airflow does not have multi-tenancy or multi-team features to provide isolation between different groups of users when
197+
it comes to task execution. While, in Airflow 3.0 and later, Dag Authors cannot directly access database and cannot run
198+
arbitrary queries on the database, they still have access to all Dags in the Airflow installation and they can
199+
modify any of those Dags - no matter which Dag the task code is executed for. This means that Dag authors can
200+
modify state of any task instance of any Dag, and there are no finer-grained access controls to limit that access.
201+
202+
There is a work in progress on multi-team feature in Airflow that will allow to have some isolation between different
203+
groups of users and potentially limit access of Dag authors to only a subset of Dags, but currently there is no
204+
such feature in Airflow and you can assume that all Dag authors have access to all Dags and can modify their state.
205+
206+
207+
Security contexts for Dag author submitted code
208+
-----------------------------------------------
209+
210+
There are several consequences of this model chosen by Airflow, that deployment managers need to be aware of in
211+
terms of how those capabilities of Dag authors map to executed code in different security contexts in Airflow:
176212

177213
Local executor
178214
..............
@@ -216,6 +252,7 @@ executed in the Scheduler or API Server process. This means the deployment manag
216252
needed for Dag bundles on the Scheduler and API Server - but the bundles must still be configured on those
217253
components.
218254

255+
219256
Allowing Dag authors to execute selected code in Scheduler and API Server
220257
.........................................................................
221258

0 commit comments

Comments
 (0)