Skip to content

Commit c5d29b2

Browse files
committed
check dangerous schemes
1 parent 6f436be commit c5d29b2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/lib/isURL.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export default function isURL(url, options) {
5858
if (!url || /[\s<>]/.test(url)) {
5959
return false;
6060
}
61-
if (url.indexOf('mailto:') === 0) {
61+
const lowerUrl = url.trim().toLowerCase();
62+
const dangerousSchemes = ['javascript:', 'data:', 'vbscript:', 'file:', 'blob:', 'mailto:'];
63+
if (dangerousSchemes.some(scheme => lowerUrl.startsWith(scheme))) {
6264
return false;
6365
}
6466
options = merge(options, default_url_options);

0 commit comments

Comments
 (0)