Skip to content

Use CSP nonces for script and style tags #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 24, 2024
Merged

Use CSP nonces for script and style tags #61

merged 3 commits into from
Aug 24, 2024

Conversation

crbelaus
Copy link
Contributor

This pull request adds a new :csp_nonce_assign_key option to the error_tracker_dashboard/2 macro. If provided, the error tracker will fetch the nonce from the given assign key and use it in the <style> and <script> tags.

This allows using the ErrorTracker dashboard in environments with a restricted content security policy without requiring the usage of unsafe-inline, which should be avoided.

This implementation is based on the Phoenix LiveDashboard one.

I've updated the dev.exs script to use CSP headers. If we remove the new option we will see that the ErrorTracker dashboard doesn't have any styles.

Closes #58

@crbelaus crbelaus requested a review from odarriba August 22, 2024 16:22
@crbelaus crbelaus self-assigned this Aug 22, 2024
@crbelaus crbelaus mentioned this pull request Aug 24, 2024
Copy link
Contributor

@odarriba odarriba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@odarriba odarriba merged commit cfb9e59 into main Aug 24, 2024
3 checks passed
@odarriba odarriba deleted the csp-nonce branch August 24, 2024 12:00
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.

Support CSP properly
2 participants