- 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
59 lines
2.5 KiB
JavaScript
59 lines
2.5 KiB
JavaScript
/**
|
||
* TC-SPACE_SECURITY-005 · 条件不满足时不能办理日志存证安全
|
||
* REQ-075 [FL-15.2] 反向/等价类 P0
|
||
*
|
||
* 前置:【空间运行安全】对应的功能页面可打开 / 已准备错误数据
|
||
* 步骤:使用错误数据办理日志存证 → 查看提示与数据
|
||
* 预期:写入接口对缺关键字段拒绝并说明原因;原有数据和状态不变
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-SPACE_SECURITY-005',
|
||
req: 'REQ-075',
|
||
title: '条件不满足时不能办理日志存证安全',
|
||
type: '反向/等价类',
|
||
priority: 'P0',
|
||
route: '/tds/chain',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.login()
|
||
let before = 0
|
||
|
||
await t.step('前置:记录当前存证条数', async () => {
|
||
const r = await t.api('GET', '/api/ssw/tds/ChainEvidence/List')
|
||
before = Array.isArray(r.data) ? r.data.length : 0
|
||
t.assert(true, `前条数 ${before}`)
|
||
})
|
||
|
||
await t.step('写入:缺 bizType / bizId / contentHash 都被拒', async () => {
|
||
const cases = [
|
||
{ body: {}, need: /bizType|不能为空/ },
|
||
{ body: { bizType: 'CONTRACT' }, need: /bizId|不能为空/ },
|
||
{ body: { bizType: 'CONTRACT', bizId: 'x' }, need: /contentHash|不能为空/ },
|
||
{ body: { bizType: '', bizId: 'x', contentHash: 'a'.repeat(64) }, need: /bizType|不能为空/ },
|
||
{ body: { bizType: 'CONTRACT', bizId: '', contentHash: 'a'.repeat(64) }, need: /bizId|不能为空/ },
|
||
{ body: { bizType: 'CONTRACT', bizId: 'x', contentHash: '' }, need: /contentHash|不能为空/ }
|
||
]
|
||
for (const c of cases) {
|
||
const r = await t.api('POST', '/api/ssw/tds/ChainEvidence/Write', c.body)
|
||
t.assert(r.code !== 200, `缺关键字段被拒(code=${r.code} msg=${r.msg})`)
|
||
t.assert(c.need.test(r.msg || ''), `提示命中「${c.need}」(实际「${r.msg}」)`)
|
||
}
|
||
})
|
||
|
||
await t.step('无 token 写入被拒', async () => {
|
||
const r = await t.api('POST', '/api/ssw/tds/ChainEvidence/Write', {
|
||
bizType: 'CONTRACT',
|
||
bizId: 'no-auth',
|
||
contentHash: 'a'.repeat(64)
|
||
}, { token: 'bearer invalid-token' })
|
||
t.assert(r.code === 401 || r.code === 403 || (r.code !== 200 && r.code !== undefined), `无凭证写入被拒(code=${r.code})`)
|
||
})
|
||
|
||
await t.step('核对原有数据条数不变', async () => {
|
||
const r = await t.api('GET', '/api/ssw/tds/ChainEvidence/List')
|
||
const after = Array.isArray(r.data) ? r.data.length : 0
|
||
t.assert(after === before, `存证总数未增长(${before} → ${after})`)
|
||
})
|
||
} |