You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org> on 2026/07/01 06:03:15 UTC
Re: [PR] [Improvement-17928][API] Add worker group id to environment relation [dolphinscheduler]
github-advanced-security[bot] commented on code in PR #18349:
URL: https://github.com/apache/dolphinscheduler/pull/18349#discussion_r3503601362
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java:
##########
@@ -121,25 +130,20 @@
env.setCode(CodeGenerateUtils.genCode());
if (environmentMapper.insert(env) > 0) {
- if (!StringUtils.isEmpty(workerGroups)) {
- List<String> workerGroupList = JSONUtils.parseObject(workerGroups, new TypeReference<List<String>>() {
+ if (CollectionUtils.isNotEmpty(workerGroupList)) {
+ workerGroupList.forEach(workerGroup -> {
+ EnvironmentWorkerGroupRelation relation = new EnvironmentWorkerGroupRelation();
+ relation.setEnvironmentCode(env.getCode());
+ relation.setWorkerGroupId(workerGroupMap.get(workerGroup).getId());
+ relation.setWorkerGroup(workerGroup);
+ relation.setOperator(loginUser.getId());
+ relation.setCreateTime(new Date());
+ relation.setUpdateTime(new Date());
+ relationMapper.insert(relation);
+ log.info(
+ "Environment-WorkerGroup relation create complete, environmentName:{}, workerGroup:{}.",
+ env.getName(), relation.getWorkerGroup());
Review Comment:
## CodeQL / Log Injection
This log entry depends on a [user-provided value](1).
[Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/5811)
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java:
##########
@@ -121,25 +130,20 @@
env.setCode(CodeGenerateUtils.genCode());
if (environmentMapper.insert(env) > 0) {
- if (!StringUtils.isEmpty(workerGroups)) {
- List<String> workerGroupList = JSONUtils.parseObject(workerGroups, new TypeReference<List<String>>() {
+ if (CollectionUtils.isNotEmpty(workerGroupList)) {
+ workerGroupList.forEach(workerGroup -> {
+ EnvironmentWorkerGroupRelation relation = new EnvironmentWorkerGroupRelation();
+ relation.setEnvironmentCode(env.getCode());
+ relation.setWorkerGroupId(workerGroupMap.get(workerGroup).getId());
+ relation.setWorkerGroup(workerGroup);
+ relation.setOperator(loginUser.getId());
+ relation.setCreateTime(new Date());
+ relation.setUpdateTime(new Date());
+ relationMapper.insert(relation);
+ log.info(
+ "Environment-WorkerGroup relation create complete, environmentName:{}, workerGroup:{}.",
+ env.getName(), relation.getWorkerGroup());
Review Comment:
## CodeQL / Log Injection
This log entry depends on a [user-provided value](1).
[Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/5812)
--
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