Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@
**Vulnerability:** The `/api/v1/webhook` POST endpoint in `appguardrail_core/controlplane.py` failed to validate the `url` property when accepting it into the database, leading to Stored SSRF risks. In addition, the core SSRF validation logic (`_is_safe_url`) in both the CLI and control-plane did not verify the input type (e.g. `isinstance(url, str)`). Passing non-string types (like integers) resulted in unhandled `AttributeError` exceptions inside `urllib.parse.urlparse`, which led to API 500 crashes on malicious JSON payloads.
**Learning:** Network endpoints must explicitly validate the data type of user-provided configurations prior to execution or storage. Furthermore, webhooks configured by users should always be checked for SSRF when saved, as trusting them later assumes input has already been safely validated, bypassing downstream network guardrails.
**Prevention:** Apply `_is_safe_url` checks directly upon ingestion (e.g., in `/api/v1/webhook`) and enforce type checks `if not isinstance(url, str): return False` prior to using library parsing functions like `urlparse`. Always return gracefully failing responses (like `400 Bad Request`) for unsafe URLs instead of allowing unhandled 500 server errors.

## 2026-07-29 - [SSRF Bypass with Empty Hostnames]
**Vulnerability:** Server-Side Request Forgery (SSRF) bypass due to `urllib.parse.urlparse` returning an empty string for the hostname of malformed URLs (e.g., `http://` or `http://user@`). The subsequent host parsing logic resulted in an empty string being passed to `ipaddress.ip_address` and `socket.getaddrinfo`. These functions threw `ValueError` and `socket.gaierror` exceptions respectively, which were caught and ignored, leading the `_is_safe_url` function to incorrectly return `True`.
**Learning:** `urllib.parse.urlparse` can produce empty strings for hostnames on certain malformed URLs. When this empty string is processed by underlying networking and IP resolution libraries, the resulting exceptions might be handled in a way that accidentally bypasses the security check.
**Prevention:** Always explicitly check that a valid, non-empty hostname was successfully extracted by `urlparse` before attempting to validate the IP address or perform DNS resolution. Reject any URL that does not have a recognizable hostname.
2 changes: 2 additions & 0 deletions appguardrail_core/controlplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def _is_safe_url(url: str) -> bool:
return False

host = (parsed.hostname or "").lower()
if not host:
return False
Comment thread
seonghobae marked this conversation as resolved.
raw = host.split("%", 1)[0].strip("[]")

def is_bad_ip(ip) -> bool:
Expand Down
2 changes: 2 additions & 0 deletions scanner/cli/appguardrail.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,8 @@ def _is_safe_url(url: str) -> bool:
return False

host = (parsed.hostname or "").lower()
if not host:
return False
raw = host.split("%", 1)[0].strip("[]")

def is_bad_ip(ip) -> bool:
Expand Down
Loading