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

Support net.BlockList in http.Agent options #55000

Open
satire-foxfire opened this issue Sep 19, 2024 · 0 comments
Open

Support net.BlockList in http.Agent options #55000

satire-foxfire opened this issue Sep 19, 2024 · 0 comments
Labels
feature request Issues that request new features to be added to Node.js. net Issues and PRs related to the net subsystem.

Comments

@satire-foxfire
Copy link

satire-foxfire commented Sep 19, 2024

What is the problem this feature will solve?

Enable users to allow or block requests when using http.request, fetch, etc.

What is the feature you are proposing to solve the problem?

Node.js already supports net.BlockList, it'd be awesome if you could simply pass in an instance of net.BlockList when creating a custom http.Agent and then have it automatically enforce the IP checks for you.

What alternatives have you considered?

I believe the only way to do this at the moment is a bit boilerplate-y, which would be using a custom lookup function that calls dns.lookup(hostname) manually, then calls blocklist.check(address) manually, and then if it flags, throw an error, else return the address.

Although that still isn't a complete solution because the lookup function isn't called for hostnames that are already IP addresses, so even more code to do the check fully :(

@satire-foxfire satire-foxfire added the feature request Issues that request new features to be added to Node.js. label Sep 19, 2024
@RedYetiDev RedYetiDev added the net Issues and PRs related to the net subsystem. label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. net Issues and PRs related to the net subsystem.
Projects
Development

No branches or pull requests

2 participants