Skip to content

Errors with strict CSP for inline styling, nonces added to <style>. #2486

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 1 commit into from
Apr 15, 2025

Conversation

delbarrow
Copy link
Contributor

Description

This PR is in response to a LI where a merchant was encountering inline-styling errors with their CSP and their CSP does not allow for the use of 'unsafe-inline'

To address these issues, a nonce was added to the <style> tags that were throwing these errors.

LI: https://paypal.atlassian.net/browse/LI-84820

Why are we making these changes? Include references to any related Jira tasks or GitHub Issues

Ticket: https://paypal.atlassian.net/browse/DTPPCPSDK-3080

Not all styling had a nonce with it and it was causing errors with a merchant's Content Security Policy.

Reproduction Steps (if applicable)

Test bed to reproduce error is provided in the comments under the LI link above.

Example error: 'Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-...'

Screenshots (if applicable)

Dependent Changes (if applicable)

Groups who should review (if applicable)

❤️ Thank you!

…SP. Nonce added to style tags that were resulting in errors being thrown
@delbarrow delbarrow requested a review from a team as a code owner April 14, 2025 21:52
@delbarrow delbarrow requested a review from ravishekhar April 14, 2025 21:54
@delbarrow delbarrow merged commit d120e40 into main Apr 15, 2025
3 checks passed
@delbarrow delbarrow deleted the fix/csp-inline-styling-errors branch April 15, 2025 13:46
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