Closed
Description
Describe the Bug
Compiling the AJV schema validation functions at runtime uses new new Function
which requires the CSP script-src
to include 'unsafe-eval'
.
Instead, the schema validation functions should be pre-compiled.
Steps to Reproduce
- Use the cloudevents/sdk-javascript library in a site with a CSP with
script-src
not including'unsafe-eval'
- Use
new CloudEvent(...)
- Observe CSP error
Expected Behavior
The library should be able to be used successfully without including 'unsafe-eval'
in your CSP.
Additional context
See https://github.com/ajv-validator/ajv/blob/master/docs/security.md#content-security-policy