From a09a471a8038b0b294c81e7338078c3747f91326 Mon Sep 17 00:00:00 2001 From: Ayu <14359932+lin-Ayu0v0@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 14:06:15 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E5=A2=9E=E5=8A=A0=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=9A=84HTTP=E5=9C=B0=E5=9D=80=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=80=A7=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/JobGroupController.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java index 8e0c5a4d56..032ed55ce0 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java @@ -47,7 +47,6 @@ public Map pageList(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int start, @RequestParam(required = false, defaultValue = "10") int length, String appname, String title) { - // page query List list = xxlJobGroupDao.pageList(start, length, appname, title); int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title); @@ -141,6 +140,10 @@ public ReturnT update(XxlJobGroup xxlJobGroup){ if (item==null || item.trim().length()==0) { return new ReturnT(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") ); } + String url = item.trim().toLowerCase(); + if (!isHttpAddressValid(url)){ + return new ReturnT(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") ); + } } } @@ -151,6 +154,19 @@ public ReturnT update(XxlJobGroup xxlJobGroup){ return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL; } + // valid http address + private boolean isHttpAddressValid(String url){ + if (url == null){ + return false; + } + + // valid + if(!url.startsWith("http://") && !url.startsWith("https://") && url.contains(" ")){ + return false; + } + return true; + } + private List findRegistryByAppName(String appnameParam){ HashMap> appAddressMap = new HashMap>(); List list = xxlJobRegistryDao.findAll(RegistryConfig.DEAD_TIMEOUT, new Date());