在我的 Rails 应用程序中,我允许用户直接将文件上传到 S3。我通过 iframe 执行此操作,并使用 Javascript 进行上传。
最近(例如上个月),Chrome(和 Firefox)的安全设置发生了一些变化,导致它不再自动运行此脚本。相反,我的上传脚本的某些部分在默认情况下被阻止。这意味着,除非您单击地址栏右侧出现的盾牌(请参阅附件)并明确允许脚本运行,否则上传会失败。
有谁知道我如何解决这个问题,这样我的用户就不必每次都点击这个盾牌(例如,我有办法吗?或者有人知道我如何开始识别哪个脚本是“未经身份验证”,这样我就可以避免出现此问题?
仅供引用,在盾牌出现的同时,我的开发者控制台中弹出了一个错误:
[blocked] The page at https://www.my_domain.com/seekers/new ran insecure content from http://s3.my_domain.com.s3.amazonaws.com/.
这是否意味着不安全内容来自http://s3.[my_domain].com.s3.amazonaws.com/ ?
最佳答案
Does this mean that the insecure content is coming from http://s3.[my_domain].com.s3.amazonaws.com/?
是的。
Does anyone know how I can get around this, so that my users don't have to click on this shield every time (e.g. is there a way I ?
除了服务所有人active content,别无他法。来自 https 域。无论如何,允许此类内容是一个真正的安全漏洞:它将允许中间人攻击者替换飞行中的未加密数据流,从而允许他在安全站点的上下文中执行任意代码(窃取用户数据,用户 session 或弄乱用户数据)。
Or does anyone know how I can begin to identify which script is "unauthenticated," so I can avoid having this issue appear to begin with?
Firefox 将向您显示完整的 URL,甚至是启动加载的大致位置(如果从另一个脚本启动,则包括行号)。例如。脚本标签:
Blocked loading mixed active content "http://example.org/test.js" @ https://example.org/testblock.html
从另一个脚本注入(inject)脚本(注意行号):
Blocked loading mixed active content "http://example.org/test2.js" @ https://example.org/testblock.html:7
关于javascript - 上传到 S3 - Chrome/Firefox 中出现新的 "unsafe script"AKA "ran insecure content"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19410263/