Skip to content

Commit efe1378

Browse files
Potential fix for code scanning alert no. 18: Incomplete URL scheme check
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4ba718f commit efe1378

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

leaflet_app/plugin/jQuery-UI-Multiple-Select-Widget/src/jquery.multiselect.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
/**
7777
* Checks whether a given image source URL is safe to use.
7878
* Only allows http, https, protocol-relative, data image URLs, or relative URLs
79-
* that do not begin with a dangerous scheme such as "javascript:".
79+
* that do not begin with a dangerous scheme such as "javascript:", "vbscript:", or unsafe "data:".
8080
*
8181
* @param {string} src
8282
* @returns {boolean}
@@ -86,9 +86,11 @@
8686
return false;
8787
}
8888
var trimmed = $.trim ? $.trim(src) : src.replace(/^\s+|\s+$/g, '');
89-
// Reject javascript: and similar executable schemes
89+
// Reject javascript:, vbscript:, and non-image data: URLs
9090
var lower = trimmed.toLowerCase();
91-
if (lower.indexOf('javascript:') === 0 || lower.indexOf('data:text/html') === 0) {
91+
if (lower.indexOf('javascript:') === 0 ||
92+
lower.indexOf('vbscript:') === 0 ||
93+
(lower.indexOf('data:') === 0 && lower.indexOf('data:image/') !== 0)) {
9294
return false;
9395
}
9496
// Allow common safe patterns: http, https, protocol-relative, data:image, or relative paths

0 commit comments

Comments
 (0)