function test() { var tainted = document.location.search $(tainted); // OK - location.search starts with '?' $("body", tainted); // OK $("." + tainted); // OK $("
"); // NOT OK $("body").html("XSS: " + tainted); // NOT OK $(window.location.hash); // OK - location.hash starts with '#' $("" + location.toString() + ""); // NOT OK // Not related to jQuery, but the handling of $() should not affect this sink let elm = document.getElementById('x'); elm.innerHTML = decodeURIComponent(window.location.hash); // NOT OK elm.innerHTML = decodeURIComponent(window.location.search); // NOT OK elm.innerHTML = decodeURIComponent(window.location.toString()); // NOT OK }