Support strict CSP enabled environments
Feature request
The library has the usage of new Function(...), for instance (https://github.com/mtth/avsc/blob/master/lib/types.js#L2172), which is considered harmful in environments where CSP policy is enabled with no unsafe-eval.
Are there any plans of providing a fallback for such environments?
There are no plans to do so but this sounds like a reasonable idea: I would be happy to review a PR which isolates code-generation and provides an alternate--optional--implementation.
(These Function calls are at the heart of code-generation for decoding and encoding: performance would drastically suffer without.)
@mtth Thanks for the response. I have rough implementation of converting the usage of new Function for types. But unfortunately it is breaking 6 unit tests. I am trying to figure out how to fix them.
Will send out a PR sometime but might need some help on implementing a flag to switch new Function usage to regular function(did I understand this correct?) and unit tests.
Sounds good, thank you for working on it! Feel free to send a PR even before fixing all the tests if you want early feedback.