From 528dbea019a146a251c5e8551eb08254df63c1cc Mon Sep 17 00:00:00 2001 From: haelyra <49814733+haelyra@users.noreply.github.com> Date: Mon, 24 Aug 2026 20:13:18 -0400 Subject: [PATCH] test(security): reject symlinked guided install sources --- tests/lib/multi-harness-setup.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/lib/multi-harness-setup.test.js b/tests/lib/multi-harness-setup.test.js index 51598ecc8..f6098e4b5 100644 --- a/tests/lib/multi-harness-setup.test.js +++ b/tests/lib/multi-harness-setup.test.js @@ -196,6 +196,31 @@ function writeManagedState(plan, overrides = {}) { } }); + await test('rejects an identical copy source that is a symbolic link', () => { + if (process.platform === 'win32') return; + const root = tempDir('ecc-guided-source-symlink-'); + try { + const realSource = path.join(root, 'real-source.md'); + const linkedSource = path.join(root, 'linked-source.md'); + const destination = path.join(root, 'AGENTS.md'); + writeFile(realSource, 'same\n'); + writeFile(destination, 'same\n'); + fs.symlinkSync(realSource, linkedSource); + const plan = managedPlan(root, [{ + kind: 'copy-file', + sourcePath: linkedSource, + destinationPath: destination, + }]); + + assert.throws( + () => preflightManagedPlan(plan), + /symbolic link|regular non-symlink/i + ); + } finally { + fs.rmSync(root, { recursive: true, force: true }); + } + }); + await test('rejects valid install-state from a different managed target identity', () => { const root = tempDir('ecc-guided-forged-target-'); try {