cagov / design-system

State of California Design System
MIT License
79 stars 25 forks source link

Bug: Does not pass strict content security policy #1027

Open claytoncollie opened 1 month ago

claytoncollie commented 1 month ago

When a strict Content Security Policy is implemented without unsafe-inline and unsafe-eval for scripts and styles, the CaGov plugin is not able to load the following items due to how they are written to the page markup. In these cases, the CSS and HTML are loaded from inside a javascript file instead of enqueued/echoed with WordPress functions. For the CSS listed below, this goes all the way into the Design System packages that are imported into the WordPress plugin.

CSS

accordions feedback pagination

HTML

build/index.js as related to the PDF link icon web component. This HTML should not be written to the DOM during processing and not after script are loaded.

https://github.com/cagov/ca-design-system-gutenberg-blocks/blob/3fa11a492b836db411f82fffae56357c15bcf5a3/design-system-proposals/js/custom.js#L30