- 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
55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
/**
|
||
* TC-REL-002 · 非法指令不导致崩溃或丢数据
|
||
* REQ-Q-REL 质量特性-可靠性 正向 P0
|
||
*
|
||
* 前置:1. 已登录系统 2. 具有相应操作权限
|
||
* 步骤:1. 执行用户文件中明确规定的非法指令 2. 观察系统行为
|
||
* 预期:1. 系统不崩溃、不丢失数据
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-REL-002',
|
||
req: 'Q-REL',
|
||
title: '非法指令不导致崩溃或丢数据',
|
||
type: '正向',
|
||
priority: 'P0',
|
||
route: '/tds/contracts',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.step('前置:登录系统', async () => {
|
||
await t.login()
|
||
})
|
||
|
||
await t.step('用畸形 payload 直打后端:SQL 注入/特殊字符/null 字段', async () => {
|
||
// 缺失必填
|
||
const r1 = await t.api('POST', '/api/ssw/tds/Contract', { name: 'x' })
|
||
t.assert(r1.code !== 200, `缺必填字段被后端拒绝(code=${r1.code} msg=${r1.msg?.slice(0,40) ?? ''})`)
|
||
// 空对象
|
||
const r2 = await t.api('POST', '/api/ssw/tds/Contract', {})
|
||
t.assert(r2.code !== 200, `空对象被后端拒绝(code=${r2.code})`)
|
||
// 超长字符串
|
||
const r3 = await t.api('POST', '/api/ssw/tds/Contract', {
|
||
contractCode: 'B'.repeat(2000),
|
||
name: '非法-' + 'C'.repeat(2000)
|
||
})
|
||
t.assert(r3.code !== 200, `超长字符串被后端拒绝(code=${r3.code})`)
|
||
// SQL 注入式
|
||
const r4 = await t.api('POST', '/api/ssw/tds/Contract', {
|
||
contractCode: "';DROP TABLE ssw_tds_contract;--",
|
||
name: "1' OR '1'='1"
|
||
})
|
||
t.assert(r4.code !== 200, `SQL 注入式 payload 被后端拒绝(code=${r4.code})`)
|
||
})
|
||
|
||
await t.step('页面入口:必填校验拦截,列表仍可访问', async () => {
|
||
await t.goto('/tds/contracts')
|
||
await t.expectVisible('.ant-table', '数字合约管理页面仍可正常打开')
|
||
await t.openCreate()
|
||
await t.save()
|
||
await t.expectReject('不能为空')
|
||
await t.cancelDrawer()
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
} |