mirror of
https://github.com/mathuo/dockview
synced 2025-02-12 19:35:45 +00:00
Block malicious looking requests to prevent path traversal attacks.
This commit is contained in:
parent
1a9ee8c34e
commit
fe39c475a2
@ -35,5 +35,10 @@ function write(res, file) {
|
|||||||
|
|
||||||
http.createServer((req, res) => {
|
http.createServer((req, res) => {
|
||||||
const route = req.url.split('/').slice(1);
|
const route = req.url.split('/').slice(1);
|
||||||
|
if (route.includes('..')) {
|
||||||
|
res.writeHead(403);
|
||||||
|
res.end('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
write(res, route);
|
write(res, route);
|
||||||
}).listen(PORT, HOST);
|
}).listen(PORT, HOST);
|
||||||
|
Loading…
Reference in New Issue
Block a user