From 7f467dbb8d1f4caf8225299f20fd8c34d73549b3 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Tue, 25 Aug 2015 20:23:47 +0100 Subject: [PATCH] Fixed scoped jQuery showing up in error messages and jQuery methods and chaining in spoofed jQuery --- public/js/lib/coursewares/commonFrameWork.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/lib/coursewares/commonFrameWork.js b/public/js/lib/coursewares/commonFrameWork.js index 22294f9265..0cdac5519f 100644 --- a/public/js/lib/coursewares/commonFrameWork.js +++ b/public/js/lib/coursewares/commonFrameWork.js @@ -166,7 +166,7 @@ function workerError(error){ var housing = $('#testSuite'); if(display.html() != error){ display.remove(); - housing.prepend("
" + error + "
"); + housing.prepend("
" + error.replace(/j\$/gi, "$").replace(/jdocument/gi, "document").replace(/jjQuery/gi, "jQuery") + "
"); display.hide().fadeIn(function(){ setTimeout(function(){ display.fadeOut(function(){ @@ -186,7 +186,7 @@ function safeHTMLRun(test){ var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; if(editor.getValue().match(/\/gi) !== null) { var s = editor.getValue().split(/\<\s?script\s?\>/gi)[1].split(/\<\s?\/\s?script\s?\>/gi)[0]; - s = "var document = \"\"; var $ = function(){return(new function(){this.add=function(){return(null);};this.addBack=function(){return(null);};this.addClass=function(){return(null);};this.after=function(){return(null);};this.ajaxComplete=function(){return(null);};this.ajaxError=function(){return(null);};this.ajaxSend=function(){return(null);};this.ajaxStart=function(){return(null);};this.ajaxStop=function(){return(null);};this.ajaxSuccess=function(){return(null);};this.andSelf=function(){return(null);};this.animate=function(){return(null);};this.append=function(){return(null);};this.appendTo=function(){return(null);};this.attr=function(){return(null);};this.before=function(){return(null);};this.bind=function(){return(null);};this.blur=function(){return(null);};this.callbacksadd=function(){return(null);};this.callbacksdisable=function(){return(null);};this.callbacksdisabled=function(){return(null);};this.callbacksempty=function(){return(null);};this.callbacksfire=function(){return(null);};this.callbacksfired=function(){return(null);};this.callbacksfireWith=function(){return(null);};this.callbackshas=function(){return(null);};this.callbackslock=function(){return(null);};this.callbackslocked=function(){return(null);};this.callbacksremove=function(){return(null);};this.change=function(){return(null);};this.children=function(){return(null);};this.clearQueue=function(){return(null);};this.click=function(){return(null);};this.clone=function(){return(null);};this.closest=function(){return(null);};this.contents=function(){return(null);};this.context=function(){return(null);};this.css=function(){return(null);};this.data=function(){return(null);};this.dblclick=function(){return(null);};this.deferredalways=function(){return(null);};this.deferreddone=function(){return(null);};this.deferredfail=function(){return(null);};this.deferredisRejected=function(){return(null);};this.deferredisResolved=function(){return(null);};this.deferrednotify=function(){return(null);};this.deferrednotifyWith=function(){return(null);};this.deferredpipe=function(){return(null);};this.deferredprogress=function(){return(null);};this.deferredpromise=function(){return(null);};this.deferredreject=function(){return(null);};this.deferredrejectWith=function(){return(null);};this.deferredresolve=function(){return(null);};this.deferredresolveWith=function(){return(null);};this.deferredstate=function(){return(null);};this.deferredthen=function(){return(null);};this.delay=function(){return(null);};this.delegate=function(){return(null);};this.dequeue=function(){return(null);};this.detach=function(){return(null);};this.die=function(){return(null);};this.each=function(){return(null);};this.empty=function(){return(null);};this.end=function(){return(null);};this.eq=function(){return(null);};this.error=function(){return(null);};this.eventcurrentTarget=function(){return(null);};this.eventdata=function(){return(null);};this.eventdelegateTarget=function(){return(null);};this.eventisDefaultPrevented=function(){return(null);};this.eventisImmediatePropagationStopped=function(){return(null);};this.eventisPropagationStopped=function(){return(null);};this.eventmetaKey=function(){return(null);};this.eventnamespace=function(){return(null);};this.eventpageX=function(){return(null);};this.eventpageY=function(){return(null);};this.eventpreventDefault=function(){return(null);};this.eventrelatedTarget=function(){return(null);};this.eventresult=function(){return(null);};this.eventstopImmediatePropagation=function(){return(null);};this.eventstopPropagation=function(){return(null);};this.eventtarget=function(){return(null);};this.eventtimeStamp=function(){return(null);};this.eventtype=function(){return(null);};this.eventwhich=function(){return(null);};this.fadeIn=function(){return(null);};this.fadeOut=function(){return(null);};this.fadeTo=function(){return(null);};this.fadeToggle=function(){return(null);};this.filter=function(){return(null);};this.find=function(){return(null);};this.finish=function(){return(null);};this.first=function(){return(null);};this.focus=function(){return(null);};this.focusin=function(){return(null);};this.focusout=function(){return(null);};this.get=function(){return(null);};this.has=function(){return(null);};this.hasClass=function(){return(null);};this.height=function(){return(null);};this.hide=function(){return(null);};this.hover=function(){return(null);};this.html=function(){return(null);};this.index=function(){return(null);};this.innerHeight=function(){return(null);};this.innerWidth=function(){return(null);};this.insertAfter=function(){return(null);};this.insertBefore=function(){return(null);};this.is=function(){return(null);};this.jQuery=function(){return(null);};this.jquery=function(){return(null);};this.jQueryajax=function(){return(null);};this.jQueryajaxPrefilter=function(){return(null);};this.jQueryajaxSetup=function(){return(null);};this.jQueryajaxTransport=function(){return(null);};this.jQueryboxModel=function(){return(null);};this.jQuerybrowser=function(){return(null);};this.jQueryCallbacks=function(){return(null);};this.jQuerycontains=function(){return(null);};this.jQuerycssHooks=function(){return(null);};this.jQuerycssNumber=function(){return(null);};this.jQuerydata=function(){return(null);};this.jQueryDeferred=function(){return(null);};this.jQuerydequeue=function(){return(null);};this.jQueryeach=function(){return(null);};this.jQueryerror=function(){return(null);};this.jQueryextend=function(){return(null);};this.jQueryfnextend=function(){return(null);};this.jQueryfxinterval=function(){return(null);};this.jQueryfxoff=function(){return(null);};this.jQueryget=function(){return(null);};this.jQuerygetJSON=function(){return(null);};this.jQuerygetScript=function(){return(null);};this.jQueryglobalEval=function(){return(null);};this.jQuerygrep=function(){return(null);};this.jQueryhasData=function(){return(null);};this.jQueryholdReady=function(){return(null);};this.jQueryinArray=function(){return(null);};this.jQueryisArray=function(){return(null);};this.jQueryisEmptyObject=function(){return(null);};this.jQueryisFunction=function(){return(null);};this.jQueryisNumeric=function(){return(null);};this.jQueryisPlainObject=function(){return(null);};this.jQueryisWindow=function(){return(null);};this.jQueryisXMLDoc=function(){return(null);};this.jQuerymakeArray=function(){return(null);};this.jQuerymap=function(){return(null);};this.jQuerymerge=function(){return(null);};this.jQuerynoConflict=function(){return(null);};this.jQuerynoop=function(){return(null);};this.jQuerynow=function(){return(null);};this.jQueryparam=function(){return(null);};this.jQueryparseHTML=function(){return(null);};this.jQueryparseJSON=function(){return(null);};this.jQueryparseXML=function(){return(null);};this.jQuerypost=function(){return(null);};this.jQueryproxy=function(){return(null);};this.jQueryqueue=function(){return(null);};this.jQueryremoveData=function(){return(null);};this.jQuerysub=function(){return(null);};this.jQuerysupport=function(){return(null);};this.jQuerytrim=function(){return(null);};this.jQuerytype=function(){return(null);};this.jQueryunique=function(){return(null);};this.jQuerywhen=function(){return(null);};this.keydown=function(){return(null);};this.keypress=function(){return(null);};this.keyup=function(){return(null);};this.last=function(){return(null);};this.length=function(){return(null);};this.live=function(){return(null);};this.load=function(){return(null);};this.load=function(){return(null);};this.map=function(){return(null);};this.mousedown=function(){return(null);};this.mouseenter=function(){return(null);};this.mouseleave=function(){return(null);};this.mousemove=function(){return(null);};this.mouseout=function(){return(null);};this.mouseover=function(){return(null);};this.mouseup=function(){return(null);};this.next=function(){return(null);};this.nextAll=function(){return(null);};this.nextUntil=function(){return(null);};this.not=function(){return(null);};this.off=function(){return(null);};this.offset=function(){return(null);};this.offsetParent=function(){return(null);};this.on=function(){return(null);};this.one=function(){return(null);};this.outerHeight=function(){return(null);};this.outerWidth=function(){return(null);};this.parent=function(){return(null);};this.parents=function(){return(null);};this.parentsUntil=function(){return(null);};this.position=function(){return(null);};this.prepend=function(){return(null);};this.prependTo=function(){return(null);};this.prev=function(){return(null);};this.prevAll=function(){return(null);};this.prevUntil=function(){return(null);};this.promise=function(){return(null);};this.prop=function(){return(null);};this.pushStack=function(){return(null);};this.queue=function(){return(null);};this.ready=function(){return(null);};this.remove=function(){return(null);};this.removeAttr=function(){return(null);};this.removeClass=function(){return(null);};this.removeData=function(){return(null);};this.removeProp=function(){return(null);};this.replaceAll=function(){return(null);};this.replaceWith=function(){return(null);};this.resize=function(){return(null);};this.scroll=function(){return(null);};this.scrollLeft=function(){return(null);};this.scrollTop=function(){return(null);};this.select=function(){return(null);};this.selector=function(){return(null);};this.serialize=function(){return(null);};this.serializeArray=function(){return(null);};this.show=function(){return(null);};this.siblings=function(){return(null);};this.size=function(){return(null);};this.slice=function(){return(null);};this.slideDown=function(){return(null);};this.slideToggle=function(){return(null);};this.slideUp=function(){return(null);};this.stop=function(){return(null);};this.submit=function(){return(null);};this.text=function(){return(null);};this.toArray=function(){return(null);};this.toggle=function(){return(null);};this.toggle=function(){return(null);};this.toggleClass=function(){return(null);};this.trigger=function(){return(null);};this.triggerHandler=function(){return(null);};this.unbind=function(){return(null);};this.undelegate=function(){return(null);};this.unload=function(){return(null);};this.unwrap=function(){return(null);};this.val=function(){return(null);};this.width=function(){return(null);};this.wrap=function(){return(null);};this.wrapAll=function(){return(null);};this.wrapInner=function(){return(null);}});};"+s; + s = "var document = \"\"; var $ = function(){return(new function(){this.add=function(){return(this);};this.addBack=function(){return(this);};this.addClass=function(){return(this);};this.after=function(){return(this);};this.ajaxComplete=function(){return(this);};this.ajaxError=function(){return(this);};this.ajaxSend=function(){return(this);};this.ajaxStart=function(){return(this);};this.ajaxStop=function(){return(this);};this.ajaxSuccess=function(){return(this);};this.andSelf=function(){return(this);};this.animate=function(){return(this);};this.append=function(){return(this);};this.appendTo=function(){return(this);};this.attr=function(){return(this);};this.before=function(){return(this);};this.bind=function(){return(this);};this.blur=function(){return(this);};this.callbacksadd=function(){return(this);};this.callbacksdisable=function(){return(this);};this.callbacksdisabled=function(){return(this);};this.callbacksempty=function(){return(this);};this.callbacksfire=function(){return(this);};this.callbacksfired=function(){return(this);};this.callbacksfireWith=function(){return(this);};this.callbackshas=function(){return(this);};this.callbackslock=function(){return(this);};this.callbackslocked=function(){return(this);};this.callbacksremove=function(){return(this);};this.change=function(){return(this);};this.children=function(){return(this);};this.clearQueue=function(){return(this);};this.click=function(){return(this);};this.clone=function(){return(this);};this.closest=function(){return(this);};this.contents=function(){return(this);};this.context=function(){return(this);};this.css=function(){return(this);};this.data=function(){return(this);};this.dblclick=function(){return(this);};this.delay=function(){return(this);};this.delegate=function(){return(this);};this.dequeue=function(){return(this);};this.detach=function(){return(this);};this.die=function(){return(this);};this.each=function(){return(this);};this.empty=function(){return(this);};this.end=function(){return(this);};this.eq=function(){return(this);};this.error=function(){return(this);};this.fadeIn=function(){return(this);};this.fadeOut=function(){return(this);};this.fadeTo=function(){return(this);};this.fadeToggle=function(){return(this);};this.filter=function(){return(this);};this.find=function(){return(this);};this.finish=function(){return(this);};this.first=function(){return(this);};this.focus=function(){return(this);};this.focusin=function(){return(this);};this.focusout=function(){return(this);};this.get=function(){return(this);};this.has=function(){return(this);};this.hasClass=function(){return(this);};this.height=function(){return(this);};this.hide=function(){return(this);};this.hover=function(){return(this);};this.html=function(){return(this);};this.index=function(){return(this);};this.innerHeight=function(){return(this);};this.innerWidth=function(){return(this);};this.insertAfter=function(){return(this);};this.insertBefore=function(){return(this);};this.is=function(){return(this);};this.jQuery=function(){return(this);};this.jquery=function(){return(this);};this.keydown=function(){return(this);};this.keypress=function(){return(this);};this.keyup=function(){return(this);};this.last=function(){return(this);};this.length=function(){return(this);};this.live=function(){return(this);};this.load=function(){return(this);};this.load=function(){return(this);};this.map=function(){return(this);};this.mousedown=function(){return(this);};this.mouseenter=function(){return(this);};this.mouseleave=function(){return(this);};this.mousemove=function(){return(this);};this.mouseout=function(){return(this);};this.mouseover=function(){return(this);};this.mouseup=function(){return(this);};this.next=function(){return(this);};this.nextAll=function(){return(this);};this.nextUntil=function(){return(this);};this.not=function(){return(this);};this.off=function(){return(this);};this.offset=function(){return(this);};this.offsetParent=function(){return(this);};this.on=function(){return(this);};this.one=function(){return(this);};this.outerHeight=function(){return(this);};this.outerWidth=function(){return(this);};this.parent=function(){return(this);};this.parents=function(){return(this);};this.parentsUntil=function(){return(this);};this.position=function(){return(this);};this.prepend=function(){return(this);};this.prependTo=function(){return(this);};this.prev=function(){return(this);};this.prevAll=function(){return(this);};this.prevUntil=function(){return(this);};this.promise=function(){return(this);};this.prop=function(){return(this);};this.pushStack=function(){return(this);};this.queue=function(){return(this);};this.ready=function(){return(this);};this.remove=function(){return(this);};this.removeAttr=function(){return(this);};this.removeClass=function(){return(this);};this.removeData=function(){return(this);};this.removeProp=function(){return(this);};this.replaceAll=function(){return(this);};this.replaceWith=function(){return(this);};this.resize=function(){return(this);};this.scroll=function(){return(this);};this.scrollLeft=function(){return(this);};this.scrollTop=function(){return(this);};this.select=function(){return(this);};this.selector=function(){return(this);};this.serialize=function(){return(this);};this.serializeArray=function(){return(this);};this.show=function(){return(this);};this.siblings=function(){return(this);};this.size=function(){return(this);};this.slice=function(){return(this);};this.slideDown=function(){return(this);};this.slideToggle=function(){return(this);};this.slideUp=function(){return(this);};this.stop=function(){return(this);};this.submit=function(){return(this);};this.text=function(){return(this);};this.toArray=function(){return(this);};this.toggle=function(){return(this);};this.toggle=function(){return(this);};this.toggleClass=function(){return(this);};this.trigger=function(){return(this);};this.triggerHandler=function(){return(this);};this.unbind=function(){return(this);};this.undelegate=function(){return(this);};this.unload=function(){return(this);};this.unwrap=function(){return(this);};this.val=function(){return(this);};this.width=function(){return(this);};this.wrap=function(){return(this);};this.wrapAll=function(){return(this);};this.wrapInner=function(){return(this);}});};$.ajax=function(){return($);};$.ajaxPrefilter=function(){return($);};$.ajaxSetup=function(){return($);};$.ajaxTransport=function(){return($);};$.boxModel=function(){return($);};$.browser=function(){return($);};$.Callbacks=function(){return($);};$.contains=function(){return($);};$.cssHooks=function(){return($);};$.cssNumber=function(){return($);};$.data=function(){return($);};$.Deferred=function(){return($);};$.dequeue=function(){return($);};$.each=function(){return($);};$.error=function(){return($);};$.extend=function(){return($);};$.fnextend=function(){return($);};$.fxinterval=function(){return($);};$.fxoff=function(){return($);};$.get=function(){return($);};$.getJSON=function(){return($);};$.getScript=function(){return($);};$.globalEval=function(){return($);};$.grep=function(){return($);};$.hasData=function(){return($);};$.holdReady=function(){return($);};$.inArray=function(){return($);};$.isArray=function(){return($);};$.isEmptyObject=function(){return($);};$.isFunction=function(){return($);};$.isNumeric=function(){return($);};$.isPlainObject=function(){return($);};$.isWindow=function(){return($);};$.isXMLDoc=function(){return($);};$.makeArray=function(){return($);};$.map=function(){return($);};$.merge=function(){return($);};$.noConflict=function(){return($);};$.noop=function(){return($);};$.now=function(){return($);};$.param=function(){return($);};$.parseHTML=function(){return($);};$.parseJSON=function(){return($);};$.parseXML=function(){return($);};$.post=function(){return($);};$.proxy=function(){return($);};$.queue=function(){return($);};$.removeData=function(){return($);};$.sub=function(){return($);};$.support=function(){return($);};$.trim=function(){return($);};$.type=function(){return($);};$.unique=function(){return($);};$.when=function(){return($);};$.always=function(){return($);};$.done=function(){return($);};$.fail=function(){return($);};$.isRejected=function(){return($);};$.isResolved=function(){return($);};$.notify=function(){return($);};$.notifyWith=function(){return($);};$.pipe=function(){return($);};$.progress=function(){return($);};$.promise=function(){return($);};$.reject=function(){return($);};$.rejectWith=function(){return($);};$.resolve=function(){return($);};$.resolveWith=function(){return($);};$.state=function(){return($);};$.then=function(){return($);};$.currentTarget=function(){return($);};$.data=function(){return($);};$.delegateTarget=function(){return($);};$.isDefaultPrevented=function(){return($);};$.isImmediatePropagationStopped=function(){return($);};$.isPropagationStopped=function(){return($);};$.metaKey=function(){return($);};$.namespace=function(){return($);};$.pageX=function(){return($);};$.pageY=function(){return($);};$.preventDefault=function(){return($);};$.relatedTarget=function(){return($);};$.result=function(){return($);};$.stopImmediatePropagation=function(){return($);};$.stopPropagation=function(){return($);};$.target=function(){return($);};$.timeStamp=function(){return($);};$.type=function(){return($);};$.which=function(){return($);};"+s; submit( scopejQuery(s), function (cls, message) { if (cls) {