2015-01-07 7 views
0

저는 벤더가 만든 (우리는 더 이상 다루지 않는) 전자 학습 과정을 사용하고 있으며 회사의 보안 소프트웨어 (HP Fortify Scan)를 통해 파일을 업로드 할 때 저는 여러 오류가 발생했습니다. 나는 모든 오류를 바로 잡았습니다. 오류는 dojo.js 파일에 있으며 url 변수의 유효성을 검증하지 않아도됩니다. 나는 그것이 간단한 픽스라고 확신하지만 누군가이 것을 검증되지 않은 것으로 설명 할 수 있습니까? 이 url 변수를 어떻게 확인할 수 있습니까? 여기 Dojo.js 데이터의 유효성이 확인되지 않았습니다

코드와 오류 메시지의 스크린 샷이다 (I 주석에 줄 번호를 넣어) :

Fortify Scan Screen Shot

코드 : 사전에

function xhr(url, options, returnDeferred){ 
    var response = util.parseArgs(
     url, 
     util.deepCreate(defaultOptions, options), 
     has('native-formdata') && options && options.data && options.data instanceof FormData 
    ); 
    // THIS IS LINE 11540 
    url = response.url; 
    options = response.options; 

    var remover, 
     last = function(){ 
      remover && remover(); 
     }; 

    //Make the Deferred object for this xhr request. 
    var dfd = util.deferred(
     response, 
     cancel, 
     isValid, 
     isReady, 
     handleResponse, 
     last 
    ); 
    var _xhr = response.xhr = xhr._create(); 

    if(!_xhr){ 
     // If XHR factory somehow returns nothings, 
     // cancel the deferred. 
     dfd.cancel(new RequestError('XHR was not created')); 
     return returnDeferred ? dfd : dfd.promise; 
    } 

    response.getHeader = function(headerName){ 
     return this.xhr.getResponseHeader(headerName); 
    }; 

    if(addListeners){ 
     remover = addListeners(_xhr, dfd, response); 
    } 

    var data = options.data, 
     async = !options.sync, 
     method = options.method; 

    try{ 
     // IE6 won't let you call apply() on the native function. 
     // THIS IS LINE 11580 
     _xhr.open(method, url, async, options.user || undefined, options.password || undefined); 

     if(options.withCredentials){ 
      _xhr.withCredentials = options.withCredentials; 
     } 

     var headers = options.headers, 
      contentType; 
     if(headers){ 
      for(var hdr in headers){ 
       if(hdr.toLowerCase() === 'content-type'){ 
        contentType = headers[hdr]; 
       }else if(headers[hdr]){ 
        //Only add header if it has a value. This allows for instance, skipping 
        //insertion of X-Requested-With by specifying empty value. 
        _xhr.setRequestHeader(hdr, headers[hdr]); 
       } 
      } 
     } 

     if(contentType && contentType !== false){ 
      _xhr.setRequestHeader('Content-Type', contentType); 
     } 
     if(!headers || !('X-Requested-With' in headers)){ 
      _xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 
     } 

     if(util.notify){ 
      util.notify.emit('send', response, dfd.promise.cancel); 
     } 
     _xhr.send(data); 
    }catch(e){ 
     dfd.reject(e); 
    } 

    watch(dfd); 
    _xhr = null; 

    return returnDeferred ? dfd : dfd.promise; 
} 

감사합니다,

마이크

답변

0

나는 그렇지 않다고 말하고 싶습니다. 반드시 오류가 발생합니다. HP Fortify Scan이 dojo/request/xhr.js에있는 코드를 지적하여 서버 코드가 그러한 공격에 대비하지 못하는 경우에 대비하여주의를 기울여야합니다. xhr()을 호출하는 응용 프로그램의 더 높은 수준의 코드 (예 : 상점)에있는 URL (HP Fortify를 충족시킬 수 있는지 확실하지 않음)