Changeset 11057

Show
Ignore:
Timestamp:
10/22/07 14:53:01 (15 months ago)
Author:
peller
Message:

Fix regexp for json comment filtering to accept multilines. Fixes #4829

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/xhr.js

    r10982 r11057  
    209209        "json": function(xhr){ 
    210210                if(!djConfig.usePlainJson){ 
    211                         console.debug("consider using a mimetype of text/json-comment-filtered" 
     211                        console.debug("Consider using mimetype:text/json-comment-filtered" 
    212212                                + " to avoid potential security issues with JSON endpoints" 
    213213                                + " (use djConfig.usePlainJson=true to turn off this message)"); 
     
    219219                // the "JavaScript Hijacking" issue noted by Fortify and others. It is 
    220220                // not appropriate for all circumstances. 
    221                 var match = xhr.responseText.match(/\/\*(.*)\*\//); 
     221 
     222                //FIXME: is this precise enough?  This might do a partial match on the multiline string. 
     223                var match = xhr.responseText.match(/\/\*([\s\S]*)\*\//m); 
    222224                if(!match){ 
    223                         throw new Error("your JSON wasn't comment filtered!"); 
     225                        throw new Error("JSON was not comment filtered"); 
    224226                } 
    225227                return dojo.fromJson(match[1]);