diff --git a/.jules/sentinel.md b/.jules/sentinel.md index 1600d4323..88ad5a4e8 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -127,3 +127,7 @@ **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. +## 2024-10-08 - Prevent DOM XSS in Dashboard +**Vulnerability:** Untrusted numerical and string data were being directly interpolated into `innerHTML` statements without escaping or numeric coercion. +**Learning:** Type coercion (e.g., `Number()`) acts as a secure mitigating factor for numeric types when dynamically generating DOM content, while string sanitization (like `esc()`) is best for arbitrary strings. +**Prevention:** Always coerce untrusted input payloads dynamically fetched and set on `innerHTML` into expected strict types (like `Number`) or explicitly escape them before insertion. diff --git a/scanner/dashboard/console.html b/scanner/dashboard/console.html index 7ec262af4..021992dcc 100644 --- a/scanner/dashboard/console.html +++ b/scanner/dashboard/console.html @@ -121,19 +121,19 @@
${esc((s.commit||"—").slice(0,10))}${esc(f.rule_id)}${esc(f.file)}:${esc(f.line)}