Skip to content

Commit dab783f

Browse files
authored
Don't let webserver run with dangerous config (apache#12747)
1 parent cba8d62 commit dab783f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

airflow/cli/commands/webserver_command.py

+13
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,19 @@ def webserver(args):
317317
"""Starts Airflow Webserver"""
318318
print(settings.HEADER)
319319

320+
# Check for old/insecure config, and fail safe (i.e. don't launch) if the config is wildly insecure.
321+
if conf.get('webserver', 'secret_key') == 'temporary_key':
322+
from rich import print as rich_print
323+
324+
rich_print(
325+
"[red][bold]ERROR:[/bold] The `secret_key` setting under the webserver config has an insecure "
326+
"value - Airflow has failed safe and refuses to start. Please change this value to a new, "
327+
"per-environment, randomly generated string, for example using this command `[cyan]openssl rand "
328+
"-hex 30[/cyan]`",
329+
file=sys.stderr,
330+
)
331+
sys.exit(1)
332+
320333
access_logfile = args.access_logfile or conf.get('webserver', 'access_logfile')
321334
error_logfile = args.error_logfile or conf.get('webserver', 'error_logfile')
322335
access_logformat = args.access_logformat or conf.get('webserver', 'access_logformat')

0 commit comments

Comments
 (0)