You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
No output, unless index.js contains code. In the example above, index.js contains a comment only.
This behavior can be observed in Chrome and Firefox.
What do you see instead?
Error [ERR_MANIFEST_ASSERT_INTEGRITY]: The content of "file:///home/tniessen/dev/policy-test/index.js" does not match the expected integrity. Integrities found are: sha384-s+/FLC70SKA4cOtWba1RQAhBoGcQoMRXt/kU5mp0oDnO+hQVqm5/zQkIaG26qVa0
Additional information
It seems unlikely that this could cause any real security issues, but it does allow hash collisions. Different byte sequences can result in the same Unicode character sequences, which, when hashed, result in the same digests.
The issue arises from the fact that Node.js loads a byte sequence from the resource, converts the byte sequence to a Unicode string, and then converts the string back to a byte sequence for the SRI check.
Version
v16.6.1
Platform
Any
Subsystem
policy
What steps will reproduce the bug?
Create a file
index.js
such that its contents change after Unicode processing. For example, useCompute the SRI value, e.g., using OpenSSL:
Test the SRI value in a browser:
Create
policy.json
:Run the script with the policy file:
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
No output, unless
index.js
contains code. In the example above,index.js
contains a comment only.This behavior can be observed in Chrome and Firefox.
What do you see instead?
Additional information
It seems unlikely that this could cause any real security issues, but it does allow hash collisions. Different byte sequences can result in the same Unicode character sequences, which, when hashed, result in the same digests.
The issue arises from the fact that Node.js loads a byte sequence from the resource, converts the byte sequence to a Unicode string, and then converts the string back to a byte sequence for the SRI check.
Refs: #37248
The text was updated successfully, but these errors were encountered: