Skip to content

Unresolved SweetAlert2 Content Security Policy (CSP) issue #1

Description

@workingpleasewait

Description:

Despite various attempts to resolve the CSP issue with SweetAlert2, the problem persists. The inline styles used by SweetAlert2 are still being blocked due to the CSP directive.

Steps to Reproduce:

1.	Open the PDF Processor application.
2.	Trigger any SweetAlert2 alert (e.g., by clicking “Process PDFs” without selecting a directory).
3.	Observe the browser console for CSP-related errors.

Expected Behavior:

SweetAlert2 alerts should display correctly without CSP errors.

Actual Behavior:

SweetAlert2 alerts are not displaying properly due to CSP errors. The browser console shows:

sweetalert2.all.min.js:6 Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-meOPkNEOo3wI3FT7f2594Q==' https://cdn.jsdelivr.net". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution.

Potential Solutions:

•	Investigate alternative methods to include SweetAlert2 without violating CSP.
•	Explore using hash or nonce values in CSP to allow SweetAlert2 inline styles.
•	Consider switching to a different alert library that complies with CSP.

Additional Context:

This issue affects the user experience by preventing SweetAlert2 alerts from displaying correctly, which is crucial for error handling and notifications in the PDF Processor application.

Environment:

•	OS: (e.g., macOS 11.2.3)
•	Electron Version: (e.g., 12.0.0)
•	Node Version: (e.g., 14.16.0)

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions