Skip to content

Commit

Permalink
Don't let webserver run with dangerous config (#12747)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashb authored Dec 2, 2020
1 parent cba8d62 commit dab783f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions airflow/cli/commands/webserver_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ def webserver(args):
"""Starts Airflow Webserver"""
print(settings.HEADER)

# Check for old/insecure config, and fail safe (i.e. don't launch) if the config is wildly insecure.
if conf.get('webserver', 'secret_key') == 'temporary_key':
from rich import print as rich_print

rich_print(
"[red][bold]ERROR:[/bold] The `secret_key` setting under the webserver config has an insecure "
"value - Airflow has failed safe and refuses to start. Please change this value to a new, "
"per-environment, randomly generated string, for example using this command `[cyan]openssl rand "
"-hex 30[/cyan]`",
file=sys.stderr,
)
sys.exit(1)

access_logfile = args.access_logfile or conf.get('webserver', 'access_logfile')
error_logfile = args.error_logfile or conf.get('webserver', 'error_logfile')
access_logformat = args.access_logformat or conf.get('webserver', 'access_logformat')
Expand Down

0 comments on commit dab783f

Please sign in to comment.