Hi @emfau ,
Thank you for Your Response.
The request regarding support for Dynamic CSP Nonces in Azure Static Web Apps.Currently, Azure Static Web Apps does not natively support dynamic CSP nonces. We recognize that this limitation can make it difficult to implement a strict CSP, especially for applications that require robust protection against inline script injection attacks.While the feature is not available, here are some workarounds you might consider in the interim.
- Use Azure Functions to intercept and modify responses, dynamically adding nonce-based CSP headers.
- Though this adds complexity, it ensures per-request uniqueness for nonces.
- Use hashes to specify allowed inline script content in your CSP. While less flexible than nonces, this approach is still effective for many scenarios.
- Tools like csp-hash-generator can help automate hash generation for your inline scripts.
- You can define a static CSP nonce in the
staticwebapp.config.json
. While not ideal, it offers some level of security for less dynamic environments.
References links: Content Security Policy (CSP) Nonces Configuration File Documentation