github-advanced-security[bot] commented on code in PR #77138:
URL: https://github.com/apache/airflow/pull/77138#discussion_r4580602683


##########
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -183,6 +185,31 @@
 }
 
 CACHE_TTL = conf.getint("fab", "cache_ttl", fallback=30)
+# A token is accepted only while this claim matches the user's current 
password fingerprint.
+PASSWORD_FINGERPRINT_CLAIM = "password_fingerprint"
+PASSWORD_FINGERPRINT_HEX_LENGTH = 32
+
+
+def _compute_password_fingerprint(user: User | AnonymousUser) -> str:
+    """
+    Return a fingerprint of the user's current password.
+
+    It changes whenever the password is changed or reset. Users without a 
local password share a
+    constant fingerprint.
+    """
+    password_hash = getattr(user, "password", None) or ""
+    return hmac.new(
+        conf.get_mandatory_value("api", "secret_key").encode(),
+        f"airflow.fab.password-fingerprint:{password_hash}".encode(),

Review Comment:
   ## CodeQL / Use of a broken or weak cryptographic hashing algorithm on 
sensitive data
   
   [Sensitive data (password)](1) is used in a hashing algorithm (SHA256) that 
is insecure for password hashing, since it is not a computationally expensive 
hash function.
   
   [Show more 
details](https://github.com/apache/airflow/security/code-scanning/708)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to