ZhuLinsen/daily_stock_analysis · error · IntelligenceServiceError
source url must not target private or local network addresse
Error message
source url must not target private or local network addresses
What it means
Error "source url must not target private or local network addresses" thrown in ZhuLinsen/daily_stock_analysis.
Source
Thrown at src/services/intelligence_service.py:412
return
parsed = urlparse(raw_url)
if parsed.scheme.lower() not in {"http", "https"} or not parsed.netloc:
raise IntelligenceServiceError("source url must be an absolute http(s) URL")
if parsed.username or parsed.password:
raise IntelligenceServiceError("source url must not contain credentials")
hostname = (parsed.hostname or "").strip().lower().rstrip(".")
if not hostname:
raise IntelligenceServiceError("source url host is required")
if hostname in _PRIVATE_HOSTNAMES or hostname.endswith(".local"):
raise IntelligenceServiceError("source url host is not allowed")
has_public_address = False
try:
ip = ipaddress.ip_address(hostname)
except ValueError:
ip = None
if ip is not None:
if self._is_blocked_ip(ip):
raise IntelligenceServiceError("source url must not target private or local network addresses")
return
try:
addr_infos = socket.getaddrinfo(hostname, None)
except OSError as exc:
raise IntelligenceServiceError(f"source url host DNS resolution failed: {hostname}") from exc
if not addr_infos:
raise IntelligenceServiceError(f"source url host DNS resolution failed: {hostname}")
for info in addr_infos:
try:
ip = ipaddress.ip_address(info[4][0])
except (IndexError, ValueError):
continue
if self._is_blocked_ip(ip):
raise IntelligenceServiceError("source url must not target private or local network addresses")
has_public_address = True
if not has_public_address:
raise IntelligenceServiceError(f"source url host DNS resolution failed: {hostname}")
View on GitHub (pinned to 5159bd72e8)
Solutions
- Do not use URLs pointing at private, loopback, or local network addresses for intelligence sources.
- Point the source at the public feed URL instead of an internal address.
- If an internal feed is required, route it through an approved proxy rather than allowing direct private access.
When it happens
Trigger: Thrown at src/services/intelligence_service.py:412 when the library encounters an invalid state.
Common situations: Raised when an intelligence source URL resolves to a private or loopback address; occurs with hosts targeting internal networks, blocked to prevent SSRF.
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/ad5c1c0c840224a7.
Report an issue: GitHub.