Skip to content

Conversation

@juliangums
Copy link
Contributor

This PR adds the ability to skip nonce generation when using unsafe-inline in your CSP policy. This is implemented by:

  • Adding nonce_enabled config option (defaults to true)
  • Updating Policy class to skip adding nonces when disabled
  • Adding documentation about use cases and security implications

This is particularly useful when:

  • Using unsafe-inline for legacy code compatibility
  • Working with third-party scripts that don't support nonces
  • Debugging CSP issues

Note: Disabling nonces in favor of unsafe-inline reduces security. Only use when necessary.

@freekmurze freekmurze merged commit d03ade0 into spatie:main Dec 30, 2024
10 of 28 checks passed
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants