Skip to content
Snippets Groups Projects
Commit a8bf6383 authored by Ferenc Schulcz's avatar Ferenc Schulcz
Browse files

Add further sanitization

parent 42446e3d
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ module.exports = function () {
const domain = req.query.domain;
const format = /^[a-zA-Z0-9\-]*$/;
if (!format.test(domain)) {
if (!format.test(domain) || domain == "") {
res.locals.statuscode = 400;
res.locals.answer = { message: "Domain name must only contain English letters, numbers and dash (-)." };
next();
......
......@@ -30,6 +30,14 @@ module.exports = function () {
const token = req.query.token;
const ip = req.query.ip;
const format = /^[0-9.]*$/;
if (!format.test(ip) || ip == "") {
res.locals.statuscode = 400;
res.locals.answer = { message: "Wrong IP format. Should be IPv4." };
next();
return;
}
return db.getDomain(token)
.catch(() => {
res.locals.statuscode = 500;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment