You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "lgcareer (via GitHub)" <gi...@apache.org> on 2024/01/04 11:49:42 UTC

[PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

lgcareer opened a new pull request, #15430:
URL: https://github.com/apache/dolphinscheduler/pull/15430

   <!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
   
   ## Purpose of the pull request
   
   <!--(For example: This pull request adds checkstyle plugin).-->
   
   ## Brief change log
   
   - *Enhancement mysql connection properties*


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on PR #15430:
URL: https://github.com/apache/dolphinscheduler/pull/15430#issuecomment-1878043960

   BTW, we have code style for dolphinscheduler now, you can apply them auto by running command `mvn spotless:apply` to fix it


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on code in PR #15430:
URL: https://github.com/apache/dolphinscheduler/pull/15430#discussion_r1442447272


##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/param/MySQLDataSourceProcessor.java:
##########
@@ -139,7 +132,32 @@ public Connection getConnection(ConnectionParam connectionParam) throws ClassNot
             log.warn("sensitive param : {} in password field is filtered", AUTO_DESERIALIZE);
             password = password.replace(AUTO_DESERIALIZE, "");
         }
-        return DriverManager.getConnection(getJdbcUrl(connectionParam), user, password);
+
+        Properties connectionProperties = getConnectionProperties(mysqlConnectionParam, user, password);
+
+        return DriverManager.getConnection(getJdbcUrl(connectionParam), connectionProperties);
+    }
+
+    @NotNull
+    private Properties getConnectionProperties(MySQLConnectionParam mysqlConnectionParam, String user,
+                                               String password) {
+        Properties connectionProperties = new Properties();
+        connectionProperties.put("user", user);
+        connectionProperties.put("password", password);
+        Map<String, String> paramMap = mysqlConnectionParam.getOther();
+        if (MapUtils.isNotEmpty(paramMap)) {
+            paramMap.forEach((k, v) -> {
+                if (!checkKeyIsLegitimate(k)) {
+                    return;
+                }
+                connectionProperties.put(k, v);
+            });
+        }
+        connectionProperties.put(AUTO_DESERIALIZE, "false");
+        connectionProperties.put(ALLOW_LOAD_LOCAL_IN_FILE_NAME, "false");
+        connectionProperties.put(ALLOW_LOCAL_IN_FILE_NAME, "false");
+        connectionProperties.put(ALLOW_URL_IN_LOCAL_IN_FILE_NAME, "false");

Review Comment:
   Should we add some log to tell user those config parameter will disable in all cases for security reason. Otherwise users    will feel odd when them pass true for those parameter but not effective.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

Posted by "lgcareer (via GitHub)" <gi...@apache.org>.
lgcareer commented on PR #15430:
URL: https://github.com/apache/dolphinscheduler/pull/15430#issuecomment-1878164686

   > You should change your target branch to `3.2.1-prepare`.
   
   Hi,Thx,I have submitted another pr to dev branch,I will close this.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

Posted by "lgcareer (via GitHub)" <gi...@apache.org>.
lgcareer commented on PR #15430:
URL: https://github.com/apache/dolphinscheduler/pull/15430#issuecomment-1878165184

   I have submitted another pr to dev branch,I will close this.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Enhancement][API]Enhancement mysql connection properties [dolphinscheduler]

Posted by "lgcareer (via GitHub)" <gi...@apache.org>.
lgcareer closed pull request #15430: [Enhancement][API]Enhancement mysql connection properties
URL: https://github.com/apache/dolphinscheduler/pull/15430


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org