Skip to content

Commit

Permalink
fix: DOM text reinterpreted as HTML leading to self-XSS (#633)
Browse files Browse the repository at this point in the history
* fix: DOM text reinterpreted as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix: format with prettier

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Oliver Eyton-Williams <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent cfb2b36 commit 29ac0f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/image-search-abstraction-layer/public/imageSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ function updateURL() {
var queryTest = /\S/;

if (selected == 'query' && queryTest.test(queryValue)) {
url += 'query/' + queryValue + '?page=' + pageValue;
url +=
'query/' +
encodeURIComponent(queryValue) +
'?page=' +
encodeURIComponent(pageValue);
if (sizeValue != 'All') {
url += '&size=' + sizeValue;
url += '&size=' + encodeURIComponent(sizeValue);
}
}
if (selected == 'recent') {
url += 'recent/';
}

urlDiv.innerHTML = url;
urlDiv.textContent = url;
urlDiv.setAttribute('href', url);
}

Expand Down

0 comments on commit 29ac0f2

Please sign in to comment.