Skip to content

Commit dafd166

Browse files
authored
Use different default algorithms for different werkzeug versions (#46384)
Older werkzeug uses different algorithms for different versions - we should match the default algorithm for those versions.
1 parent 56fdc20 commit dafd166

File tree

1 file changed

+18
-6
lines changed
  • providers/fab/src/airflow/providers/fab/auth_manager/security_manager

1 file changed

+18
-6
lines changed

providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,24 @@ def _init_config(self):
839839
app.config.setdefault("AUTH_ROLES_MAPPING", {})
840840
app.config.setdefault("AUTH_ROLES_SYNC_AT_LOGIN", False)
841841
app.config.setdefault("AUTH_API_LOGIN_ALLOW_MULTIPLE_PROVIDERS", False)
842-
app.config.setdefault(
843-
"AUTH_DB_FAKE_PASSWORD_HASH_CHECK",
844-
"scrypt:32768:8:1$wiDa0ruWlIPhp9LM$6e409d093e62ad54df2af895d0e125b05ff6cf6414"
845-
"8350189ffc4bcc71286edf1b8ad94a442c00f890224bf2b32153d0750c89ee9"
846-
"401e62f9dcee5399065e4e5",
847-
)
842+
843+
from packaging.version import Version
844+
from werkzeug import __version__ as werkzeug_version
845+
846+
parsed_werkzeug_version = Version(werkzeug_version)
847+
if parsed_werkzeug_version < Version("3.0.0"):
848+
app.config.setdefault(
849+
"AUTH_DB_FAKE_PASSWORD_HASH_CHECK",
850+
"pbkdf2:sha256:150000$Z3t6fmj2$22da622d94a1f8118"
851+
"c0976a03d2f18f680bfff877c9a965db9eedc51bc0be87c",
852+
)
853+
else:
854+
app.config.setdefault(
855+
"AUTH_DB_FAKE_PASSWORD_HASH_CHECK",
856+
"scrypt:32768:8:1$wiDa0ruWlIPhp9LM$6e409d093e62ad54df2af895d0e125b05ff6cf6414"
857+
"8350189ffc4bcc71286edf1b8ad94a442c00f890224bf2b32153d0750c89ee9"
858+
"401e62f9dcee5399065e4e5",
859+
)
848860

849861
# LDAP Config
850862
if self.auth_type == AUTH_LDAP:

0 commit comments

Comments
 (0)