Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

Normalize hosts and improve web safety checks

8 months ago

636a553
Authored
mweinbach2/13/2026, 12:03:52 PM
Add normalizeHost to strip trailing dots and surrounding brackets and use it in isBlockedHost so IP detection and private/internal checks work for bracketed IPv6 and trailing-dot hostnames. Update isBlockedHost to pass the normalized host to isIP and the IPv4/IPv6 private checks. Adjust tests to use case-insensitive regex matches for error messages, add coverage for IPv4-mapped IPv6 (public, loopback, and link-local/metadata) cases, and verify canonicalized hostnames for allowed mapped addresses.

Parenteba8954

2 files changed
  • src/utils/webSafety.ts+12−6
  • test/webSafety.test.ts+20−5