Explainer videos and product demos made by your AI agent. Free and open source: a local voice (Kokoro), word timing (Whisper) and a canvas renderer turn a script into a narrated MP4.
JavaScript ai-agentsanimationcanvasclaude-codecodexexplainer-videoffmpegjavascriptkokoroproduct-demotext-to-speechvideo-generationwhisper
Preview server: refuse uploads onto symlinks that point to missing files
Vincent Schmalbach9497bec6852a
diff --git a/src/server.js b/src/server.jsindex 692cb95..c2a1dfe 100644--- a/src/server.js+++ b/src/server.js@@ -81,8 +81,14 @@ function uploadFile(projectDir, rel) {if (realProbe !== realProject && !underRoot(realProbe)) return null;fs.mkdirSync(path.dirname(dest), { recursive: true });if (!underRoot(fs.realpathSync(path.dirname(dest)))) return null;- if (fs.existsSync(dest) && fs.lstatSync(dest).isSymbolicLink()) return null;- return dest;+ // lstat, not existsSync: a symlink to a missing file must be refused too.+ let link = false;+ try {+ link = fs.lstatSync(dest).isSymbolicLink();+ } catch {+ link = false;+ }+ return link ? null : dest;}export function startServer({ projectDir, getState, port = 0 }) {diff --git a/test/server.test.js b/test/server.test.jsindex 58d3258..2cf67fb 100644--- a/test/server.test.js+++ b/test/server.test.js@@ -54,6 +54,9 @@ test('the preview server keeps secrets and sources safe', async () => {fs.symlinkSync(path.join(dir, 'scenes.js'), path.join(dir, 'build', 'source-link.js'));assert.equal((await put('build/source-link.js')).status, 400);assert.equal(fs.readFileSync(path.join(dir, 'scenes.js'), 'utf8'), 'export default {};');+ fs.symlinkSync(path.join(outside, 'new.png'), path.join(dir, 'build', 'dangling.png'));+ assert.equal((await put('build/dangling.png')).status, 400);+ assert.ok(!fs.existsSync(path.join(outside, 'new.png')));fs.symlinkSync(outside, path.join(dir, 'out', 'elsewhere'));assert.equal((await put('out/elsewhere/x.png')).status, 400);assert.ok(!fs.existsSync(path.join(outside, 'x.png')));