feat: support trusted types for jit compilation
Author: atsjoCreated Sep 24, 2026Updated Sep 24, 2026
Labelsenhancement
What version of Ajv you are you using? 8:20.0
What problem do you want to solve?
- Enabling use of trusted types policy for compile of schema, so ajv can be used with sites using this without default policy hacks...
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/trusted-types
- Trusted types is available for all major browsers now, so this is the way to run dynamic code in a secure way...
What do you think is the correct solution to problem? allow users to provide own policy, if none provided create a default one called ajv (this is how it's implemented in DOMPurify)
Will you be able to implement it? maybe yes, but this is a small change for the maintainers knowing the code-base, and I am just evaluating this for an internal backed config tool, alongside zod and others...
Source: ajv-validator/ajv