Browse Source

Fixes #20009: Fix DOM-based XSS vulnerability in search export functionality

Replace direct string concatenation with URLSearchParams to properly
encode user input in export link URLs, preventing injection of malicious
parameters or scripts through the search functionality.

Resolves CodeQL Alert #63 (js/xss-through-dom)
Jason Novinger 6 tháng trước cách đây
mục cha
commit
2c09973e01

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
netbox/project-static/dist/netbox.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
netbox/project-static/dist/netbox.js.map


+ 3 - 1
netbox/project-static/src/search.ts

@@ -38,7 +38,9 @@ function handleQuickSearchParams(event: Event): void {
 
   if (quickSearchParameters != null) {
     const link = document.getElementById('export_current_view') as HTMLLinkElement;
-    const search_parameter = `q=${quickSearchParameters.value}`;
+    const params = new URLSearchParams();
+    params.set('q', quickSearchParameters.value);
+    const search_parameter = params.toString();
     const linkUpdated = link?.href + '&' + search_parameter;
     link.setAttribute('href', linkUpdated);
   }

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác