chore: 保存 Agent 安全优化前基线

This commit is contained in:
Logan.Li committed 2026-09-02 23:31:38 +08:00
1 parent 08696896f9
commit ff016347cd
116 files changed
+3858 -2485

No files matched your search

+8
View File
@@ -31,6 +31,14 @@ describe('Agent command guardrail', () => {
expect(agentCommandNeedsConfirmation('critical', 'strict')).toBe(false)
})
it('confirm-all still auto-runs only the read-only whitelist', () => {
expect(agentCommandNeedsConfirmation('safe', 'relaxed', true)).toBe(false)
expect(agentCommandNeedsConfirmation('low', 'relaxed', true)).toBe(true)
expect(agentCommandNeedsConfirmation('medium', 'strict', true)).toBe(true)
expect(agentCommandNeedsConfirmation('high', 'relaxed', true)).toBe(true)
expect(agentCommandNeedsConfirmation('critical', 'relaxed', true)).toBe(false)
})
it('fingerprints similar temp-path commands for session Always', () => {
expect(agentCommandAllowFingerprint('rm /tmp/tmp.3RUZRHTwk2', 'high')).toBe(
agentCommandAllowFingerprint('rm /tmp/tmp.ABCDEFG123', 'high')