mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-20 05:01:30 +00:00
fix(url-safety): allow only http and https schemes
This commit is contained in:
parent
8373956850
commit
6af9942327
2 changed files with 11 additions and 0 deletions
|
|
@ -263,6 +263,9 @@ def is_safe_url(url: str) -> bool:
|
|||
parsed = urlparse(url)
|
||||
hostname = (parsed.hostname or "").strip().lower().rstrip(".")
|
||||
scheme = (parsed.scheme or "").strip().lower()
|
||||
if scheme not in {"http", "https"}:
|
||||
logger.warning("Blocked request — unsupported URL scheme: %s", scheme or "<empty>")
|
||||
return False
|
||||
if not hostname:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue