/** * TC-COMPLIANCE_API-002 · 条件不满足时不能办理运行日志上报(接口) * REQ-029 [FL-15.x] 反向/等价类 P0 */ export const meta = { tc: 'TC-COMPLIANCE_API-002', req: 'REQ-029', title: '条件不满足时不能办理运行日志上报', type: '反向/等价类', priority: 'P0', needs: ['be'] } export async function run(t) { await t.login() // 缺 content const r1 = await t.api('POST', '/api/ssw/tds/Regulatory/RunSummary', { level: 'INFO' }) t.assert(r1.code !== 200 || /不能为空|必填/.test(r1.msg || ''), `缺 content 被拒:code=${r1.code} msg=${r1.msg || ''}`) // 非法 level const r2 = await t.api('POST', '/api/ssw/tds/Regulatory/RunSummary', { content: 'x', level: 'INVALID_LEVEL' }) t.assert(r2.code !== 200 || /级别|level|枚举/.test(r2.msg || ''), `非法 level 被拒:code=${r2.code} msg=${r2.msg || ''}`) // XSS 注入尝试 const r3 = await t.api('POST', '/api/ssw/tds/Regulatory/RunSummary', { content: '', level: 'INFO' }) t.assert(r3.code === 200 || r3.code !== undefined, `XSS payload 未让接口崩溃(code=${r3.code})`) }