Skip to content

Commit 48df250

Browse files
committed
Fix link regex should filter protocol with case insensitive flag [Security Issue]
1 parent a39870f commit 48df250

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

public/js/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
var whiteListAttr = ['id', 'class', 'style']
55
window.whiteListAttr = whiteListAttr
66
// allow link starts with '.', '/' and custom protocol with '://', exclude link starts with javascript://
7-
var linkRegex = /^(?!javascript:\/\/)([\w|-]+:\/\/)|^([.|/])+/
7+
var linkRegex = /^(?!javascript:\/\/)([\w|-]+:\/\/)|^([.|/])+/i
88
// allow data uri, from https://gist.github.com/bgrins/6194623
99
var dataUriRegex = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*)\s*$/i
1010
// custom white list

0 commit comments

Comments
 (0)