Issue - CSP violation when using evaluateValidator with dynamically compiled validators #4677
Unanswered
SriHarshaNagulakonda
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to validate a form using a dynamic JSON schema that comes from an API, so I can't precompile and bundle the schema validator at build time.
I followed the approach mentioned in the RJSF docs on dynamically pre-compiling validators. Here's what I did:
createPrecompiledValidator
However, this throws a CSP violation error:
Note: we do not allow unsafe-inline, and the policy is strict,
Question
Is there any recommended or CSP-safe way to evaluate or use dynamically compiled validators in the browser without violating CSP?
I already noticed the optional nonce parameter, but even when I supply a valid nonce, the inline script still gets blocked—possibly because script-src-elem doesn’t honor nonce in some cases?
Would love to hear if others have hit this issue or have alternative suggestions?
Beta Was this translation helpful? Give feedback.
All reactions