indexeddbshim / IndexedDBShim

A polyfill for IndexedDB using WebSql
Other
968 stars 191 forks source link

restricted "eval" triggering "Could not eval key from keyPath" #236

Closed whitmer closed 7 years ago

whitmer commented 8 years ago

This one took me a little while to track down. Basically I'm running on a browser that follows CSP directives, and I didn't have 'unsafe-eval' set as an option for 'script-src'. I didn't realize IndexedDBShim was using eval, or maybe I would have caught it sooner. Anyway, the error that kept getting raised was "Could not eval key from keyPath" which would get triggered on storage calls. It was actually happening in the getValue function, which eval'ed "source.". Anyway, I'm assuming others will run across this as well, so this is partially documenting, and partially to say it should be easy to include a capability check and notify the developer if eval is not functioning properly.

whitmer commented 8 years ago

This will be a non-issue when #211 is resolved.

brettz9 commented 8 years ago

Do you want to propose an error message? Does a try-catch over the eval do the trick?

brettz9 commented 7 years ago

This should now be fixed in master. eval is no longer used, whether for keys or cloning (courtesy of typeson/typeson-registry).