SonarSoftwareInc / customer_portal

A prebuilt customer portal for Sonar.
https://sonar.software
25 stars 51 forks source link

AB#5540 CSP is preventing loading of legitimate resources #138

Closed cjw6k closed 2 years ago

cjw6k commented 2 years ago

Allowing the data: schema for sources in the CSP is inherently unsafe. CSP doesn't have an easy way to allow some uses of data:.

From MDN:

This is insecure; an attacker can also inject arbitrary data: URIs. Use this sparingly and definitely not for scripts.

Inlining svgs in css avoids the multiple HTTP connections needed to fetch the multiple files, but http/2 makes this much less beneficial because the same connection is reused for fetching multiple assets.

This PR moves all inlined CSS background-image and mask SVG into SVG files and references those files in the CSS. This avoids the need to modify the CSP.