From 82de4de5ab92e8237d713285104e4b8452927352 Mon Sep 17 00:00:00 2001 From: KoyamaSohei Date: Fri, 13 Dec 2019 14:38:56 +0900 Subject: [PATCH] examples: fix path traversal in downloads example closes #4120 --- examples/downloads/index.js | 7 ++++++- package.json | 1 + test/acceptance/downloads.js | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/downloads/index.js b/examples/downloads/index.js index 91c52bb87c..62e7fa6e3e 100644 --- a/examples/downloads/index.js +++ b/examples/downloads/index.js @@ -6,8 +6,13 @@ var express = require('../../'); var path = require('path'); +var resolvePath = require('resolve-path') + var app = module.exports = express(); +// path to where the files are stored on disk +var FILES_DIR = path.join(__dirname, 'files') + app.get('/', function(req, res){ res.send('