Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change expose_hostname default to false #29547

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ webserver:
version_added: 1.10.8
type: string
example: ~
default: "True"
default: "False"
expose_stacktrace:
description: |
Expose stacktrace in the web server
Expand Down
2 changes: 1 addition & 1 deletion airflow/config_templates/default_airflow.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ access_logformat =
expose_config = False

# Expose hostname in the web server
expose_hostname = True
expose_hostname = False

# Expose stacktrace in the web server
expose_stacktrace = False
Expand Down
2 changes: 1 addition & 1 deletion airflow/www/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def decorated(*args, **kwargs):
render_template(
"airflow/no_roles_permissions.html",
hostname=get_hostname()
if conf.getboolean("webserver", "EXPOSE_HOSTNAME", fallback=True)
if conf.getboolean("webserver", "EXPOSE_HOSTNAME")
else "redact",
logout_url=appbuilder.get_url_for_logout,
),
Expand Down
2 changes: 1 addition & 1 deletion airflow/www/extensions/init_jinja_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def init_jinja_globals(app):
if not default_ui_timezone:
default_ui_timezone = server_timezone

expose_hostname = conf.getboolean("webserver", "EXPOSE_HOSTNAME", fallback=True)
expose_hostname = conf.getboolean("webserver", "EXPOSE_HOSTNAME")
hostname = get_hostname() if expose_hostname else "redact"

try:
Expand Down
12 changes: 4 additions & 8 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,7 @@ def not_found(error):
return (
render_template(
"airflow/error.html",
hostname=get_hostname()
if conf.getboolean("webserver", "EXPOSE_HOSTNAME", fallback=True)
else "redact",
hostname=get_hostname() if conf.getboolean("webserver", "EXPOSE_HOSTNAME") else "redact",
status_code=404,
error_message="Page cannot be found.",
),
Expand All @@ -581,9 +579,7 @@ def method_not_allowed(error):
return (
render_template(
"airflow/error.html",
hostname=get_hostname()
if conf.getboolean("webserver", "EXPOSE_HOSTNAME", fallback=True)
else "redact",
hostname=get_hostname() if conf.getboolean("webserver", "EXPOSE_HOSTNAME") else "redact",
status_code=405,
error_message="Received an invalid request.",
),
Expand All @@ -599,10 +595,10 @@ def show_traceback(error):
python_version=sys.version.split(" ")[0] if g.user.is_authenticated else "redact",
airflow_version=version if g.user.is_authenticated else "redact",
hostname=get_hostname()
if conf.getboolean("webserver", "EXPOSE_HOSTNAME", fallback=True) and g.user.is_authenticated
if conf.getboolean("webserver", "EXPOSE_HOSTNAME") and g.user.is_authenticated
else "redact",
info=traceback.format_exc()
if conf.getboolean("webserver", "EXPOSE_STACKTRACE", fallback=True) and g.user.is_authenticated
if conf.getboolean("webserver", "EXPOSE_STACKTRACE") and g.user.is_authenticated
else "Error! Please contact server admin.",
),
500,
Expand Down
3 changes: 3 additions & 0 deletions newsfragments/29547.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Default for ``[webserver] expose_hostname`` changed to ``False``

The default for ``[webserver] expose_hostname`` has been set to ``False``, instead of ``True``. This means administrators must opt-in to expose webserver hostnames to end users.