Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fetch): implement spec compliant integrity checks #1613

Merged
merged 2 commits into from Aug 22, 2022

Conversation

KhafraDev
Copy link
Member

@KhafraDev KhafraDev commented Aug 22, 2022

Fixes #1612

Bugs fixed:

  • Disabled when nodejs is not built with openssl (see issue above)
  • Disallows algorithms outside of the ones listed in the spec (sha256, sha384, sha512)
  • Checks are ignored if an invalid hash/algorithm are provided (Firefox follows the spec; Chrome throws an error. Left a comment about this behavior.)
  • Checks if the algorithms are supported by the user's node.
    Tests were added in fix: add support for integrity option to Fetch #1596 but I could add more if needed.

@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2022

Codecov Report

Merging #1613 (396f18d) into main (417e7ab) will decrease coverage by 0.01%.
The diff coverage is 93.75%.

@@            Coverage Diff             @@
##             main    #1613      +/-   ##
==========================================
- Coverage   94.94%   94.92%   -0.02%     
==========================================
  Files          50       50              
  Lines        4763     4791      +28     
==========================================
+ Hits         4522     4548      +26     
- Misses        241      243       +2     
Impacted Files Coverage Δ
lib/fetch/util.js 86.57% <93.54%> (+1.45%) ⬆️
lib/fetch/index.js 84.04% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 21fdda5 into nodejs:main Aug 22, 2022
@KhafraDev KhafraDev deleted the fetch-integrity branch August 22, 2022 15:47
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undici crashes on node compiled without crypto
4 participants