Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
## 2026-08-01 - DOM XSS in Dashboard dynamically rendered properties
**Vulnerability:** DOM XSS via unescaped `s.id`, `s.total`, and other summary properties injected into `innerHTML` in `scanner/dashboard/console.html`.
**Learning:** Even internal API IDs (like `s.id`) or numeric counters (like `s.total`) fetched from an API can carry malicious payloads if an attacker can control them via input (like findings). Injecting them directly into attributes (e.g. `data-id="${s.id}"`) allows breaking out of quotes and executing stored XSS.
**Prevention:** Always use the `esc()` sanitizer for any dynamically rendered property from JSON payloads, regardless of expected schema types (like numbers or internal IDs), to prevent DOM XSS vulnerabilities before updating the DOM.
8 changes: 4 additions & 4 deletions scanner/dashboard/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h1>AppGuardrail Console</h1>
if(!r.ok)throw new Error("Request failed ("+r.status+").");
return r.json();
}
function pill(n,color){return n>0?`<span class="pill" style="background:${color}">${n}</span>`:`<span class="muted">0</span>`;}
function pill(n,color){return n>0?`<span class="pill" style="background:${color}">${esc(n)}</span>`:`<span class="muted">0</span>`;}
function scrollDetailIntoView(element){
if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){
element.scrollIntoView();
Expand All @@ -125,15 +125,15 @@ <h1>AppGuardrail Console</h1>
["New since last scan",latest.new_blocking||0],
["Critical",c.CRITICAL||0],
["Scans stored",scans.length],
].map(([l,n])=>`<div class="stat"><div class="l">${l}</div><div class="n">${n}</div></div>`).join("");
].map(([l,n])=>`<div class="stat"><div class="l">${esc(l)}</div><div class="n">${esc(n)}</div></div>`).join("");
const ord=[...scans].reverse();
const max=Math.max(1,...ord.map(s=>s.deploy_blocking||0));
$("#trend").innerHTML=ord.map(s=>{const h=Math.round(6+((s.deploy_blocking||0)/max)*54);
const col=(s.deploy_blocking||0)>0?"var(--crit)":"var(--ok)";
return `<div class="bar" tabindex="0" role="img" aria-label="${esc(s.created_at)}: ${esc(String(s.deploy_blocking||0))} blocking" title="${esc(s.created_at)}: ${esc(String(s.deploy_blocking||0))} blocking" style="height:${h}px;background:${col}"></div>`;}).join("")||'<span class="muted">No scans yet.</span>';
$("#history tbody").innerHTML=scans.map(s=>`<tr class="scan" data-id="${s.id}" tabindex="0" role="button" title="View scan details">
$("#history tbody").innerHTML=scans.map(s=>`<tr class="scan" data-id="${esc(s.id)}" tabindex="0" role="button" title="View scan details">
Comment thread
seonghobae marked this conversation as resolved.
<td>${esc(s.created_at)}</td><td>${esc(s.repo||"—")}</td><td><code>${esc((s.commit||"—").slice(0,10))}</code></td>
<td>${s.total}</td><td>${pill(s.deploy_blocking,"var(--crit)")}</td><td>${pill(s.new_blocking,"var(--high)")}</td></tr>`).join("")||'<tr><td colspan="6" class="muted">No scans. POST to /api/v1/scans from CI.</td></tr>';
<td>${esc(s.total)}</td><td>${pill(s.deploy_blocking,"var(--crit)")}</td><td>${pill(s.new_blocking,"var(--high)")}</td></tr>`).join("")||'<tr><td colspan="6" class="muted">No scans. POST to /api/v1/scans from CI.</td></tr>';
document.querySelectorAll("tr.scan").forEach(tr=>{
tr.onclick=()=>detail(tr.dataset.id,tr);
tr.addEventListener('keydown', e => { if(e.key === 'Enter' || e.key === ' ') { e.preventDefault(); detail(tr.dataset.id,tr); } });
Expand Down
Loading