From f973e923ba40a1e80d34d6611e139783f2c4b575 Mon Sep 17 00:00:00 2001 From: Xc Date: Wed, 22 May 2024 13:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=88=E5=B0=81=E6=8E=89?= =?UTF-8?q?=E5=AF=B9=E5=8A=A0=E5=AF=86=E6=95=B0=E6=8D=AE=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/context/BackendRuntimeContext.js | 28 ++++++++++++---------- lib/context/BackendRuntimeContext.js | 36 +++++++++++++++------------- src/context/BackendRuntimeContext.ts | 8 ++++--- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/es/context/BackendRuntimeContext.js b/es/context/BackendRuntimeContext.js index 4ad8138fe..18e3419e8 100644 --- a/es/context/BackendRuntimeContext.js +++ b/es/context/BackendRuntimeContext.js @@ -6,7 +6,7 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import { applicationProjection } from '../types/Projection'; import { getMpUnlimitWxaCode } from '../aspects/wechatQrCode'; import { BackendRuntimeContext as BRC } from 'oak-frontend-base'; -import { cloneDeep, unset } from 'oak-domain/lib/utils/lodash'; +import { cloneDeep } from 'oak-domain/lib/utils/lodash'; import { composeServerUrl } from '../utils/domain'; /** * general数据结构要求的后台上下文 @@ -37,11 +37,13 @@ export class BackendRuntimeContext extends BRC { } } } - else if (['application', 'system', 'platform'].includes(entity)) { - // todo 删除掉config中的敏感返回信息 - const rowDict = d[entity]; + else if (['application', 'system', 'platform'].includes(entity) + && process.env.NODE_ENV !== 'development') { + // 删除掉config中的敏感返回信息 + // 目前删掉会影响前端上传,原因待核实 + /* const rowDict = d[entity as 'system']; for (const id in rowDict) { - const { config } = rowDict[id]; + const { config } = rowDict[id] as EntityDict['system']['OpSchema']; if (config) { // application中可能的保密信息 unset(config, 'appSecret'); @@ -52,16 +54,18 @@ export class BackendRuntimeContext extends BRC { // server/platform中可能的保密信息 if (config.Account) { for (const k in config.Account) { - config.Account[k]?.forEach((ele) => { - unset(ele, 'securityKey'); - unset(ele, 'secretKey'); - unset(ele, 'webApiKey'); - unset(ele, 'accessKeySecret'); - }); + config.Account[k as keyof typeof config.Account]?.forEach( + (ele) => { + unset(ele, 'securityKey'); + unset(ele, 'secretKey'); + unset(ele, 'webApiKey'); + unset(ele, 'accessKeySecret'); + } + ); } } } - } + } */ } } } diff --git a/lib/context/BackendRuntimeContext.js b/lib/context/BackendRuntimeContext.js index c874798ee..2ab438ec6 100644 --- a/lib/context/BackendRuntimeContext.js +++ b/lib/context/BackendRuntimeContext.js @@ -40,31 +40,35 @@ class BackendRuntimeContext extends oak_frontend_base_1.BackendRuntimeContext { } } } - else if (['application', 'system', 'platform'].includes(entity)) { - // todo 删除掉config中的敏感返回信息 - const rowDict = d[entity]; + else if (['application', 'system', 'platform'].includes(entity) + && process.env.NODE_ENV !== 'development') { + // 删除掉config中的敏感返回信息 + // 目前删掉会影响前端上传,原因待核实 + /* const rowDict = d[entity as 'system']; for (const id in rowDict) { - const { config } = rowDict[id]; + const { config } = rowDict[id] as EntityDict['system']['OpSchema']; if (config) { // application中可能的保密信息 - (0, lodash_1.unset)(config, 'appSecret'); - (0, lodash_1.unset)(config, 'server.token'); - (0, lodash_1.unset)(config, 'server.mode'); - (0, lodash_1.unset)(config, 'server.encodingAESKey'); - (0, lodash_1.unset)(config, 'wechat.appSecret'); + unset(config, 'appSecret'); + unset(config, 'server.token'); + unset(config, 'server.mode'); + unset(config, 'server.encodingAESKey'); + unset(config, 'wechat.appSecret'); // server/platform中可能的保密信息 if (config.Account) { for (const k in config.Account) { - config.Account[k]?.forEach((ele) => { - (0, lodash_1.unset)(ele, 'securityKey'); - (0, lodash_1.unset)(ele, 'secretKey'); - (0, lodash_1.unset)(ele, 'webApiKey'); - (0, lodash_1.unset)(ele, 'accessKeySecret'); - }); + config.Account[k as keyof typeof config.Account]?.forEach( + (ele) => { + unset(ele, 'securityKey'); + unset(ele, 'secretKey'); + unset(ele, 'webApiKey'); + unset(ele, 'accessKeySecret'); + } + ); } } } - } + } */ } } } diff --git a/src/context/BackendRuntimeContext.ts b/src/context/BackendRuntimeContext.ts index 8ed9d7ba4..7795e8f7d 100644 --- a/src/context/BackendRuntimeContext.ts +++ b/src/context/BackendRuntimeContext.ts @@ -58,9 +58,11 @@ export abstract class BackendRuntimeContext