增加了过滤敏感信息的代码

This commit is contained in:
Xu Chang 2024-05-17 16:16:59 +08:00
parent 8565bb3017
commit a6e5c94e57
1 changed files with 22 additions and 1 deletions

View File

@ -17,7 +17,7 @@ import { SelectOpResult } from 'oak-domain/lib/types';
import { applicationProjection } from '../types/Projection';
import { getMpUnlimitWxaCode } from '../aspects/wechatQrCode';
import { BackendRuntimeContext as BRC } from 'oak-frontend-base';
import { cloneDeep } from 'oak-domain/lib/utils/lodash';
import { cloneDeep, unset } from 'oak-domain/lib/utils/lodash';
/**
* general数据结构要求的后台上下文
*/
@ -59,6 +59,27 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
['application', 'system', 'platform'].includes(entity)
) {
// todo 删除掉config中的敏感返回信息
const rowDict = d[entity as 'system'];
for (const id in rowDict) {
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
if (config) {
// application中可能的保密信息
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) {
unset(config.Account[k as keyof typeof config.Account], 'securityKey');
unset(config.Account[k as keyof typeof config.Account], 'secretKey');
unset(config.Account[k as keyof typeof config.Account], 'webApiKey');
unset(config.Account[k as keyof typeof config.Account], 'accessKeySecret');
}
}
}
}
}
}
}