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


##########
airflow/api_fastapi/auth/managers/simple/simple_auth_manager.py:
##########
@@ -120,15 +120,17 @@
             return
         users = self.get_users()
         passwords = self.get_passwords(users)
+        changed = False
         for user in users:
             if user["username"] not in passwords:
                 # User dot not exist in the file, adding it
                 passwords[user["username"]] = self._generate_password()
+                self._print_output(f"Password for user '{user['username']}': 
{passwords[user['username']]}")
+                changed = True
 
-            self._print_output(f"Password for user '{user['username']}': 
{passwords[user['username']]}")
-
-        with open(self.get_generated_password_file(), "w") as file:
-            file.write(json.dumps(passwords))
+        if changed:
+            with open(self.get_generated_password_file(), "w") as file:
+                file.write(json.dumps(passwords) + "\n")

Review Comment:
   ## Clear-text storage of sensitive information
   
   This expression stores [sensitive data (password)](1) as clear text.
   This expression stores [sensitive data (password)](2) as clear text.
   This expression stores [sensitive data (password)](3) as clear text.
   This expression stores [sensitive data (password)](4) as clear text.
   
   [Show more 
details](https://github.com/apache/airflow/security/code-scanning/398)



-- 
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