github-advanced-security[bot] commented on code in PR #18073:
URL:
https://github.com/apache/dolphinscheduler/pull/18073#discussion_r2958250200
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java:
##########
@@ -477,8 +541,19 @@
}
@Override
- public List<ParamsOptions> getTableColumns(Integer datasourceId, String
database, String tableName) {
+ public List<ParamsOptions> getTableColumns(User loginUser, Integer
datasourceId, String database,
+ String tableName) {
DataSource dataSource = dataSourceMapper.selectById(datasourceId);
+
+ if (dataSource == null) {
+ throw new ServiceException(Status.QUERY_DATASOURCE_ERROR);
+ }
+
+ if (!canOperatorPermissions(loginUser, new Object[]{datasourceId},
AuthorizationType.DATASOURCE,
+ ApiFuncIdentificationConstant.DATASOURCE)) {
Review Comment:
## Potential database resource leak
This Statement is not always closed on method exit.
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/3213)
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java:
##########
@@ -477,8 +541,19 @@
}
@Override
- public List<ParamsOptions> getTableColumns(Integer datasourceId, String
database, String tableName) {
+ public List<ParamsOptions> getTableColumns(User loginUser, Integer
datasourceId, String database,
+ String tableName) {
DataSource dataSource = dataSourceMapper.selectById(datasourceId);
+
+ if (dataSource == null) {
+ throw new ServiceException(Status.QUERY_DATASOURCE_ERROR);
+ }
+
+ if (!canOperatorPermissions(loginUser, new Object[]{datasourceId},
AuthorizationType.DATASOURCE,
+ ApiFuncIdentificationConstant.DATASOURCE)) {
+ throw new ServiceException(Status.USER_NO_OPERATION_PERM);
+ }
Review Comment:
## Potential database resource leak
This Statement is not always closed on method exit.
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/3214)
--
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]