Hardcoded URLs in Production #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
"http://10.10.10.157:11434/api/generate" # Line 564
"http://10.10.10.67" # PELICAN_URL default
Issue: Exposes internal network topology.
Fix:
Use environment variables without defaults for internal services
OLLAMA_URL = os.getenv('OLLAMA_URL') # No default
if not OLLAMA_URL:
logger.error("OLLAMA_URL not configured")
Validate internal URLs
def validate_internal_url(url: str) -> bool:
"""Ensure URL points to approved internal service"""
# Add your validation logic
return url.startswith(('http://10.', 'https://'))