Skip to content

Commit 4cae3d4

Browse files
JafarAkhondaliglasstigergoodroot
authoredMar 12, 2025
fix(web-console): fixing a Path Traversal Vulnerability (#321)
Block malicious looking requests to prevent path traversal attacks. Co-authored-by: glasstiger <94906625+glasstiger@users.noreply.github.com> Co-authored-by: goodroot <9484709+goodroot@users.noreply.github.com>
1 parent 3f4358c commit 4cae3d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎packages/web-console/serve-dist.js

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ const path = require("path")
66
const contextPath = process.env.QDB_HTTP_CONTEXT_WEB_CONSOLE || ""
77

88
const server = http.createServer((req, res) => {
9+
if (path.normalize(decodeURI(req.url)) !== decodeURI(req.url)) {
10+
res.statusCode = 403;
11+
res.end();
12+
return;
13+
}
914
const { method } = req
1015
const baseUrl = "http://" + req.headers.host + contextPath;
1116
const reqUrl = new url.URL(req.url, baseUrl);

0 commit comments

Comments
 (0)
Failed to load comments.