Embarrassingly, I must admit I got the logic backwards since
gviz.json.cspColiantMode_ is false by default, and so we are still using
the eval call.  But I am nevertheless confident we can avoid this since we
have alternatives in place.

On Fri, Mar 2, 2018 at 4:55 PM, Daniel LaLiberte <dlalibe...@google.com>
wrote:

> The source for this code is:
>
> gviz 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=gviz&rcl=187416831>.json
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=json&rcl=187416831>.unsafeDeserialize
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&gs=kythe%253A%252F%252Fgoogle3%253Flang%253Djavascript%253Fpath%253Djavascript%252Fgviz%252Fdevel%252Fjsapi%252Fcommon%252Fjson.js%2523gviz.json.unsafeDeserialize%25253Aname%25253AOTHER&gsn=unsafeDeserialize&ct=xref_usages>
>  = function(jsonString 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&gs=kythe%253A%252F%252Fgoogle3%253Flang%253Djavascript%253Fpath%253Djavascript%252Fgviz%252Fdevel%252Fjsapi%252Fcommon%252Fjson.js%2523gviz.json.unsafeDeserialize%252540jsonString%25253Aname%25253AOTHER&gsn=jsonString&ct=xref_usages>)
>  {  if (gviz 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=gviz&rcl=187416831>.UNSAFE_EVAL
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=43&ct=xref_jump_to_def&gsn=UNSAFE_EVAL&rcl=187416831>
>  && !gviz 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=gviz&rcl=187416831>.json
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=json&rcl=187416831>.cspCompliantMode_
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=83&gs=kythe%253A%252F%252Fgoogle3%253Flang%253Djavascript%253Fpath%253Djavascript%252Fgviz%252Fdevel%252Fjsapi%252Fcommon%252Fjson.js%2523gviz.json.cspCompliantMode_%25253Aname%25253AOTHER&gsn=cspCompliantMode_&ct=xref_usages>)
>  {    // Add parentheses to disambiguate object literal from control 
> structure    jsonString 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&ct=xref_jump_to_def&gsn=jsonString&rcl=187416831>
>  = '(' + jsonString 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&ct=xref_jump_to_def&gsn=jsonString&rcl=187416831>
>  + ')';    // Not using JSON.parse since it does not support the "new" 
> operator.    var jsonObject 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=87&gs=kythe%253A%252F%252Fgoogle3%253Flang%253Djavascript%253Fpath%253Djavascript%252Fgviz%252Fdevel%252Fjsapi%252Fcommon%252Fjson.js%2523gviz.json.unsafeDeserialize%252526jsonObject%25253Aname%25253AOTHER&gsn=jsonObject&ct=xref_usages>
>  = eval 
> <https://cs.corp.google.com/piper///depot/google3/javascript/externs/es3.js?l=302&ct=xref_jump_to_def&gsn=eval&rcl=187416831>(jsonString
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&ct=xref_jump_to_def&gsn=jsonString&rcl=187416831>);
>     return /** @type {!Object 
> <https://cs.corp.google.com/piper///depot/google3/javascript/externs/es3.js?l=313&ct=xref_jump_to_def&gsn=Object&rcl=187416831>}
>  */ (gviz 
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=gviz&rcl=187416831>.json
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=json&rcl=187416831>.fixDateStrings_
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=180&ct=xref_jump_to_def&gsn=fixDateStrings_&rcl=187416831>(jsonObject
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=87&ct=xref_jump_to_def&gsn=jsonObject&rcl=187416831>));
>   } else {    return /** @type {?Object 
> <https://cs.corp.google.com/piper///depot/google3/javascript/externs/es3.js?l=313&ct=xref_jump_to_def&gsn=Object&rcl=187416831>}
>  */ (JSON 
> <https://cs.corp.google.com/piper///depot/google3/javascript/externs/es5.js?l=269&ct=xref_jump_to_def&gsn=JSON&rcl=187416831>.parse
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/externs/es5.js?l=252&ct=xref_jump_to_def&gsn=parse&rcl=187416831>(jsonString
>  
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=82&ct=xref_jump_to_def&gsn=jsonString&rcl=187416831>));
>   }};
>
>
>
> Note the check for !gviz
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=gviz&rcl=187416831>
> .json
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=11&ct=xref_jump_to_def&gsn=json&rcl=187416831>
> .cspCompliantMode_
> <https://cs.corp.google.com/piper///depot/google3/javascript/gviz/devel/jsapi/common/json.js?l=83&gs=kythe%253A%252F%252Fgoogle3%253Flang%253Djavascript%253Fpath%253Djavascript%252Fgviz%252Fdevel%252Fjsapi%252Fcommon%252Fjson.js%2523gviz.json.cspCompliantMode_%25253Aname%25253AOTHER&gsn=cspCompliantMode_&ct=xref_usages>.
> We have no code that sets it to true now, so I expect I can just force
> JSON.parse to be used always.  I'll do that now, and it will be part of the
> v46 release.
>
>
> On Fri, Mar 2, 2018 at 3:50 PM, Edward Hartwell Goose <e...@mention-me.com>
> wrote:
>
>> We're just evaluating using a CSP and can confirm we see `unsafe-eval`.
>> It looks like the code is nearly there in the upcoming version - we just
>> trip up in one place, in gvjs_Jh within the compiled_format module.
>>
>>
>> <https://lh3.googleusercontent.com/-qTS1riVF8xY/Wpm4fG003_I/AAAAAAAAHzU/n2HBEuOB3PwDaSJZ6nhEkUueGtut7tEMgCLcBGAs/s1600/2_X_IST_-_Mention_Me_Admin.png>
>>
>> Daniel - is there anything we can do to help provide you with test cases
>> or similar to help you nail this? I'd be glad to help.
>>
>> On Wednesday, 28 February 2018 17:16:11 UTC, Kirschner wrote:
>>>
>>> I stepped on this problem too, is the upcomming(?) v46 free of evals?
>>>
>>> On Tuesday, September 12, 2017 at 6:37:07 AM UTC+2, Daniel LaLiberte
>>> wrote:
>>>>
>>>> I will try to remember to post a followup here.  But I usually forget
>>>> such things.
>>>>
>>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Visualization API" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-visualization-api+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-visualization-api@googl
>> egroups.com.
>> Visit this group at https://groups.google.com/grou
>> p/google-visualization-api.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/google-visualization-api/45477d15-c886-4f8f-96cc-2429b4
>> 815dc5%40googlegroups.com
>> <https://groups.google.com/d/msgid/google-visualization-api/45477d15-c886-4f8f-96cc-2429b4815dc5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
> dlalibe...@google.com <dlalibe...@google.com>   5CC, Cambridge MA
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
dlalibe...@google.com <dlalibe...@google.com>   5CC, Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMQK7AHjPb094_zh4N4Ni3bn80Bgj9oO0DRJ27ELw%3DQ%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to