Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/491#discussion_r99928551
  
    --- Diff: subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java ---
    @@ -578,17 +578,26 @@ public static Sql newInstance(Map<String, Object> 
args) throws SQLException, Cla
     
             Object url = sqlArgs.remove("url");
             Connection connection;
    +        LOG.fine("url = " + url);
             if (props != null) {
    -            System.err.println("url = " + url);
    -            System.err.println("props = " + props);
    -            connection = DriverManager.getConnection(url.toString(), new 
Properties(props));
    +            Properties propsCopy = new Properties(props);
    +            connection = DriverManager.getConnection(url.toString(), 
propsCopy);
    +            if (propsCopy.containsKey("password")) {
    +                // don't log the password
    +                propsCopy = new Properties(propsCopy);
    --- End diff --
    
    It is certainly conservative code. I didn't want the password appearing in 
logging and I didn't know whether any drivers out there might hold onto the 
properties object and re-use it when e.g. growing a connection pool or 
something.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to