Skip to content

feat(dns): add address filter - #5660

Draft
JasonColapietro wants to merge 1 commit into
nodejs:mainfrom
JasonColapietro:agent/add-dns-address-policy
Draft

feat(dns): add address filter#5660
JasonColapietro wants to merge 1 commit into
nodejs:mainfrom
JasonColapietro:agent/add-dns-address-policy

Conversation

@JasonColapietro

Copy link
Copy Markdown

Summary

  • add an optional filter(origin, record) policy hook to the DNS interceptor
  • apply the policy to every resolved address and to literal IPv4 and IPv6 origins before connecting
  • keep enforcement active for fetch redirects and when the DNS cache has reached maxItems
  • document the application-owned policy boundary and expose the hook in the TypeScript definitions

This builds on the existing DNS interceptor so accepted hostnames are resolved once and the connection uses the accepted literal address while preserving the original Host header and TLS servername. Undici does not classify public or private ranges; callers supply that policy.

Closes #2019.

Validation

  • npm run test:interceptors (316 passed, 3 skipped)
  • npm run test:typescript
  • npm run lint
  • git diff --check

Signed-off-by: Jason Colapietro <jasoncola1@gmail.com>
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.

SSRF protection in undici / native-node-fetch

1 participant