mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Fix example in JavaScript query
This commit is contained in:
@@ -4,8 +4,8 @@ var app = require("express")(),
|
||||
app.get("/user-files", function(req, res) {
|
||||
var file = req.param("file");
|
||||
if (file.indexOf("..") !== -1) {
|
||||
// BAD
|
||||
// forbid paths outside the /public directory
|
||||
// BAD: we forbid relative paths that contain ..
|
||||
// as these could leave the public directory
|
||||
res.status(400).send("Bad request");
|
||||
} else {
|
||||
var absolute = path.resolve("/public/" + file);
|
||||
|
||||
@@ -3,9 +3,9 @@ var app = require("express")(),
|
||||
|
||||
app.get("/user-files", function(req, res) {
|
||||
var file = req.param("file");
|
||||
if (typeof path !== 'string' || file.indexOf("..") !== -1) {
|
||||
// BAD
|
||||
// forbid paths outside the /public directory
|
||||
if (typeof file !== 'string' || file.indexOf("..") !== -1) {
|
||||
// BAD: we forbid relative paths that contain ..
|
||||
// as these could leave the public directory
|
||||
res.status(400).send("Bad request");
|
||||
} else {
|
||||
var absolute = path.resolve("/public/" + file);
|
||||
|
||||
Reference in New Issue
Block a user