Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2011 15:05
Show Gist options
  • Save anonymous/1044967 to your computer and use it in GitHub Desktop.
Save anonymous/1044967 to your computer and use it in GitHub Desktop.
quick patch for jQuery selector XSS
<script type="text/javascript">
// http://ma.la/jquery_xss/
var _$=$;
$=function(){
if( typeof arguments[ 0 ] == "string" && /^#.*</.test( arguments[ 0 ] ) ){
throw new Error( "selector error" );
}
return _$.apply( this, arguments );
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment