@nocobase/plugin-action-custom-request 2.2.0-beta.7 → 2.2.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,23 +8,23 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-beta.7",
11
+ "@nocobase/client": "2.2.0-beta.9",
12
12
  "react": "18.2.0",
13
13
  "react-i18next": "11.18.6",
14
14
  "@formily/react": "2.3.7",
15
- "@nocobase/client-v2": "2.2.0-beta.7",
16
- "@nocobase/flow-engine": "2.2.0-beta.7",
15
+ "@nocobase/client-v2": "2.2.0-beta.9",
16
+ "@nocobase/flow-engine": "2.2.0-beta.9",
17
17
  "antd": "5.24.2",
18
18
  "@emotion/css": "11.13.0",
19
- "@nocobase/utils": "2.2.0-beta.7",
20
- "@nocobase/logger": "2.2.0-beta.7",
21
- "@nocobase/server": "2.2.0-beta.7",
22
- "@nocobase/test": "2.2.0-beta.7",
19
+ "@nocobase/utils": "2.2.0-beta.9",
20
+ "@nocobase/logger": "2.2.0-beta.9",
21
+ "@nocobase/server": "2.2.0-beta.9",
22
+ "@nocobase/test": "2.2.0-beta.9",
23
23
  "@formily/antd-v5": "1.2.3",
24
24
  "lodash": "4.18.1",
25
25
  "@formily/shared": "2.3.7",
26
- "@nocobase/actions": "2.2.0-beta.7",
27
- "@nocobase/evaluators": "2.2.0-beta.7",
26
+ "@nocobase/actions": "2.2.0-beta.9",
27
+ "@nocobase/evaluators": "2.2.0-beta.9",
28
28
  "axios": "1.7.7",
29
- "@nocobase/database": "2.2.0-beta.7"
29
+ "@nocobase/database": "2.2.0-beta.9"
30
30
  };
@@ -24,6 +24,7 @@
24
24
  "Request settings": "Request settings",
25
25
  "Response type": "Response type",
26
26
  "Roles": "Roles",
27
+ "Runtime request options cannot override the request target": "Runtime request options cannot override the request target",
27
28
  "Stream": "Stream",
28
29
  "Timeout config": "Timeout config",
29
30
  "Title": "Title",
@@ -24,6 +24,7 @@
24
24
  "Request settings": "请求设置",
25
25
  "Response type": "响应类型",
26
26
  "Roles": "角色",
27
+ "Runtime request options cannot override the request target": "运行时请求选项不能覆盖请求目标",
27
28
  "Stream": "流",
28
29
  "Timeout config": "超时设置",
29
30
  "Title": "标题",
@@ -91,6 +91,21 @@ const omitNullAndUndefined = (obj) => {
91
91
  return acc;
92
92
  }, {});
93
93
  };
94
+ const RuntimeTargetOptionKeys = /* @__PURE__ */ new Set([
95
+ "url",
96
+ "baseURL",
97
+ "proxy",
98
+ "socketPath",
99
+ "transport",
100
+ "httpAgent",
101
+ "httpsAgent"
102
+ ]);
103
+ const getForbiddenRuntimeTargetOptionKeys = (runtimeOptions) => {
104
+ if (!runtimeOptions || typeof runtimeOptions !== "object" || Array.isArray(runtimeOptions)) {
105
+ return [];
106
+ }
107
+ return Object.keys(runtimeOptions).filter((key) => RuntimeTargetOptionKeys.has(key));
108
+ };
94
109
  const CurrentUserVariableRegExp = /{{\s*(?:ctx\.)?(currentUser[^}]+)\s*}}/g;
95
110
  const getCurrentUserAppends = (str, user) => {
96
111
  const matched = str.matchAll(CurrentUserVariableRegExp);
@@ -165,6 +180,13 @@ async function send(ctx, next) {
165
180
  if (!requestConfig) {
166
181
  ctx.throw(404, "request config not found");
167
182
  }
183
+ const forbiddenRuntimeOptionKeys = getForbiddenRuntimeTargetOptionKeys(runtimeOptions);
184
+ if (forbiddenRuntimeOptionKeys.length) {
185
+ return ctx.throw(
186
+ 400,
187
+ ctx.t("Runtime request options cannot override the request target", { ns: "action-custom-request" })
188
+ );
189
+ }
168
190
  ctx.withoutDataWrapping = true;
169
191
  const mergedOptions = {
170
192
  ...requestConfig.options || {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-action-custom-request",
3
- "version": "2.2.0-beta.7",
3
+ "version": "2.2.0-beta.9",
4
4
  "main": "dist/server/index.js",
5
5
  "homepage": "https://docs.nocobase.com/handbook/action-custom-request",
6
6
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/action-custom-request",
@@ -34,7 +34,7 @@
34
34
  "@nocobase/server": "2.x",
35
35
  "@nocobase/test": "2.x"
36
36
  },
37
- "gitHead": "e6a3fa8963a73cd9ddfc1273d71b0012483e1ad8",
37
+ "gitHead": "60e3d7abbaa0c7cead76f71a4f3d5eedb6b8acdb",
38
38
  "keywords": [
39
39
  "Actions"
40
40
  ]