JS: format qhelp examples

This commit is contained in:
Esben Sparre Andreasen
2019-06-03 17:05:19 +02:00
parent 9e0a97e82f
commit 04868e5b97
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
app.get('/some/path', function(req, res) {
app.get("/some/path", function(req, res) {
let url = req.param("url");
// BAD: the host of `url` may be controlled by an attacker
if (url.match(/https?:\/\/www\.example\.com\//)) {
if (url.match(/https?:\/\/www\.example\.com\//)) {
res.redirect(url);
}
});

View File

@@ -1,7 +1,7 @@
app.get('/some/path', function(req, res) {
app.get("/some/path", function(req, res) {
let url = req.param("url");
// GOOD: the host of `url` can not be controlled by an attacker
if (url.match(/^https?:\/\/www\.example\.com\//)) {
if (url.match(/^https?:\/\/www\.example\.com\//)) {
res.redirect(url);
}
});