暂时先封掉对加密数据的处理

This commit is contained in:
Xu Chang 2024-05-22 13:56:15 +08:00
parent ce0068b7b8
commit f973e923ba
3 changed files with 41 additions and 31 deletions

View File

@ -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');
}
);
}
}
}
}
} */
}
}
}

View File

@ -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');
}
);
}
}
}
}
} */
}
}
}

View File

@ -58,9 +58,11 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
}
} else if (
['application', 'system', 'platform'].includes(entity)
&& process.env.NODE_ENV !== 'development'
) {
// todo 删除掉config中的敏感返回信息
const rowDict = d[entity as 'system'];
// 删除掉config中的敏感返回信息
// 目前删掉会影响前端上传,原因待核实
/* const rowDict = d[entity as 'system'];
for (const id in rowDict) {
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
if (config) {
@ -84,7 +86,7 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
}
}
}
}
} */
}
}
}