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/05 04:34:49 UTC

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

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

   <!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
   
   ## Purpose of the pull request
   This pull request enhance mysql connection properties
   
   ## Brief change log
   
   - *Enhance 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]Enhance mysql connection properties [dolphinscheduler]

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

   tests error, could you please 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]Enhance mysql connection properties [dolphinscheduler]

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

   ## [Codecov](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `18 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`e5a5128`)](https://app.codecov.io/gh/apache/dolphinscheduler/commit/e5a512803ec6f8728fe05f4a5433231ab1d13c7e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 38.12% compared to head [(`f5ac564`)](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 38.12%.
   
   > :exclamation: Current head f5ac564 differs from pull request most recent head 22d4c18. Consider uploading reports for the commit 22d4c18 to get more accurate results
   
   | [Files](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...tasource/mysql/param/MySQLDataSourceProcessor.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1kYXRhc291cmNlLXBsdWdpbi9kb2xwaGluc2NoZWR1bGVyLWRhdGFzb3VyY2UtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcGx1Z2luL2RhdGFzb3VyY2UvbXlzcWwvcGFyYW0vTXlTUUxEYXRhU291cmNlUHJvY2Vzc29yLmphdmE=) | 5.26% | [18 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff            @@
   ##                dev   #15433   +/-   ##
   =========================================
     Coverage     38.12%   38.12%           
     Complexity     4697     4697           
   =========================================
     Files          1299     1299           
     Lines         44774    44736   -38     
     Branches       4799     4775   -24     
   =========================================
   - Hits          17068    17054   -14     
   + Misses        25855    25833   -22     
   + Partials       1851     1849    -2     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15433?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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]Enhance mysql connection properties [dolphinscheduler]

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

   > LGTM, thanks
   
   @zhongjiajie sir, sorry to disturb you but i am waiting for your approval and response in HTTP task parameter issue also I have tried to contact you via email.


-- 
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]Enhance mysql connection properties [dolphinscheduler]

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

   > tests error, could you please fix it?
   
   Yes,has fixed.


-- 
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]Enhance mysql connection properties [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15433:
URL: https://github.com/apache/dolphinscheduler/pull/15433#issuecomment-1879639300

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433) **Quality Gate failed**  
   Failed conditions
   
   [4.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15433&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433)
   
   


-- 
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]Enhance mysql connection properties [dolphinscheduler]

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie merged PR #15433:
URL: https://github.com/apache/dolphinscheduler/pull/15433


-- 
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]Enhance mysql connection properties [dolphinscheduler]

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


##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/param/MySQLDataSourceProcessor.java:
##########
@@ -140,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);
+    }
+
+    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)) {
+                    log.info("Key `{}` is not legitimate for security reason", 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:
   Seem L150 already add log for 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]Enhance mysql connection properties [dolphinscheduler]

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


##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/param/MySQLDataSourceProcessor.java:
##########
@@ -140,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);
+    }
+
+    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)) {
+                    log.info("Key `{}` is not legitimate for security reason", 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:
   https://github.com/apache/dolphinscheduler/pull/15430#discussion_r1442447272



-- 
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]Enhance mysql connection properties [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15433:
URL: https://github.com/apache/dolphinscheduler/pull/15433#issuecomment-1878201524

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433) **Quality Gate failed**  
   Failed conditions
   
   [4.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15433&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433)
   
   


-- 
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]Enhance mysql connection properties [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15433:
URL: https://github.com/apache/dolphinscheduler/pull/15433#issuecomment-1878201788

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433) **Quality Gate failed**  
   Failed conditions
   
   [4.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15433&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433)
   
   


-- 
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]Enhance mysql connection properties [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15433:
URL: https://github.com/apache/dolphinscheduler/pull/15433#issuecomment-1879639257

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433) **Quality Gate failed**  
   Failed conditions
   
   [4.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15433&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15433)
   
   


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