Skip to content

Commit

Permalink
Glue代码保存越权问题处理
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxueli committed Nov 10, 2024
1 parent 0885d7d commit 7503bcb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
6 changes: 5 additions & 1 deletion doc/XXL-JOB官方文档.md
Original file line number Diff line number Diff line change
Expand Up @@ -2369,8 +2369,12 @@ public void execute() {
### 7.35 版本 v2.4.2 Release Notes[规划中]
- 1、【升级】多个项目依赖升级至较新稳定版本,涉及netty、groovy、gson、springboot、mybatis等;
- 2、【修复】"CVE-2024-42681" 子任务越权漏洞修复;
- 3、【修复】"CVE-2023-33779" 任务API越权问题修复;
- 3、【优化】Cron解析组件优化代码优化。
- 4、【优化】修改密码交互优化,解决CSRF隐患。
- 4、【优化】修改密码交互调整,解决CSRF问题隐患。
备注:“CVE-2024-38820”漏洞源自spring,当前使用spring5.x及springboot2.x软件普遍受该问题影响。
该问题修复需要升级至spring6.x与springboot3.x,如有诉求可自行升级,计划下个大版本升级spring相关版本解决该问题。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,34 @@ public String index(HttpServletRequest request, Model model, int jobId) {

@RequestMapping("/save")
@ResponseBody
public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
public ReturnT<String> save(HttpServletRequest request, int id, String glueSource, String glueRemark) {
// valid
if (glueRemark==null) {
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")) );
}
if (glueRemark.length()<4 || glueRemark.length()>100) {
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
}
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
if (exists_jobInfo == null) {
XxlJobInfo existsJobInfo = xxlJobInfoDao.loadById(id);
if (existsJobInfo == null) {
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
}

// valid permission
PermissionInterceptor.validJobGroupPermission(request, existsJobInfo.getJobGroup());

// update new code
exists_jobInfo.setGlueSource(glueSource);
exists_jobInfo.setGlueRemark(glueRemark);
exists_jobInfo.setGlueUpdatetime(new Date());
existsJobInfo.setGlueSource(glueSource);
existsJobInfo.setGlueRemark(glueRemark);
existsJobInfo.setGlueUpdatetime(new Date());

exists_jobInfo.setUpdateTime(new Date());
xxlJobInfoDao.update(exists_jobInfo);
existsJobInfo.setUpdateTime(new Date());
xxlJobInfoDao.update(existsJobInfo);

// log old code
XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
xxlJobLogGlue.setJobId(exists_jobInfo.getId());
xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
xxlJobLogGlue.setJobId(existsJobInfo.getId());
xxlJobLogGlue.setGlueType(existsJobInfo.getGlueType());
xxlJobLogGlue.setGlueSource(glueSource);
xxlJobLogGlue.setGlueRemark(glueRemark);

Expand All @@ -89,7 +92,7 @@ public ReturnT<String> save(Model model, int id, String glueSource, String glueR
xxlJobLogGlueDao.save(xxlJobLogGlue);

// remove code backup more than 30
xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
xxlJobLogGlueDao.removeOld(existsJobInfo.getId(), 30);

return ReturnT.SUCCESS;
}
Expand Down

0 comments on commit 7503bcb

Please sign in to comment.