fix(bridge): 拦截商机引用泄露

This commit is contained in:
wangliang
2026-10-23 14:35:00 +08:00
parent 22de20e718
commit 4902cc632f
3 changed files with 16 additions and 2 deletions
+14
View File
@@ -194,3 +194,17 @@ test('guard: CRM wording is replaced with a colleague follow-up, not a cart note
assert.match(r.content, /request has been noted/i);
assert.doesNotMatch(r.content, /account cart/i);
});
test('guard: strips leaked opportunity reference labels', () => {
const r = guardReply({
content: '🎯\n**Opportunity reference**: *Acme GmbH — 500 rings*\nOur sales team will contact you shortly.',
toolResults: [{ created: true, opportunity_id: 'opp-1' }],
toolCalls: [{ name: 'create_opportunity', ok: true }],
lang: 'en',
});
assert.equal(r.blocked, true);
assert.ok(r.reasons.includes('internal_crm'));
assert.doesNotMatch(r.content, /opportunity/i);
assert.match(r.content, /sales team will contact you/i);
assert.doesNotMatch(r.content, /account cart/i);
});