- /api/system/configs 无需登录,此前原样下发 map_location_config(腾讯位置服务 SecretKey)与 security_words(风控词库) - getPlatformConfigs 改为:排除 security_words/map_location_config,并递归剔除 secret/private/apiv3/token/pem/cert/mchid 等敏感字段 - wechat_pay_config 仍仅返回脱敏字段(mode/appId/mchIdConfigured) - 新增回归护栏 public-config-privacy.spec.ts(89 套件/644 用例全绿);冒烟 5/5
24 行
1.0 KiB
TypeScript
24 行
1.0 KiB
TypeScript
// 已读取AGENTS.md
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
/**
|
|
* 第七十三批回归闸门:移动端公开配置不得泄露密钥/风控数据。
|
|
* 背景:/api/system/configs 无需登录,曾原样下发 map_location_config(含 SecretKey) 与 security_words(风控词库)。
|
|
*/
|
|
describe('第七十三批公开配置隐私闸门', () => {
|
|
const root = path.resolve(__dirname, '../../');
|
|
const repo = fs.readFileSync(path.join(root, 'server/src/db/repository.ts'), 'utf-8');
|
|
|
|
it('公开配置排除风控词库与地图密钥配置', () => {
|
|
expect(repo).toContain("const PUBLIC_EXCLUDED_KEYS = new Set(['security_words', 'map_location_config'])");
|
|
expect(repo).toContain('if (PUBLIC_EXCLUDED_KEYS.has(r.configKey)) continue;');
|
|
});
|
|
|
|
it('公开配置递归剔除敏感字段', () => {
|
|
expect(repo).toContain('const stripSensitive = (val: any)');
|
|
expect(repo).toContain('if (SENSITIVE_FIELD.test(k)) continue;');
|
|
expect(repo).toContain('result[r.configKey] = stripSensitive(val);');
|
|
});
|
|
});
|