feat(policy): 未分类工具默认拦截,问清只读还是改动、登记后才放行(POLICY_VERSION 0.5.0)
This commit is contained in:
parent
6edacc3065
commit
6b557f8cf2
|
|
@ -137,6 +137,20 @@ test('keeps management tool audit and approval rules', () => {
|
|||
assert.match(evaluateToolPolicy('bingbu', 'automation_create', [approvedTask('bingbu')]), /门下省准奏记录/)
|
||||
})
|
||||
|
||||
test('blocks unclassified tools by default instead of treating them as read-only', () => {
|
||||
// 没在任何名单里的工具:执行部门、任务已准奏也先拦;丞相同样拦
|
||||
assert.match(evaluateToolPolicy('gongbu', 'some_future_tool', [approvedTask('gongbu')]), /尚未登记分类/)
|
||||
assert.match(evaluateToolPolicy('lead', 'some_future_tool', []), /尚未登记分类/)
|
||||
// 登记在册的只读工具照常放行
|
||||
for (const tool of ['read', 'grep', 'glob']) {
|
||||
assert.equal(evaluateToolPolicy('zhongshu', tool, []), undefined)
|
||||
assert.equal(evaluateToolPolicy('gongbu', tool, []), undefined)
|
||||
}
|
||||
// 签字类工具:没签字拦在签字关;签了字放行,不被未知工具规则误伤
|
||||
assert.match(evaluateToolPolicy('bingbu', 'remote_ssh_delete', [approvedTask('bingbu')]), /人工签字/)
|
||||
assert.equal(evaluateToolPolicy('bingbu', 'remote_ssh_delete', [approvedTask('bingbu')], { humanSigned: true }), undefined)
|
||||
})
|
||||
|
||||
test('parses the department model command the panel sends', async () => {
|
||||
const { parseDeptModelCommand, describeDeptRoutes, readStoredRoutes, writeStoredRoutes } = await import('../index.js')
|
||||
assert.deepEqual(parseDeptModelCommand('gongbu deepseek deepseek-chat high'), {
|
||||
|
|
|
|||
Loading…
Reference in New Issue