【发布时间】:2020-11-04 15:48:07
【问题描述】:
我制作了一个 chrome 扩展程序,可以在 gmail url 上加载 iframe。到目前为止,一切都很好! 当我安装扩展程序时,它会加载我没有问题的框架,但问题来了。如果我再次刷新或访问 gmail,它将不再工作,出现以下错误,并且没有其他错误。
拒绝框架“https://...........com/”,因为它违反了 遵循内容安全策略指令:“frame-src 'self' https://clients4.google.com/insights/consumersurveys/ https://calendar.google.com/accounts/https://ogs.google.com https://onegoogle-autopush.sandbox.google.com https://accounts.google.com/https://apis.google.com/u/ https://apis.google.com/_/streamwidgets/ https://clients6.google.com/static/ https://content.googleapis.com/static/ https://mail-attachment.googleusercontent.com/ https://www.google.com/calendar/https://calendar.google.com/calendar/ https://docs.google.com/https://drive.google.com https://.googleusercontent.com/docs/securesc/ https://feedback.googleusercontent.com/resources/ https://www.google.com/tools/feedback/ https://support.google.com/inapp/ https://.googleusercontent.com/gadgets/ifr https://hangouts.google.com/https://talkgadget.google.com/ https://.talkgadget.google.com/ https://www-gm-opensocial.googleusercontent.com/gadgets/ https://plus.google.com/https://wallet.google.com/gmail/ https://www.youtube.com/embed/ https://clients5.google.com/pagead/drt/dn/ https://clients5.google.com/ads/measurement/jn/ https://www.gstatic.com/mail/ww/https://www.gstatic.com/mail/intl/ https://clients5.google.com/webstore/wall/ https://ci3.googleusercontent.com/https://workspace.google.com/u/ https://workspace.google.com/marketplace/appfinder https://gsuite.google.com/u/ https://gsuite.google.com/marketplace/appfinder https://www.gstatic.com/mail/promo/https://notifications.google.com/ https://tracedepot-pa.clients6.google.com/static/ https://staging-taskassist-pa-googleapis.sandbox.google.com https://taskassist-pa.clients6.google.com https://.prod.amp4mail.googleusercontent.com/ https://.client-channel.google.com/client-channel/client https://clients4.google.com/invalidation/lcs/client https://tasks.google.com/embed/https://keep.google.com/companion https://addons.gsuite.google.com https://contacts.google.com/widget/hovercard/v/2 https://gsuite.google.com https://.googleusercontent.com/confidential-mail/attachments/”。
现在。您想知道我是否将 CSP 放在我的标题中。答案是肯定的。我有 header("Content-Security-Policy: frame-src 'self' https://*.google.com;");在我的 php 和标题 si 中加载。但我无法回答的问题是:Chrome 是否在页面刷新后看到错误,为什么?
理论上,如果 CSP 中存在问题,它应该从一开始就阻止 iframe,而不是稍后。 你知道吗?
【问题讨论】:
标签: html google-chrome content-security-policy