github-advanced-security[bot] commented on code in PR #15671:
URL: 
https://github.com/apache/dolphinscheduler/pull/15671#discussion_r1512099094


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java:
##########
@@ -499,11 +499,18 @@
             }
 
             DatabaseMetaData metaData = connection.getMetaData();
-
-            if (dataSource.getType() == DbType.ORACLE) {
-                database = null;
+            String schema = null;
+            try {
+                schema = metaData.getConnection().getSchema();
+            } catch (SQLException e) {
+                log.error("Cant not get the schema, datasourceId:{}.", 
datasourceId, e);
+                throw new ServiceException(Status.GET_DATASOURCE_TABLES_ERROR);
             }
-            rs = metaData.getColumns(database, null, tableName, "%");
+
+            rs = metaData.getColumns(
+                    getCatalog(dataSource.getType(), database),
+                    getDbSchemaPattern(dataSource.getType(), database, schema, 
connectionParam),
+                    tableName, "%");

Review Comment:
   ## Query built from user-controlled sources
   
   This query depends on a [user-provided value](1).
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/3932)



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