JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/
Other
958 stars 169 forks source link

Refused to evaluate a string as JavaScript because 'unsafe-eval' #208

Closed guoliang closed 2 months ago

guoliang commented 3 months ago

Describe the bug

Passing the following path expression results in exception thrown

$.MIRecord[*].NameValue[?(@.Name=='CONO')].Value

Works locally, but not when it is deployed

Code sample or steps to reproduce

json = { MIRecord: [{ NameValue: [{ Name: "CONO", Value: "750" }]}]};
jsonpath({ json, path: "$.MIRecord[*].NameValue[?(@.Name=='CONO')].Value" });

Console error or logs

Error: jsonPath: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". : @.Name=='CONO' at Ge._eval (index-browser-esm.js:786:11) at index-browser-esm.js:602:20 at Ge._walk (index-browser-esm.js:732:7) at Ge._trace (index-browser-esm.js:601:12) at Ge._trace (index-browser-esm.js:535:17) at index-browser-esm.js:540:21 at Ge._walk (index-browser-esm.js:732:7) at Ge._trace (index-browser-esm.js:539:10) at Ge._trace (index-browser-esm.js:702:17) at Ge.evaluate (index-browser-esm.js:429:21)

Expected behavior

Path expression should work. I have tried it here https://jsonpath.com/

Expected result

[
  "750"
]

Environment (IMPORTANT)

Desktop**

Additional context

brettz9 commented 3 months ago

Can you try again against v9.0.0?

brettz9 commented 2 months ago

Closing for lack of response.