mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
add tests
This commit is contained in:
@@ -466,3 +466,25 @@ function domMethods() {
|
||||
let cell = row.insertCell();
|
||||
cell.innerHTML = source; // NOT OK
|
||||
}
|
||||
|
||||
function urlStuff() {
|
||||
var url = document.location.search.substr(1);
|
||||
|
||||
$("<a>", {href: url}).appendTo("body"); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("#foo").attr("href", url); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("#foo").attr({href: url}); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("<img>", {src: url}).appendTo("body"); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("<a>", {href: win.location.href}).appendTo("body"); // OK
|
||||
|
||||
$("<img>", {src: "http://google.com/" + url}).appendTo("body"); // OK
|
||||
|
||||
$("<img>", {src: ["http://google.com", url].join("/")}).appendTo("body"); // OK
|
||||
|
||||
if (url.startsWith("https://")) {
|
||||
$("<img>", {src: url}).appendTo("body"); // OK
|
||||
} else {
|
||||
$("<img>", {src: url}).appendTo("body"); // NOT OK - but not detected [INCONSISTENCY]
|
||||
}
|
||||
|
||||
window.open(location.hash.substr(1)); // OK - any JavaScript is executed in another context
|
||||
}
|
||||
@@ -72,4 +72,13 @@ function quz() {
|
||||
var payload = history.location.hash.substr(1);
|
||||
|
||||
history.replace(payload); // NOT OK
|
||||
}
|
||||
}
|
||||
|
||||
function bar() {
|
||||
var url = document.location.search.substr(1);
|
||||
|
||||
$("<a>", {href: url}).appendTo("body"); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("#foo").attr("href", url); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("#foo").attr({href: url}); // NOT OK - but not detected [INCONSISTENCY]
|
||||
$("<img>", {src: url}).appendTo("body"); // NOT OK - but not detected [INCONSISTENCY]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user