问题标签 [subresource-integrity]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
387 浏览

javascript - Google Analytics sha384 完整性哈希不起作用

我的 jekyll 应用程序中有一个谷歌分析脚本突然停止捕获访问者信息。我已确定哈希已弃用,并包含以下错误消息:

在 Firefox 开发版中:

在 Chrome 中:

出于安全原因,我无法删除完整性哈希,我需要这些分析。

我曾尝试通过https://www.srihash.org/更改完整性哈希,但不幸的是没有真正改变。

我尝试添加 CSP 元标记:

但是,这会导致与上述相同的错误以及这些错误:

更新:

我能够使用此解决方案修复 CSP 错误,但哈希的原始问题sha384仍然存在。

0 投票
0 回答
83 浏览

javascript - 是否可以使用 javascript 记录客户端子资源完整性错误?

我正在寻找一种方法来拦截在任何完整性哈希值无效时生成的子资源完整性错误消息。有没有办法使用页面上的 JavaScript 拦截这些事件,或者检测节点是否具有无效integrity属性?

例如这些错误消息:

None of the “sha384” hashes in the integrity attribute match the content of the sub-resource.

Failed to find a valid digest in the 'integrity' attribute for resource 'http://path/to/file' with computed SHA-256 integrity '[hash]'. The resource has been blocked.

0 投票
0 回答
29 浏览

google-ads-script - 如何将子资源完整性添加到 https://www.googleadservices.com/pagead/conversion_async.js?

安全扫描通知我应该为 js 文件添加完整性,因为这是一个高风险。

当我添加也是必需的完整性和 crossorigin="anonymous" 时,我收到一个 CORS 错误:

“...已被 CORS 策略阻止:请求的资源上不存在‘Access-Control-Allow-Origin’标头”

谢谢

0 投票
1 回答
191 浏览

javascript - TypeError:添加 webpack-subresource-integrity 时无法读取未定义的属性“tap”

我正在尝试在我的(react-app- rewired )上配置webpack-subresource-integrity包:config-overrides.js

我明白了TypeError: Cannot read property 'tap' of undefined

我已经尝试删除我的 node_modules,yarn.lock,然后重新安装包,但我仍然得到同样的错误。

这是完整的错误: