Chrome 使用 CSP img-src * 仍然阻止图像

Chrome with CSP img-src * still blocks images

我的网络应用程序有一个内容安全策略,将 img-src 设置为 *(从任何地方加载图像),但 Chrome 仍然阻止某些图像加载...

Refused to load the image 'data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==' because it violates the following Content Security Policy directive: "img-src *". lg @ js?libraries=places,geometry&v=3&callback=async_req_1:84(anonymous function) @ js?libraries=places,geometry&v=3&callback=async_req_1:119google.maps.Load @ js?libraries=places,geometry&v=3&callback=async_req_1:21(anonymous function) @ js?libraries=places,geometry&v=3&callback=async_req_1:118(anonymous function) @ js?libraries=places,geometry&v=3&callback=async_req_1:119

如果我在指令中包含 'data:',则错误不会显示在控制台中。

img-src * 数据:;

但是,这不是一个有效的指令。是否有满足 Chrome 的 img-src 有效 CSP 值,或者这可能是一个 Chrome 错误?我无法在可访问的错误列表中找到任何直接匹配项。我推测这可能与 SVG 文件中嵌入的图像有关。 Firefox 和 Safari 不会出现这种行为。

content-security-policy.com 是错误的。参见 w3.org/TR/CSP2/#source-list-guid-matching

As defined above, special URL schemes that refer to specific pieces of unique content, such as "data:", "blob:" and "filesystem:" are excluded from matching a policy of * and must be explicitly listed.

* 也不包括 'unsafe-inline' 或 'unsafe-eval'。