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

Question: about size option #1510

Open
1Blackdiamondsc opened this issue Feb 20, 2022 · 1 comment
Open

Question: about size option #1510

1Blackdiamondsc opened this issue Feb 20, 2022 · 1 comment

Comments

@1Blackdiamondsc
Copy link

1Blackdiamondsc commented Feb 20, 2022

Impact
Node Fetch did not honor the size option after following a redirect, which means that when a content size was over the limit, a FetchError would never get thrown and the process would end without failure.

For most people, this fix will have a little or no impact. However, if you are relying on node-fetch to gate files above a size, the impact could be significant, for example: If you don't double-check the size of the data after fetch() has completed, your JS thread could get tied up doing work on a large file (DoS) and/or cost you money in computing.

Patches
We released patched versions for both stable and beta channels:

For v2: 2.6.1
For v3: 3.0.0-beta.9

Workarounds
None, it is strongly recommended to update as soon as possible.

@jimmywarting
Copy link
Collaborator

jimmywarting commented Feb 20, 2022

Size is a node-fetch only option. we have toughs about deprecating it since we want to be more strict and follow the spec more correctly. we want node-fetch to be somewhat isomorphic so that your code can work the same across different env, node is shipping a very close to spec compatible fetch implementation in 17.5 behind a flag. so some day node-fetch will no longer stick around. and Deno have fetch built in so... there is that.

#1438

it might also be solvable in some other form later on with fetch observer and fetch events that gets triggered when making a fetch request.

@jimmywarting jimmywarting changed the title Question: Question: about size option Feb 20, 2022
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

No branches or pull requests

2 participants