yakuza0 2.23.42 → 2.23.44
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.
- package/SECURITY.md +32 -0
- package/nuxt/build/index.js +10 -2
- package/nuxt/build/replace.js +19 -0
- package/nuxt/build/runtime-dependencies.js +13 -0
- package/package.json +5 -5
- package/pxnpm-lock.yaml +10 -15
- package/server/proxy/conf.js +1 -1
- package/server/proxy/csrf.js +2 -2
- package/server/proxy/lpTarget.js +59 -0
- package/server/proxy/tire.js +2 -2
- package/server/proxy/web.js +20 -6
- package/utils/inclusive.js +2 -1
- package/utils/koaMid.js +1 -1
package/SECURITY.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 2026-10-20 安全修复
|
|
2
|
+
|
|
3
|
+
本次日志所示动态目标请求主要由 yakuza4 的目标策略控制。`proxysecurity_allowedtargets` 为空或未配置时不限制普通业务目标,填写后只允许列出的目标;云元数据等敏感地址始终拦截。公网项目建议启用并补齐后端白名单。
|
|
4
|
+
|
|
5
|
+
框架部分保留现有协议,包含以下必要修复:
|
|
6
|
+
|
|
7
|
+
- 可选 `proxyServer.lp` 不再接受任意 Cookie/请求头目标。启用时必须设置 `proxyServer.lpTargets`,请求仅能选择列表中的完整 URL。默认列表为空,拒绝未知目标。
|
|
8
|
+
- Koa 最低版本为 2.16.4,修复 Host 解析等问题;http-proxy-middleware 最低版本为 2.0.10,修复 Host 驱动的路由匹配问题。均保留原有主版本。
|
|
9
|
+
- 同步源码及 Babel 编译产物,更新 `pxnpm-lock.yaml`。历史 npm/yarn 锁与现有依赖不一致,不应使用它们冻结安装本次补丁。
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
proxyServer: {
|
|
13
|
+
lp: true,
|
|
14
|
+
lpTargets: ['http://10.246.97.10:19092/gateway/api/platform'],
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`lpTargets` 必须是明确的 HTTP(S) 基础 URL,不支持通配符、查询串、fragment 或用户信息。请仅填写可信业务目标。
|
|
19
|
+
|
|
20
|
+
本地验证:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
node tests/proxy-security.js
|
|
24
|
+
node tests/proxy-dependencies.js
|
|
25
|
+
node tests/build-email-redaction.js
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
依赖测试需要先安装更新后的依赖。本次使用经 npm integrity 校验的 2.16.4 / 2.0.10 包在临时目录验证,未重装或覆盖现有 `node_modules`,未发布 npm 包。
|
|
29
|
+
|
|
30
|
+
整个旧前端依赖树尚未完成跨主版本迁移,不能宣称前端所有依赖审计告警均已消除。
|
|
31
|
+
|
|
32
|
+
上游公告:[Koa Host 解析](https://github.com/koajs/koa/security/advisories/GHSA-7gcc-r8m5-44qm)、[代理路由匹配](https://github.com/chimurai/http-proxy-middleware/security/advisories/GHSA-64mm-vxmg-q3vj)。
|
package/nuxt/build/index.js
CHANGED
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _assign = require('babel-runtime/core-js/object/assign');
|
|
8
|
+
|
|
9
|
+
var _assign2 = _interopRequireDefault(_assign);
|
|
10
|
+
|
|
7
11
|
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
|
8
12
|
|
|
9
13
|
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
|
@@ -30,6 +34,8 @@ var _paths = require('../../config/paths');
|
|
|
30
34
|
|
|
31
35
|
var _paths2 = _interopRequireDefault(_paths);
|
|
32
36
|
|
|
37
|
+
var _runtimeDependencies = require('./runtime-dependencies');
|
|
38
|
+
|
|
33
39
|
var _eslint = require('./eslint');
|
|
34
40
|
|
|
35
41
|
var _eslint2 = _interopRequireDefault(_eslint);
|
|
@@ -84,10 +90,10 @@ exports.default = function (config) {
|
|
|
84
90
|
replaceRules = [{
|
|
85
91
|
dir: '.ykServer',
|
|
86
92
|
// test: /package.json/,
|
|
87
|
-
test:
|
|
93
|
+
test: _replace.bundledJavaScriptPattern,
|
|
88
94
|
rules: [{
|
|
89
95
|
search: _replace.emailAddressPattern,
|
|
90
|
-
replace:
|
|
96
|
+
replace: _replace.removeEmailAddress
|
|
91
97
|
}, {
|
|
92
98
|
// search: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/ig,
|
|
93
99
|
search: '@indutny.com',
|
|
@@ -201,6 +207,8 @@ exports.default = function (config) {
|
|
|
201
207
|
}), _config2.default.resolve.dir)
|
|
202
208
|
})(conf, ctx);
|
|
203
209
|
|
|
210
|
+
(0, _assign2.default)(conf.resolve.alias, (0, _runtimeDependencies.runtimeAliases)());
|
|
211
|
+
|
|
204
212
|
(0, _eslint2.default)(conf, ctx);
|
|
205
213
|
|
|
206
214
|
// if (ctx && ctx.isClient) {
|
package/nuxt/build/replace.js
CHANGED
|
@@ -23,6 +23,25 @@ var fs = require('fs');
|
|
|
23
23
|
// addresses in bundled comments and strings.
|
|
24
24
|
exports.emailAddressPattern = /(^|[^a-z0-9.!#$%&'*+/=?^_`{|}~-])[a-z0-9.!#$%&'*+/=?^_`{|}~-]+\\?@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ig;
|
|
25
25
|
|
|
26
|
+
// Generated .nuxt sources can still be consumed by another compiler/app.
|
|
27
|
+
// Only clean emitted bundles, never App.js or other build inputs.
|
|
28
|
+
exports.bundledJavaScriptPattern = /[\\/]\.nuxt[\\/]dist[\\/].*\.js$/;
|
|
29
|
+
|
|
30
|
+
exports.removeEmailAddress = function (match, delimiter, offset, source) {
|
|
31
|
+
var start = offset;
|
|
32
|
+
var end = offset + match.length;
|
|
33
|
+
var boundary = /[\s"'`]/;
|
|
34
|
+
while (start > 0 && !boundary.test(source[start - 1])) {
|
|
35
|
+
start -= 1;
|
|
36
|
+
}while (end < source.length && !boundary.test(source[end])) {
|
|
37
|
+
end += 1;
|
|
38
|
+
}var token = source.slice(start, end);
|
|
39
|
+
// pnpm/pxnpm physical paths contain name@version segments which resemble
|
|
40
|
+
// addresses. Preserve these module requests, including Windows/escaped paths.
|
|
41
|
+
if (/(?:node_modules|\.p(?:n|xn)pm)[\\/]/.test(token)) return match;
|
|
42
|
+
return delimiter;
|
|
43
|
+
};
|
|
44
|
+
|
|
26
45
|
function getAllFiles(root) {
|
|
27
46
|
var res = [],
|
|
28
47
|
files = fs.readdirSync(root);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
|
|
5
|
+
// Nuxt writes plugins into the application's build directory. Resolve the
|
|
6
|
+
// protocol runtime from yakuza0, not from a possibly older hoisted UI dependency.
|
|
7
|
+
var runtimeAliases = function runtimeAliases() {
|
|
8
|
+
return {
|
|
9
|
+
yakuza1: path.dirname(require.resolve('yakuza1/package.json'))
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = { runtimeAliases: runtimeAliases };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yakuza0",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.44",
|
|
4
4
|
"description": "yakuza0 with nuxt",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"get-port": "^5.0.0",
|
|
68
68
|
"html-loader": "^1.3.2",
|
|
69
69
|
"http-proxy": "^1.18.1",
|
|
70
|
-
"http-proxy-middleware": "^2.0.
|
|
70
|
+
"http-proxy-middleware": "^2.0.10",
|
|
71
71
|
"isomorphic-fetch": "^2.2.1",
|
|
72
72
|
"json-format": "^1.0.1",
|
|
73
|
-
"koa": "^2.
|
|
73
|
+
"koa": "^2.16.4",
|
|
74
74
|
"koa-body": "^4.0.4",
|
|
75
75
|
"koa-compress": "^3.0.0",
|
|
76
76
|
"koa-helmet": "7.0.2",
|
|
@@ -115,13 +115,13 @@
|
|
|
115
115
|
"ua-parser-js": "^0.7.40",
|
|
116
116
|
"uglify-js": "^3.17.4",
|
|
117
117
|
"v8-compile-cache": "^2.0.2",
|
|
118
|
-
"yakuza1": "
|
|
118
|
+
"yakuza1": "2.6.26"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"@evolvere/nuxt": "2.15.9",
|
|
122
122
|
"core-js": "3.10.1",
|
|
123
123
|
"eslint": "7.2.0",
|
|
124
|
-
"yakuza1": "
|
|
124
|
+
"yakuza1": "2.6.26"
|
|
125
125
|
},
|
|
126
126
|
"__npminstall_done": false
|
|
127
127
|
}
|
package/pxnpm-lock.yaml
CHANGED
|
@@ -144,8 +144,8 @@ importers:
|
|
|
144
144
|
specifier: ^1.18.1
|
|
145
145
|
version: 1.18.1
|
|
146
146
|
http-proxy-middleware:
|
|
147
|
-
specifier: ^2.0.
|
|
148
|
-
version: 2.0.
|
|
147
|
+
specifier: ^2.0.10
|
|
148
|
+
version: 2.0.10
|
|
149
149
|
isomorphic-fetch:
|
|
150
150
|
specifier: ^2.2.1
|
|
151
151
|
version: 2.2.1
|
|
@@ -153,8 +153,8 @@ importers:
|
|
|
153
153
|
specifier: ^1.0.1
|
|
154
154
|
version: 1.0.1
|
|
155
155
|
koa:
|
|
156
|
-
specifier: ^2.
|
|
157
|
-
version: 2.16.
|
|
156
|
+
specifier: ^2.16.4
|
|
157
|
+
version: 2.16.4
|
|
158
158
|
koa-body:
|
|
159
159
|
specifier: ^4.0.4
|
|
160
160
|
version: 4.2.0
|
|
@@ -4285,14 +4285,9 @@ packages:
|
|
|
4285
4285
|
resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==}
|
|
4286
4286
|
engines: {node: '>= 6'}
|
|
4287
4287
|
|
|
4288
|
-
http-proxy-middleware@2.0.
|
|
4289
|
-
resolution: {integrity: sha512-
|
|
4288
|
+
http-proxy-middleware@2.0.10:
|
|
4289
|
+
resolution: {integrity: sha512-RKzRWNPxUZqbuk3BC5mGVJbBnWgr+diEnjJexIOytFbBzDy88Fbh/YvBr3DsNrl1jYAfjWfpATEv0NO35FDuPQ==}
|
|
4290
4290
|
engines: {node: '>=12.0.0'}
|
|
4291
|
-
peerDependencies:
|
|
4292
|
-
'@types/express': ^4.17.13
|
|
4293
|
-
peerDependenciesMeta:
|
|
4294
|
-
'@types/express':
|
|
4295
|
-
optional: true
|
|
4296
4291
|
|
|
4297
4292
|
http-proxy@1.18.1:
|
|
4298
4293
|
resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==}
|
|
@@ -5035,8 +5030,8 @@ packages:
|
|
|
5035
5030
|
resolution: {integrity: sha512-Subc/t9vJaMtorZ/Z/yqjRaZZ4RQ8ew+aacQhYXzL6oVuaYaUGqhh3UMRB5gcpu7t9hu1QBwbJezHohLNohr3g==}
|
|
5036
5031
|
engines: {node: '>=4'}
|
|
5037
5032
|
|
|
5038
|
-
koa@2.16.
|
|
5039
|
-
resolution: {integrity: sha512-
|
|
5033
|
+
koa@2.16.4:
|
|
5034
|
+
resolution: {integrity: sha512-3An0GCLDSR34tsCO4H8Tef8Pp2ngtaZDAZnsWJYelqXUK5wyiHvGItgK/xcSkmHLSTn1Jcho1mRQs2ehRzvKKw==}
|
|
5040
5035
|
engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4}
|
|
5041
5036
|
|
|
5042
5037
|
last-call-webpack-plugin@3.0.0:
|
|
@@ -14067,7 +14062,7 @@ snapshots:
|
|
|
14067
14062
|
transitivePeerDependencies:
|
|
14068
14063
|
- supports-color
|
|
14069
14064
|
|
|
14070
|
-
http-proxy-middleware@2.0.
|
|
14065
|
+
http-proxy-middleware@2.0.10:
|
|
14071
14066
|
dependencies:
|
|
14072
14067
|
'@types/http-proxy': 1.17.16
|
|
14073
14068
|
http-proxy: 1.18.1
|
|
@@ -14766,7 +14761,7 @@ snapshots:
|
|
|
14766
14761
|
|
|
14767
14762
|
koa2-connect@1.0.2: {}
|
|
14768
14763
|
|
|
14769
|
-
koa@2.16.
|
|
14764
|
+
koa@2.16.4:
|
|
14770
14765
|
dependencies:
|
|
14771
14766
|
accepts: 1.3.8
|
|
14772
14767
|
cache-content-type: 1.0.1
|
package/server/proxy/conf.js
CHANGED
|
@@ -222,5 +222,5 @@ var ng_conf = exports.ng_conf = function ng_conf(_ref7) {
|
|
|
222
222
|
|
|
223
223
|
var headers = '\n proxy_set_header ' + _def.variable.projectNameHeader + ' \'' + th[_def.variable.projectNameHeader] + '\';\n proxy_set_header ' + _def.variable.ipHeader + ' \'' + th[_def.variable.ipHeader] + '\';\n proxy_set_header ' + _def.variable.childKeyHeader + ' \'' + th[_def.variable.childKeyHeader] + '\';\n proxy_set_header ' + _def.variable.appCodeHeader + ' \'' + th[_def.variable.appCodeHeader] + '\';\n proxy_set_header ' + _def.variable.appKeyHeader + ' \'' + th[_def.variable.appKeyHeader] + '\';\n proxy_set_header ' + _def.variable.shareRuleHeader + ' \'' + th[_def.variable.shareRuleHeader] + '\';\n proxy_set_header ' + _def.variable.baseURLHeader + ' \'' + th[_def.variable.baseURLHeader] + '\';\n ';
|
|
224
224
|
|
|
225
|
-
return '\n ' + resolver + '\n\n server {\n listen ' + port + ';\n server_name cln-tire.lan;\n include ' + confRoot + '/server.conf;\n\n location ' + basePath + ' {\n proxy_pass ' + appUrl + ';\n }\n\n location ' + basePath + '
|
|
225
|
+
return '\n ' + resolver + '\n\n server {\n listen ' + port + ';\n server_name cln-tire.lan;\n include ' + confRoot + '/server.conf;\n\n location ' + basePath + ' {\n proxy_pass ' + appUrl + ';\n }\n\n location ' + basePath + 'zunir {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/zunir/' + name + '/client/backend;\n }\n\n location ' + basePath + 'zunir/feapiv1 {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/zunir/' + name + '/client/feapiv1;\n }\n\n location ' + basePath + 'apiv2 {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/apiv2;\n }\n\n location ~ ' + basePath + 'apiv3/cln_.*feapiv1/ {\n rewrite ^' + basePath + 'apiv3/cln_(.*)feapiv1/(.*)$ ' + basePath + 'apiv3/fe/$2 last;\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + ';\n }\n location ~ ' + basePath + 'apiv3/cln_[a-z]+/ {\n rewrite ^' + basePath + 'apiv3/cln_[a-z]+/(.*)$ ' + basePath + 'apiv3/backend/$1 last;\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + ';\n }\n }\n ';
|
|
226
226
|
};
|
package/server/proxy/csrf.js
CHANGED
|
@@ -355,7 +355,7 @@ exports.default = function () {
|
|
|
355
355
|
|
|
356
356
|
|
|
357
357
|
appCp = (0, _koaMid.appCrossProxy)({ app: app, config: config });
|
|
358
|
-
appCpApiV1 = (0, _koaMid.appCrossProxy)({ app: app, config: config, extendProxyKey: ['
|
|
358
|
+
appCpApiV1 = (0, _koaMid.appCrossProxy)({ app: app, config: config, extendProxyKey: ['zunir'] });
|
|
359
359
|
|
|
360
360
|
jwtVerC = function jwtVerC(path) {
|
|
361
361
|
return path.match(new RegExp('^/(' + _config2.default.proxyServer.apiKey + ')/'));
|
|
@@ -434,7 +434,7 @@ exports.default = function () {
|
|
|
434
434
|
// }
|
|
435
435
|
//
|
|
436
436
|
// const extIndex = ctx.path.lastIndexOf('.')
|
|
437
|
-
// const isApi = ctx.path.startsWith('/
|
|
437
|
+
// const isApi = ctx.path.startsWith('/zunir')
|
|
438
438
|
// || ctx.path.startsWith('/apiv3');
|
|
439
439
|
// const isApiV2 = ctx.path.startsWith('/apiv2');
|
|
440
440
|
// if (ctx.method === "GET"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
|
|
4
|
+
|
|
5
|
+
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
|
6
|
+
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
+
|
|
9
|
+
var _require = require('url'),
|
|
10
|
+
URL = _require.URL;
|
|
11
|
+
|
|
12
|
+
var parseTarget = function parseTarget(value) {
|
|
13
|
+
if (typeof value !== 'string') return null;
|
|
14
|
+
try {
|
|
15
|
+
var target = new URL(value);
|
|
16
|
+
if (!['http:', 'https:'].includes(target.protocol) || target.username || target.password || target.search || target.hash || value.includes('?') || value.includes('#') || value.includes('\\')) return null;
|
|
17
|
+
var host = target.hostname.replace(/^\[|\]$/g, '').toLowerCase();
|
|
18
|
+
if (host === '100.100.100.200' || host === '168.63.129.16' || host.startsWith('169.254.') || host === 'fd00:ec2::254' || host.startsWith('fe80:') || host.startsWith('::ffff:')) return null;
|
|
19
|
+
return target.href;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Return the server-configured URL. Cookies/headers only select an exact entry;
|
|
26
|
+
// they cannot supply a new destination, port, credentials, or base path.
|
|
27
|
+
var resolveLpTarget = function resolveLpTarget(requested, allowedTargets) {
|
|
28
|
+
var candidate = parseTarget(requested);
|
|
29
|
+
if (!candidate || !Array.isArray(allowedTargets)) return null;
|
|
30
|
+
var _iteratorNormalCompletion = true;
|
|
31
|
+
var _didIteratorError = false;
|
|
32
|
+
var _iteratorError = undefined;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
for (var _iterator = (0, _getIterator3.default)(allowedTargets), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
36
|
+
var entry = _step.value;
|
|
37
|
+
|
|
38
|
+
var allowed = parseTarget(entry);
|
|
39
|
+
if (allowed && candidate === allowed) return allowed;
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
_didIteratorError = true;
|
|
43
|
+
_iteratorError = err;
|
|
44
|
+
} finally {
|
|
45
|
+
try {
|
|
46
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
47
|
+
_iterator.return();
|
|
48
|
+
}
|
|
49
|
+
} finally {
|
|
50
|
+
if (_didIteratorError) {
|
|
51
|
+
throw _iteratorError;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
module.exports = { resolveLpTarget: resolveLpTarget };
|
package/server/proxy/tire.js
CHANGED
|
@@ -506,10 +506,10 @@ exports.default = function () {
|
|
|
506
506
|
(0, _child_process.exec)(_config2.default.server.tire.guPath + ' -c ' + _config2.default.server.tire.guConf + ' -g "daemon off;"');
|
|
507
507
|
// spawn(yConf.server.tire.guPath, ['-c', yConf.server.tire.guConf]);
|
|
508
508
|
} else {
|
|
509
|
-
app.use(basePath + "
|
|
509
|
+
app.use(basePath + "zunir", createProxyMiddleware((0, _extends5.default)({}, baseConfig, {
|
|
510
510
|
target: _config2.default.server.orbProtocol.http + "//" + _config2.default.server.orbHost + ":" + _config2.default.server.orbPort,
|
|
511
511
|
headers: th,
|
|
512
|
-
pathRewrite: (_pathRewrite = {}, (0, _defineProperty3.default)(_pathRewrite, "^" + basePath + "
|
|
512
|
+
pathRewrite: (_pathRewrite = {}, (0, _defineProperty3.default)(_pathRewrite, "^" + basePath + "zunir/feapiv1", "/" + _config2.default.proxyServer.apiKey + "/" + _config2.default.name + "/client/feapiv1"), (0, _defineProperty3.default)(_pathRewrite, "^" + basePath + "zunir", "/" + _config2.default.proxyServer.apiKey + "/" + _config2.default.name + "/client/backend"), _pathRewrite)
|
|
513
513
|
})));
|
|
514
514
|
|
|
515
515
|
app.use(basePath + "apiv2", createProxyMiddleware((0, _extends5.default)({}, baseConfig, {
|
package/server/proxy/web.js
CHANGED
|
@@ -60,6 +60,8 @@ var _conf = require('./conf');
|
|
|
60
60
|
|
|
61
61
|
var _om = require('../../utils/om');
|
|
62
62
|
|
|
63
|
+
var _lpTarget = require('./lpTarget');
|
|
64
|
+
|
|
63
65
|
var _httpDebug = require('../../utils/httpDebug');
|
|
64
66
|
|
|
65
67
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -194,7 +196,7 @@ exports.default = function () {
|
|
|
194
196
|
|
|
195
197
|
app.use(function () {
|
|
196
198
|
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx, next) {
|
|
197
|
-
var lpc, lph, lp;
|
|
199
|
+
var lpc, lph, lp, target;
|
|
198
200
|
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
199
201
|
while (1) {
|
|
200
202
|
switch (_context.prev = _context.next) {
|
|
@@ -204,13 +206,25 @@ exports.default = function () {
|
|
|
204
206
|
lp = lph || lpc;
|
|
205
207
|
|
|
206
208
|
if (!(typeof lp === 'string' && lp.length > 0)) {
|
|
207
|
-
_context.next =
|
|
209
|
+
_context.next = 12;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
target = (0, _lpTarget.resolveLpTarget)(lp, _config2.default.proxyServer.lpTargets);
|
|
214
|
+
|
|
215
|
+
if (target) {
|
|
216
|
+
_context.next = 9;
|
|
208
217
|
break;
|
|
209
218
|
}
|
|
210
219
|
|
|
220
|
+
ctx.status = 403;
|
|
221
|
+
ctx.body = 'Proxy target denied';
|
|
222
|
+
return _context.abrupt('return');
|
|
223
|
+
|
|
224
|
+
case 9:
|
|
211
225
|
return _context.abrupt('return', new _promise2.default(function (resolve, reject) {
|
|
212
226
|
_mid.proxy.web(ctx.req, ctx.res, {
|
|
213
|
-
target:
|
|
227
|
+
target: target,
|
|
214
228
|
ws: true
|
|
215
229
|
}, function (e) {
|
|
216
230
|
var status = {
|
|
@@ -222,11 +236,11 @@ exports.default = function () {
|
|
|
222
236
|
});
|
|
223
237
|
}));
|
|
224
238
|
|
|
225
|
-
case
|
|
226
|
-
_context.next =
|
|
239
|
+
case 12:
|
|
240
|
+
_context.next = 14;
|
|
227
241
|
return next();
|
|
228
242
|
|
|
229
|
-
case
|
|
243
|
+
case 14:
|
|
230
244
|
case 'end':
|
|
231
245
|
return _context.stop();
|
|
232
246
|
}
|
package/utils/inclusive.js
CHANGED
|
@@ -598,12 +598,13 @@ var render = function () {
|
|
|
598
598
|
}
|
|
599
599
|
},
|
|
600
600
|
proxyServer: {
|
|
601
|
-
apiKey: '
|
|
601
|
+
apiKey: 'zunir',
|
|
602
602
|
apiFeV1Key: 'feapiv1',
|
|
603
603
|
apiBackendKey: 'backend',
|
|
604
604
|
baseKey: 'platform',
|
|
605
605
|
baseUrl: {},
|
|
606
606
|
lp: false,
|
|
607
|
+
lpTargets: [],
|
|
607
608
|
options: {
|
|
608
609
|
changeOrigin: true,
|
|
609
610
|
secure: false,
|
package/utils/koaMid.js
CHANGED
|
@@ -34,7 +34,7 @@ var appCrossProxy = exports.appCrossProxy = function appCrossProxy(_ref) {
|
|
|
34
34
|
|
|
35
35
|
var proxyKey = [].concat((0, _toConsumableArray3.default)((0, _keys2.default)(_config2.default.proxyServer.proxy)), (0, _toConsumableArray3.default)(extendProxyKey || []));
|
|
36
36
|
|
|
37
|
-
// don't have
|
|
37
|
+
// don't have zunir
|
|
38
38
|
var jwtVerProxy = function jwtVerProxy(path) {
|
|
39
39
|
return path.match(new RegExp("^/(" + proxyKey.join("|") + ")/"));
|
|
40
40
|
};
|