We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 166151c + e9afd60 commit 6bc6d60Copy full SHA for 6bc6d60
scripts/server.js
@@ -23,7 +23,12 @@ http
23
if (uri === '/test/') {
24
uri = '/test/index.html';
25
}
26
- filename = path.join(process.cwd(), uri);
+ filename = fs.realpathSync(path.resolve(process.cwd(), uri));
27
+ if (!filename.startsWith(process.cwd())) {
28
+ res.writeHead(403, { 'Content-Type': 'text/plain' });
29
+ res.end('403 Forbidden\n');
30
+ return;
31
+ }
32
33
domain.on('error', function () {
34
res.writeHead(404, { 'Content-Type': 'text/plain' });
0 commit comments