Last active
September 25, 2018 13:53
-
-
Save binki/e87ddf1aa5d46883047926376b0ae00a to your computer and use it in GitHub Desktop.
Excerpt of Glip weird “do not send scripts” JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EC_Model.prototype.validate_string=function(a,b,c) { | |
if(!_.isNull(a)) { | |
if(_.isString(a)) { | |
if(a.length>b) { | |
return Errors.Too_Long(b); | |
} | |
if(a.match(/<script/gi)) { | |
return Errors.No_Script(); | |
} }else { | |
return Errors.Invalid_Type(); | |
} | |
if(a=a.match(/<.*?>/g)) { | |
for(b=0; b<a.length; b++) { | |
if(c=a[b],c.match(/\s+on\w/g) || c.match(/=\s?["|']?javascript/g)) { | |
return Errors.No_Script(); | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment