- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
74 lines
3.0 KiB
JavaScript
74 lines
3.0 KiB
JavaScript
/**
|
||
* TC-USAGE-005 · 修改数据后数据使用环境校验失败
|
||
* REQ-016 [FL-6.2] 反向/错误推测 P0
|
||
*
|
||
* 前置:已准备测试副本和原始记录,用于前后对比。
|
||
* 步骤:1. 修改测试副本的关键内容,或使用无效凭证访问
|
||
* 2. 提交读取、验证或处理操作
|
||
* 3. 查看提示、原始记录和异常记录
|
||
* 预期:系统发现数据被修改或凭证无效后,不再继续处理。原始记录不变,并能查到异常记录。
|
||
*
|
||
* 注:本用例通过 DeliveryTask 校验的篡改场景:
|
||
* 1. Finish 已 DENIED 任务 —— 任务已终止,不能再回填结果
|
||
* 2. 对不存在 id 写 Policy —— 凭证无效场景
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-USAGE-005',
|
||
req: 'REQ-016',
|
||
title: '修改数据后数据使用环境校验失败',
|
||
type: '反向/错误推测',
|
||
priority: 'P0',
|
||
route: '/tdc/delivery',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let before = 0
|
||
let deniedTask = null
|
||
|
||
await t.step('前置:登录并记录原始任务数', async () => {
|
||
await t.login()
|
||
const list = await t.apiList('/api/ssw/tdc/DeliveryTask')
|
||
before = list.length
|
||
t.assert(true, `操作前交付任务共 ${before} 条`)
|
||
})
|
||
|
||
await t.step('篡改场景 1:对已 DENIED 任务回填 Finish 必须被拒', async () => {
|
||
const deniedList = await t.apiList('/api/ssw/tdc/DeliveryTask', { status: 'DENIED' })
|
||
deniedTask = deniedList[0]
|
||
if (!deniedTask) t.skip('库中无 DENIED 任务,跳过本子步骤')
|
||
|
||
const res = await t.api('PUT', `/api/ssw/tdc/DeliveryTask/${deniedTask.id}/Finish`, {
|
||
success: true,
|
||
recordCount: 1,
|
||
dataSize: 100
|
||
})
|
||
t.assert(res.code !== 200, `已 DENIED 任务 Finish 被拒绝(code=${res.code}, msg=${res.msg})`)
|
||
t.assert(
|
||
typeof res.msg === 'string' && (res.msg.includes('终止') || res.msg.includes('DENIED') || res.msg.includes('状态')),
|
||
`拒绝原因指向任务已终止:${res.msg}`
|
||
)
|
||
})
|
||
|
||
await t.step('篡改场景 2:对不存在的 taskId 写 Policy 应被拒', async () => {
|
||
const fakeId = `FAKE-TASK-${t.runId}`
|
||
const res = await t.api('PUT', `/api/ssw/tdc/DeliveryTask/${fakeId}/Policy`, {
|
||
policyResult: 'ALLOW'
|
||
})
|
||
t.assert(res.code !== 200, `无效凭证(不存在 id)被后端拒绝(code=${res.code})`)
|
||
})
|
||
|
||
await t.step('核对原始记录不被篡改', async () => {
|
||
const after = await t.apiList('/api/ssw/tdc/DeliveryTask')
|
||
t.assert(after.length === before, `列表条数不变(${before} → ${after.length})`)
|
||
if (deniedTask) {
|
||
// 默认分页只返回前 20 条;用 info 接口按 id 精确查
|
||
const same = await t.api('GET', `/api/ssw/tdc/DeliveryTask/${deniedTask.id}`)
|
||
t.assert(same.code === 200 && same.data, `被拒操作的 DENIED 任务仍可被 info 接口查到(原始记录未丢)`)
|
||
t.assert(same.data.status === 'DENIED', `该任务状态保持 DENIED 未被改写(实际 ${same.data.status})`)
|
||
}
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
}
|