Skip to content

fix(@hertzg/ip): lead docs with the SSRF-guard use case - #298

Merged
hertzg merged 1 commit into
mainfrom
hertzg/ip-docs-rewrite
Aug 19, 2026
Merged

hertzg merged 1 commit into
mainfrom
hertzg/ip-docs-rewrite

Conversation

@hertzg

@hertzg hertzg commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

@hertzg/ip's docs led with dual-stack address normalization. A competitive
analysis of real production codebases (Countly, Postman, dbgate, Hugging
Face's chat-ui, and others) found the actual #1 reason developers reach for
a library like this is SSRF prevention: "is this address safe to fetch, or
does it point at my own network?" CIDR allowlist / trusted-proxy matching is
the #2 reason.

Shipped SSRF guards in these codebases are often subtly wrong — checking
only loopback and link-local, or relying on remembering a single "safe"
label out of many. This package's classifyAddress returns one label from
a closed, total set, so there's no list of booleans to forget.

This is a docs-only change to the @module JSDoc block in mod.ts (this
package has no README — its JSR page is generated entirely from that
block):

  • Added a new "SSRF Guard" example, right after the Features list, showing
    the classification-based safety check.
  • Moved the existing "Trusted Network Allowlist" example (the chore: release 2025.01.25 #2 use case)
    up next to it.
  • No behavior changes, no new exports.

Test plan

  • deno task lint passes
  • deno task test passes (new example runs as an executable JSDoc test)

The prior docs opened with dual-stack normalization, but the reason
developers reach for a library like this is checking whether an
address is safe to fetch. Shipped SSRF guards in real codebases often
only check loopback and link-local and miss private, CGNAT, or
multicast ranges. classifyAddress returns one label from a closed
set, so there's no list of booleans to keep in sync. Add that example
first and move the CIDR-allowlist example up next to it.
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview: https://hertzg.github.io/jsr-monorepo/pr/298/

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

No significant changes detected. 31 benchmark(s) within their noise floor.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (6f33498) to head (812a239).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #298   +/-   ##
=======================================
  Coverage   96.79%   96.79%           
=======================================
  Files         159      159           
  Lines        8494     8494           
  Branches     1301     1301           
=======================================
  Hits         8222     8222           
  Misses        152      152           
  Partials      120      120           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hertzg
hertzg merged commit df93e4a into main Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants