Commit aa971d6a authored by Tim Neutkens's avatar Tim Neutkens Committed by Arunoda Susiripala

Disallow directories in /static (#1028)

parent 01cc8984
......@@ -182,6 +182,12 @@ export async function serveStaticWithGzip (req, res, path) {
export function serveStatic (req, res, path) {
return new Promise((resolve, reject) => {
send(req, path)
.on('directory', () => {
// We don't allow directories to be read.
const err = new Error('No directory access')
err.code = 'ENOENT'
reject(err)
})
.on('error', reject)
.pipe(res)
.on('finish', resolve)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment