神秘缓存 Content-Security-Policy 幽灵在不存在时拒绝内容

Mystery cached Content-Security-Policy ghost rejecting content while absent

内容安全策略最近在我们的软件中实施,但因为它立即干扰了我们删除它的一些客户端网站(显然混淆):

header('Content-Security-Policy: [...]');

删除 header 后并使用 Waterfox 56(Firefox 65 和 Chrome 72 立即 开始工作;Waterfox 56 有一个新的配置文件)尽管 绝对没有单个请求已设置 Content-Security-Policy,但控制台中会出现以下错误!

淘汰过程:

我想 header 以某种方式缓存...这很荒谬,因为我们 总是 出于开发目的禁用缓存,除非我们明确使用缓存.唯一已知的其他潜在因素是请求与 Google 日历 API 和响应 header 相关。有一个 content-security-policy script-src 'nonce-SHP3iUMj779E…self';report-uri /o/cspreport header 集的请求:https://accounts.google.com/o/oauth2/iframe。然而,这将如何影响我们 客户的网站 显示内容的地方?


Waterfox 的新配置文件已创建,使用该新配置文件的请求已完成。以下是仅存在于 "buggy" Waterfox 配置文件中的唯一错误:

Content Security Policy: The page’s settings observed the loading of a resource at blob:https://content.googleapis.com/4bafd6e0-ea6f-43b2-9b43-690cbcd6b691 (“script-src 'nonce-dxS2ZXb0sYV7IpK+nhCm6w' 'unsafe-inline'”). A CSP report is being sent. (unknown)

设置CSP的混淆URL:

https://accounts.google.com/o/oauth2/iframe#origin=https://www.example.com&rpcToken=123.456

那个URL的CSP:

script-src 'nonce-tdC4gM1/O5jBKPO3TfdC9w' 'unsafe-inline' 'strict-dynamic' https: http: 'unsafe-eval';object-src 'none';base-uri 'self';report-uri /o/cspreport

为什么 Google 触发此错误 只是 对于那个 Waterfox 实例? 我已经清除了所有 cookie,存储等。我将继续尝试缩小导致问题的配置文件的范围。


Waterfox 配置文件的 prefs.js 文件是源文件,当复制到新配置文件的目录时会破坏请求。我将按照复制、测试和重复的方式分块重建文件,幸运的是这不是二进制文件。

以下文件和行破坏了 Google 日历的 API 并触发了内容安全策略错误足以导致请求失败:

文件:AppData\Roaming\Waterfox\Profiles.0\prefs.js

user_pref("network.cookie.cookieBehavior", 1);

network.cookie.cookieBehavior 设置描述为 how third party cookies are handled。安装了 Chris Pederick 的 Web Developer 工具栏 (XUL),并在 Cookies 菜单下禁用了第三方 cookies。 Enabling/disabling 他们 fixed/relapsed 问题。