60 lines
2.4 KiB
Diff
60 lines
2.4 KiB
Diff
From 3a85482819891c6cdfa1d47be372640c0c67620c Mon Sep 17 00:00:00 2001
|
|
From: gongzt <gong_zhengtang@163.com>
|
|
Date: Thu, 1 Dec 2022 23:06:53 +0800
|
|
Subject: [PATCH] 更改参数有效性校验长度判断错误
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---
|
|
apollo/function/schema/task.py | 9 ++++++---
|
|
apollo/handler/task_handler/view.py | 5 -----
|
|
2 files changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/apollo/function/schema/task.py b/apollo/function/schema/task.py
|
|
index e19c3ed..59f72db 100644
|
|
--- a/apollo/function/schema/task.py
|
|
+++ b/apollo/function/schema/task.py
|
|
@@ -151,9 +151,12 @@ class GenerateRepoTaskSchema(Schema):
|
|
"""
|
|
validators for parameter of /vulnerability/task/repo/generate
|
|
"""
|
|
- task_name = fields.String(required=True, validate=lambda s: 0 < s <= 20)
|
|
- description = fields.String(required=True, validate=lambda s: 0 < s <= 50)
|
|
- repo_name = fields.String(required=True, validate=lambda s: 0 < s <= 20)
|
|
+ task_name = fields.String(
|
|
+ required=True, validate=lambda s: 0 < len(s) <= 20)
|
|
+ description = fields.String(
|
|
+ required=True, validate=lambda s: 0 < len(s) <= 50)
|
|
+ repo_name = fields.String(
|
|
+ required=True, validate=lambda s: 0 < len(s) <= 20)
|
|
info = fields.List(fields.Nested(CveHostInfoDictSchema), required=True,
|
|
validate=lambda s: len(s) > 0)
|
|
|
|
diff --git a/apollo/handler/task_handler/view.py b/apollo/handler/task_handler/view.py
|
|
index cfd0d9b..318f693 100644
|
|
--- a/apollo/handler/task_handler/view.py
|
|
+++ b/apollo/handler/task_handler/view.py
|
|
@@ -102,10 +102,6 @@ class VulScanHost(BaseResponse):
|
|
"""
|
|
access_token = request.headers.get('access_token')
|
|
# connect to database
|
|
- task_proxy = TaskProxy(configuration)
|
|
- if not task_proxy.connect(SESSION):
|
|
- return DATABASE_CONNECT_ERROR
|
|
-
|
|
proxy = TaskMysqlProxy()
|
|
if not proxy.connect(SESSION):
|
|
LOGGER.error("Connect to database fail, return.")
|
|
@@ -116,7 +112,6 @@ class VulScanHost(BaseResponse):
|
|
host_list = args['host_list']
|
|
host_info = proxy.get_scan_host_info(username, host_list)
|
|
if not self._verify_param(host_list, host_info):
|
|
- proxy.close()
|
|
LOGGER.error(
|
|
"There are some host in %s that can not be scanned.", host_list)
|
|
return PARAM_ERROR
|
|
--
|
|
Gitee
|
|
|