hermes - 💡(How to fix) Fix url_safety.py incorrectly blocks RFC 2544 (198.18.0.0/15) used by Clash TUN Fake IP [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#19992Fetched 2026-05-05 06:04:05
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2marked_as_duplicate ×1

Root Cause

In tools/url_safety.py:

def _is_blocked_ip(ip):
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True  # ← RFC 2544 caught here

_RFC2544_NETWORK = ipaddress.ip_network("198.18.0.0/15")

def _is_blocked_ip(ip):
    if ip in _RFC2544_NETWORK:  # RFC 2544 is NOT private
        return False
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True
    # ... rest of function

Code Example

def _is_blocked_ip(ip):
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True  # ← RFC 2544 caught here

_RFC2544_NETWORK = ipaddress.ip_network("198.18.0.0/15")

def _is_blocked_ip(ip):
    if ip in _RFC2544_NETWORK:  # RFC 2544 is NOT private
        return False
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True
    # ... rest of function
RAW_BUFFERClick to expand / collapse

Bug Description

tools/url_safety.py incorrectly blocks URLs resolving to 198.18.0.0/15 (RFC 2544 benchmarking range). This range is NOT a private network — it's legitimately used by:

  • Clash TUN mode (very popular in China) as Fake IP addresses
  • Some CDNs (e.g., Vercel) for benchmarking

Python's ipaddress marks this range as is_reserved=True, causing false positives.

Steps to Reproduce

  1. Enable Clash TUN mode (Fake IP: 198.18.0.0/15)
  2. Access any Vercel-hosted site via web_extract()
  3. Result: "Blocked: URL targets a private or internal network address"

Root Cause

In tools/url_safety.py:

def _is_blocked_ip(ip):
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True  # ← RFC 2544 caught here

_RFC2544_NETWORK = ipaddress.ip_network("198.18.0.0/15")

def _is_blocked_ip(ip):
    if ip in _RFC2544_NETWORK:  # RFC 2544 is NOT private
        return False
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True
    # ... rest of function

Environment

  • OS: WSL2 (affects all Clash TUN users)
  • Clash mode: TUN with Fake IP
  • Hermes Agent: main branch

extent analysis

TL;DR

The issue can be fixed by modifying the _is_blocked_ip function in tools/url_safety.py to correctly handle the RFC 2544 benchmarking range.

Guidance

  • Modify the _is_blocked_ip function to check if the IP is within the RFC 2544 range and return False if it is, as this range is not private.
  • Verify that the modified function correctly allows access to Vercel-hosted sites via web_extract() when Clash TUN mode is enabled.
  • Consider adding a comment to the code to explain why the RFC 2544 range is handled as a special case.
  • Test the modified function with different IP addresses to ensure it is working as expected.

Example

_RFC2544_NETWORK = ipaddress.ip_network("198.18.0.0/15")

def _is_blocked_ip(ip):
    if ip in _RFC2544_NETWORK:  # RFC 2544 is NOT private
        return False
    if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
        return True
    # ... rest of function

Notes

This fix assumes that the only issue is with the RFC 2544 range being incorrectly marked as reserved. If there are other ranges that need to be handled similarly, additional modifications may be necessary.

Recommendation

Apply workaround: Modify the _is_blocked_ip function as described above to correctly handle the RFC 2544 range, as this is a specific and targeted fix for the issue at hand.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix url_safety.py incorrectly blocks RFC 2544 (198.18.0.0/15) used by Clash TUN Fake IP [2 comments, 2 participants]