mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
recognize barrier guard where the result is stored in a variable
This commit is contained in:
@@ -68,3 +68,20 @@ app.get('/user/:id', function(req, res) {
|
||||
|
||||
res.send(escapeHtml1(url)); // OK
|
||||
});
|
||||
|
||||
const matchHtmlRegExp = /["'&<>]/;
|
||||
function escapeHtml2 (string) {
|
||||
const str = '' + string;
|
||||
const match = matchHtmlRegExp.exec(str);
|
||||
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
app.get('/user/:id', function(req, res) {
|
||||
const url = req.params.id;
|
||||
|
||||
res.send(escapeHtml2(url)); // OK
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user