Skip to content

Commit

Permalink
Improve diagnostics message when users have secret_key misconfigured
Browse files Browse the repository at this point in the history
Recently fixed log open-access vulnerability have caused
quite a lot of questions and issues from the affected users who
did not have webserver/secret_key configured for their workers
(effectively leading to random value for those keys for workers)

This PR explicitly explains the possible reason for the problem and
encourages the user to configure their webserver's secret_key
in both - workers and webserver.

Related to: #17251 and a number of similar slack discussions.
  • Loading branch information
potiuk committed Aug 4, 2021
1 parent a10eb61 commit d5d9413
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions airflow/utils/log/file_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from typing import TYPE_CHECKING, Optional

import httpx
from httpx import HTTPStatusError
from itsdangerous import TimedJSONWebSignatureSerializer

from airflow.configuration import AirflowConfigException, conf
Expand Down Expand Up @@ -186,6 +187,11 @@ def _read(self, ti, try_number, metadata=None):
)
response.encoding = "utf-8"

if response.status_code == 403:
log += "*** !!!! Please make sure that all your webservers and workers have" \
" the same 'secret_key' configured in 'webserver' section !!!!!\n***"
log += "*** See more at https://airflow.apache.org/docs/apache-airflow/" \
"stable/configurations-ref.html#secret-key\n***"
# Check if the resource was properly fetched
response.raise_for_status()

Expand Down

0 comments on commit d5d9413

Please sign in to comment.