vincbeck commented on code in PR #40894:
URL: https://github.com/apache/airflow/pull/40894#discussion_r1684707710
##########
airflow/__main__.py:
##########
@@ -55,6 +55,17 @@ def main():
conf = write_default_airflow_configuration_if_needed()
if args.subcommand in ["webserver", "internal-api", "worker"]:
write_webserver_configuration_if_needed(conf)
+ if conf.getboolean("core", "database_access_isolation", fallback=False):
+ if args.subcommand in ["worker", "dag-processor", "triggerer", "run"]:
+ if "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN" in os.environ:
+ # make sure that the DB is not available for the components
that should not access it
+ del os.environ["AIRFLOW__DATABASE__SQL_ALCHEMY_CONN"]
+ conf.set("database", "sql_alchemy_conn", "none://")
+ else:
+ from airflow.api_internal.internal_api_call import
InternalApiConfig
Review Comment:
nit
```suggestion
else:
# Trusted components
from airflow.api_internal.internal_api_call import
InternalApiConfig
```
##########
airflow/__main__.py:
##########
@@ -55,6 +55,17 @@ def main():
conf = write_default_airflow_configuration_if_needed()
if args.subcommand in ["webserver", "internal-api", "worker"]:
write_webserver_configuration_if_needed(conf)
+ if conf.getboolean("core", "database_access_isolation", fallback=False):
+ if args.subcommand in ["worker", "dag-processor", "triggerer", "run"]:
+ if "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN" in os.environ:
Review Comment:
nit
```suggestion
if args.subcommand in ["worker", "dag-processor", "triggerer",
"run"]:
# Untrusted components
if "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN" in os.environ:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]