Skip to content

Commit 29ac0f2

Browse files
devanshbathamgithub-advanced-security[bot]ojeytonwilliams
authored
fix: DOM text reinterpreted as HTML leading to self-XSS (#633)
* 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 <ojeytonwilliams@gmail.com>
1 parent cfb2b36 commit 29ac0f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/image-search-abstraction-layer/public/imageSearch.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,20 @@ function updateURL() {
3737
var queryTest = /\S/;
3838

3939
if (selected == 'query' && queryTest.test(queryValue)) {
40-
url += 'query/' + queryValue + '?page=' + pageValue;
40+
url +=
41+
'query/' +
42+
encodeURIComponent(queryValue) +
43+
'?page=' +
44+
encodeURIComponent(pageValue);
4145
if (sizeValue != 'All') {
42-
url += '&size=' + sizeValue;
46+
url += '&size=' + encodeURIComponent(sizeValue);
4347
}
4448
}
4549
if (selected == 'recent') {
4650
url += 'recent/';
4751
}
4852

49-
urlDiv.innerHTML = url;
53+
urlDiv.textContent = url;
5054
urlDiv.setAttribute('href', url);
5155
}
5256

0 commit comments

Comments
 (0)