Harden verify-work checkpoint rendering

This commit is contained in:
3metaJun
2026-03-24 01:16:27 +08:00
committed by Tom Boucher
parent f43e0237f2
commit aaaa8e96fe
7 changed files with 249 additions and 15 deletions

View File

@@ -14,6 +14,7 @@ const {
requireSafePath,
scanForInjection,
sanitizeForPrompt,
sanitizeForDisplay,
safeJsonParse,
validatePhaseNumber,
validateFieldName,
@@ -244,6 +245,19 @@ describe('sanitizeForPrompt', () => {
});
});
describe('sanitizeForDisplay', () => {
test('removes protocol leak lines', () => {
const input = 'Visible line\nuser to=all:final code something bad\nAnother line';
const result = sanitizeForDisplay(input);
assert.equal(result, 'Visible line\nAnother line');
});
test('keeps normal user-facing copy intact', () => {
const input = 'Type `pass` or describe what\\\'s wrong.';
assert.equal(sanitizeForDisplay(input), input);
});
});
// ─── Shell Safety ───────────────────────────────────────────────────────────
describe('validateShellArg', () => {