github-advanced-security[bot] commented on code in PR #7841:
URL: https://github.com/apache/trafficcontrol/pull/7841#discussion_r1365880694


##########
traffic_ops/install/bin/_postinstall.py:
##########
@@ -356,20 +358,20 @@
        else:
                driver = "postgres" if conf["type"] == "Pg" else conf["type"]
 
-       path = os.path.join(root, fname.lstrip('/'))
-       hostname = conf.get('hostname', 'UNKNOWN')
-       port = conf.get('port', 'UNKNOWN')
-       user = conf.get('user', 'UNKNOWN')
-       password = conf.get('password', 'UNKNOWN')
-       dbname = conf.get('dbname', 'UNKNOWN')
-
-       open_line = "host={hostname} port={port} user={user} 
password={password} dbname={dbname}".format(hostname=hostname, port=port, 
user=user, password=password, dbname=dbname)
-       with open(path, 'w+') as conf_file:
+       path = os.path.join(root, fname.lstrip("/"))
+       hostname = conf.get("hostname", "UNKNOWN")
+       port = conf.get("port", "UNKNOWN")
+       user = conf.get("user", "UNKNOWN")
+       password = conf.get("password", "UNKNOWN")
+       dbname = conf.get("dbname", "UNKNOWN")
+
+       open_line = f"host={hostname} port={port} user={user} 
password={password} dbname={dbname}"
+       with open(path, "w+", encoding="utf-8") as conf_file:
                print("production:", file=conf_file)
                print("    driver:", driver, file=conf_file)
-               print("    open: {open_line} 
sslmode=disable".format(open_line=open_line), file=conf_file)
+               print("    open:", open_line, "sslmode=disable", file=conf_file)

Review Comment:
   ## Clear-text logging of sensitive information
   
   This expression logs [sensitive data (password)](1) as clear text.
   
   [Show more 
details](https://github.com/apache/trafficcontrol/security/code-scanning/309)



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