From 886b96351bf266a12e03c0f611e0ff275882600e Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 15 Sep 2022 13:48:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20Mo?= =?UTF-8?q?ck=E5=90=8E=E7=BD=AE=E8=84=9A=E6=9C=AC=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=AB=98=E5=8D=B1=E6=8C=87=E4=BB=A4=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mock后置脚本增加高危指令过滤 --- .../main/java/io/metersphere/api/mock/utils/MockApiUtils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/main/java/io/metersphere/api/mock/utils/MockApiUtils.java b/backend/src/main/java/io/metersphere/api/mock/utils/MockApiUtils.java index 01ab727f47..ecf11f4867 100644 --- a/backend/src/main/java/io/metersphere/api/mock/utils/MockApiUtils.java +++ b/backend/src/main/java/io/metersphere/api/mock/utils/MockApiUtils.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONValidator; import io.metersphere.api.dto.mock.ApiDefinitionResponseDTO; import io.metersphere.api.dto.mock.MockConfigRequestParams; import io.metersphere.api.dto.mock.RequestMockParams; +import io.metersphere.api.dto.shell.filter.ScriptFilter; import io.metersphere.api.mock.dto.MockParamConditionEnum; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.json.JSONSchemaGenerator; @@ -281,6 +282,7 @@ public class MockApiUtils { LogUtil.error(e); } } + ScriptFilter.verify(scriptLanguage, "Mock后置脚本", script); scriptEngine = scriptEngineUtils.getBaseScriptEngine(projectId, scriptLanguage, url, headerMap, requestMockParams); if (StringUtils.isNotEmpty(script) && scriptEngine != null) { scriptEngineUtils.runScript(scriptEngine, script);