test(ai-psychosis): extend privacy canary to pattern-phrase leak
This commit is contained in:
parent
146cf8ba35
commit
767bc06c51
1 changed files with 22 additions and 0 deletions
|
|
@ -41,4 +41,26 @@ describe('privacy', () => {
|
|||
const allContent = readAllFiles(dir);
|
||||
assert.ok(!allContent.includes(canary), `Canary "${canary}" found in data files — privacy violation`);
|
||||
});
|
||||
|
||||
it('never leaks matched-pattern phrases through full lifecycle', () => {
|
||||
dir = setupTestDir();
|
||||
const matchedPhrase = 'are you sure';
|
||||
const canary = 'CANARY_PRIVACY_xyz123';
|
||||
const prompt = `${matchedPhrase}? ${canary}`;
|
||||
|
||||
runHook('session-start.mjs', { session_id: 'priv2', cwd: '/tmp' }, dir);
|
||||
runHook('prompt-analyzer.mjs', { session_id: 'priv2', prompt }, dir);
|
||||
runHook('tool-tracker.mjs', { session_id: 'priv2', tool_name: 'Edit' }, dir);
|
||||
runHook('session-end.mjs', { session_id: 'priv2', cwd: '/tmp' }, dir);
|
||||
|
||||
const allContent = readAllFiles(dir);
|
||||
assert.ok(
|
||||
!allContent.includes(canary),
|
||||
`Canary "${canary}" leaked — pattern-match did not protect prompt text`
|
||||
);
|
||||
assert.ok(
|
||||
!allContent.toLowerCase().includes(matchedPhrase),
|
||||
`Matched phrase "${matchedPhrase}" leaked — pattern name or trigger phrase written to disk`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue