TASK22019: phase 9 harden file handlers hash guards and negative paths
This commit is contained in:
@@ -17,10 +17,17 @@ ApiProxy.use(middleware);
|
||||
ApiProxy.get(async (req, res) => {
|
||||
var containerName = req.query.ident;
|
||||
var checkHash = req.query.hash;
|
||||
var checkquerypath = "/api/file/setupcontainer?ident=" + containerName;
|
||||
|
||||
//console.log(checkquerypath, hashAPIPath(checkquerypath), checkHash);
|
||||
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
if (
|
||||
typeof containerName === "undefined" ||
|
||||
containerName.length === 0 ||
|
||||
typeof checkHash === "undefined" ||
|
||||
checkHash.length === 0
|
||||
) {
|
||||
return res.status(400).json();
|
||||
}
|
||||
|
||||
var checkquerypath = "/api/file/setupcontainer?ident=" + containerName;
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await createContainer(containerName)
|
||||
@@ -32,11 +39,6 @@ ApiProxy.get(async (req, res) => {
|
||||
res.status(400).json(error);
|
||||
});
|
||||
} else {
|
||||
consoleLogger({
|
||||
name: "setupcontainer",
|
||||
code: "bad hash",
|
||||
query: JSON.stringify(req.query)
|
||||
});
|
||||
return res.status(400).json();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user