os/Window

js HEUR/Malware 바이러스 문제

C/H 2010. 12. 16. 08:30
현재 개발중인 마이픽업서비스에서 다른 백신에서는 된다 안된다는 문의가 없는데 유독 Avira백신에서 북마크릿을 띄웠을 경우 "HEUR/Malware"가 문제가 되어서 사용을 못할 정도라는 문제 제기가 들어왔습니다.

이러 저리 확인해 본 결과 아래 grayscale.js 파일을 제거하니 문제는 해결되었지만 이것도 웃긴게 해당 js파일을 직접 사용할 경우에는 문제가 없지만 여러 js파일을 한 파일로 통합한뒤 jsmin으로 크기를 줄일 경우 바이러스로 문제가 되더군요.
도대체 어떤 코드로 바이러스 검사를 하는건지? 에궁.

일단은 과거 이미지를 회색으로 변경해서 서버 자원을 절약할 목적(크지 않지만)으로 적용했지만 지금은 딱히 변경되어야 할 이미지가 없고, 유독 브라우즈 특성을 타는 관계로 grayscale.js 파일을 빼버리는 방법으로 문제를 해결했습니다.

/* Copyright (C) James Padolsey (http://james.padolsey.com) */ var grayscale=(function(){var config={colorProps:['color','backgroundColor','borderBottomColor','borderTopColor','borderLeftColor','borderRightColor','backgroundImage'],externalImageHandler:{init:function(el,src){if(el.nodeName.toLowerCase()==='img'){}else{data(el).backgroundImageSRC=src;el.style.backgroundImage=''}},reset:function(el){if(el.nodeName.toLowerCase()==='img'){}else{el.style.backgroundImage='url('+(data(el).backgroundImageSRC||'')+')'}}}},log=function(){try{window.console.log.apply(console,arguments)}catch(e){}},isExternal=function(url){return(new RegExp('https?://(?!'+window.location.hostname+')')).test(url)},data=(function(){var cache=[0],expando='data'+(+new Date());return function(elem){var cacheIndex=elem[expando],nextCacheIndex=cache.length;if(!cacheIndex){cacheIndex=elem[expando]=nextCacheIndex;cache[cacheIndex]={}}return cache[cacheIndex]}})(),desatIMG=function(img,prepare,realEl){var canvas=document.createElement('canvas'),context=canvas.getContext('2d'),height=img.naturalHeight||img.offsetHeight||img.height,width=img.naturalWidth||img.offsetWidth||img.width,imgData;canvas.height=height;canvas.width=width;context.drawImage(img,0,0);try{imgData=context.getImageData(0,0,width,height)}catch(e){}if(prepare){desatIMG.preparing=true;var y=0;(function(){if(!desatIMG.preparing){return}if(y===height){context.putImageData(imgData,0,0,0,0,width,height);realEl?(data(realEl).BGdataURL=canvas.toDataURL()):(data(img).dataURL=canvas.toDataURL())}for(var x=0;x-1){var urlPatt=/\(['"]?(.+?)['"]?\)/,url=style.match(urlPatt)[1];if(isExternal(url)){config.externalImageHandler.init(cur,url);data(cur).externalBG=true;continue}try{var imgSRC=data(cur).BGdataURL||(function(){var temp=document.createElement('img');temp.src=url;return desatIMG(temp).toDataURL()})();cur.style[prop]=style.replace(urlPatt,function(_,url){return'('+imgSRC+')'})}catch(e){config.externalImageHandler.init(cur,url)}}}}}};init.reset=function(context){if(context&&context[0]&&context.length&&context[0].nodeName){var allContexts=Array.prototype.slice.call(context),cIndex=-1,cLen=allContexts.length;while(++cIndex-1){var urlPatt=/\(['"]?(.+?)['"]?\)/,url=style.match(urlPatt)[1];if(!isExternal(url)){var temp=document.createElement('img');temp.src=url;desatIMG(temp,true,cur)}}}}};return init})();
반응형

'os > Window' 카테고리의 다른 글

window route 설정  (0) 2011.11.25
window grep findstr  (0) 2011.11.16
Win7 빠른실행 도구 모듬 추가  (0) 2009.10.28
win7.7600.16384 32bit ko 설치  (0) 2009.09.21
hotmail.com pop3 기능 추가  (0) 2009.02.10