diff --git a/strix/config/settings.py b/strix/config/settings.py
index f5db30fc2..3d3583c2e 100644
--- a/strix/config/settings.py
+++ b/strix/config/settings.py
@@ -112,6 +112,10 @@ class RuntimeSettings(BaseSettings):
backend: str = Field(default="docker", alias="STRIX_RUNTIME_BACKEND")
# Max screenshot/image tool outputs kept live per agent context (0 = none).
max_context_images: int = Field(default=3, ge=0, alias="STRIX_MAX_CONTEXT_IMAGES")
+ # Emit a self-contained HTML findings report (report.html) on scan
+ # completion, alongside the markdown/CSV/JSON/SARIF outputs. Set to false
+ # (STRIX_HTML_REPORT=0) to disable.
+ html_report: bool = Field(default=True, alias="STRIX_HTML_REPORT")
class TelemetrySettings(BaseSettings):
diff --git a/strix/interface/viewer/server.py b/strix/interface/viewer/server.py
index 37bfd7cf3..652fe6349 100644
--- a/strix/interface/viewer/server.py
+++ b/strix/interface/viewer/server.py
@@ -78,15 +78,17 @@ def run_list_entry(run_dir: Path) -> dict[str, Any]:
}
-def build_runs_payload(base_dir: Path, *, verified: bool) -> dict[str, Any]:
- """The /api/runs payload. Gates the run list behind email verification.
+def build_runs_payload(base_dir: Path, *, unlocked: bool) -> dict[str, Any]:
+ """The /api/runs payload. Gates the run list behind the caller's authorization.
- The count is always advertised so the UI can tease the history, but the
- entries only appear once the viewer is verified.
+ ``unlocked`` is the caller's access decision (today: holds this process's
+ session capability). When locked, the count is still advertised so the UI can
+ tease the history, but the entries only appear once unlocked. Email
+ verification is no longer part of this decision.
"""
run_dirs = _iter_run_dirs(base_dir)
count = len(run_dirs)
- if not verified:
+ if not unlocked:
return {"locked": True, "count": count, "runs": []}
return {"locked": False, "count": count, "runs": [run_list_entry(d) for d in run_dirs]}
@@ -235,13 +237,17 @@ def _make_handler(state: _ViewerState) -> type[BaseHTTPRequestHandler]:
def _handle_api(self, path: str, query: dict[str, list[str]]) -> None:
# The launched run is always viewable with no verification. The
- # cross-run history list (/api/runs) unlocks its entries only for a
- # caller that holds this process's session capability *and* is email
- # verified, so merely reaching an exposed --host port never leaks the
- # run list (the payload still advertises the count as a teaser).
+ # cross-run history list (/api/runs) unlocks its entries for any
+ # caller that holds this process's session capability, so merely
+ # reaching an exposed --host port never leaks the run list (the
+ # cookie is handed only to the browser this process bootstrapped).
+ # Email verification is intentionally NOT required here: browsing
+ # local run history is a local convenience, and gating it behind an
+ # OTP was unnecessary friction. Verification still guards emailing an
+ # encrypted report (see _handle_report_send).
if path == "/api/runs":
- unlocked = self._has_session() and auth.is_verified()
- payload = build_runs_payload(state.base_dir, verified=unlocked)
+ unlocked = self._has_session()
+ payload = build_runs_payload(state.base_dir, unlocked=unlocked)
self._send_json(HTTPStatus.OK, payload)
return
if path == "/api/capabilities":
@@ -261,17 +267,15 @@ def _make_handler(state: _ViewerState) -> type[BaseHTTPRequestHandler]:
return
# The launched run is always viewable. Any *other* run's data is part
- # of the gated history: it needs this process's session capability
- # (so merely reaching an exposed --host port is not enough) *and*
- # email verification -- otherwise knowing a run name would leak its
- # metadata, vulnerabilities, report, and transcript.
- if run_dir.resolve() != state.run_dir.resolve():
- if not self._has_session():
- self._send_json(HTTPStatus.FORBIDDEN, {"error": "forbidden"})
- return
- if not auth.is_verified():
- self._send_json(HTTPStatus.UNAUTHORIZED, {"error": "unverified"})
- return
+ # of the history: it needs this process's session capability (so
+ # merely reaching an exposed --host port is not enough) -- knowing a
+ # run name is not sufficient to leak its metadata, vulnerabilities,
+ # report, or transcript. Email verification is intentionally NOT
+ # required, matching the /api/runs list: once the list is browsable,
+ # its entries must be openable without an OTP step.
+ if run_dir.resolve() != state.run_dir.resolve() and not self._has_session():
+ self._send_json(HTTPStatus.FORBIDDEN, {"error": "forbidden"})
+ return
if path == "/api/run":
self._send_json(HTTPStatus.OK, read_run_summary(run_dir))
diff --git a/strix/report/html_report.py b/strix/report/html_report.py
new file mode 100644
index 000000000..4bfdbcf45
--- /dev/null
+++ b/strix/report/html_report.py
@@ -0,0 +1,247 @@
+"""Self-contained HTML findings report renderer.
+
+Renders a Strix scan's findings (the same ``run_record`` + ``vulnerability_reports``
+data used by :mod:`strix.report.writer`) into a single portable HTML document with
+inlined CSS — no external assets, opens offline.
+
+Named ``html_report`` (not ``html``) to avoid shadowing the stdlib :mod:`html`
+module used here for escaping. All finding-derived content is escaped before
+embedding, so attacker-influenced values (titles, PoC code, snippets) cannot
+inject markup or script into the report.
+"""
+
+from __future__ import annotations
+
+import html
+from datetime import UTC, datetime
+from typing import Any
+
+
+# Mirrors ``strix.report.writer._SEVERITY_ORDER`` (kept local to avoid a cross-
+# module import cycle; both derive from the same fixed severity vocabulary).
+_SEVERITY_ORDER = {"critical": 0, "high": 1, "medium": 2, "low": 3, "info": 4}
+
+# Mirrors ``strix.interface.utils.get_severity_color`` for visual consistency.
+_SEVERITY_COLOR = {
+ "critical": "#dc2626",
+ "high": "#ea580c",
+ "medium": "#d97706",
+ "low": "#65a30d",
+ "info": "#0284c7",
+}
+_DEFAULT_COLOR = "#6b7280"
+
+_SEVERITIES = ("critical", "high", "medium", "low", "info")
+
+
+def _esc(value: Any) -> str:
+ """HTML-escape any value (attribute-safe). ``None`` becomes an empty string."""
+ if value is None:
+ return ""
+ return html.escape(str(value), quote=True)
+
+
+def _severity_color(severity: str) -> str:
+ return _SEVERITY_COLOR.get(severity.lower(), _DEFAULT_COLOR)
+
+
+def _sort_key(report: dict[str, Any]) -> tuple[int, str]:
+ severity = str(report.get("severity", "")).lower()
+ return (_SEVERITY_ORDER.get(severity, 5), str(report.get("timestamp", "")))
+
+
+def _target_label(run_record: dict[str, Any]) -> str:
+ targets = run_record.get("targets_info") or []
+ if isinstance(targets, list) and targets:
+ first = targets[0] if isinstance(targets[0], dict) else {}
+ original = first.get("original")
+ if isinstance(original, str) and original:
+ if len(targets) > 1:
+ return f"{original} (+{len(targets) - 1} more)"
+ return original
+ return "unknown"
+
+
+def _severity_counts(reports: list[dict[str, Any]]) -> dict[str, int]:
+ counts = dict.fromkeys(_SEVERITIES, 0)
+ for report in reports:
+ severity = str(report.get("severity", "")).lower()
+ if severity in counts:
+ counts[severity] += 1
+ return counts
+
+
+def _render_summary(run_record: dict[str, Any], reports: list[dict[str, Any]]) -> str:
+ run_name = _esc(run_record.get("run_name") or run_record.get("run_id") or "scan")
+ generated = _esc(datetime.now(UTC).strftime("%Y-%m-%d %H:%M:%S UTC"))
+ parts = [
+ '',
+ "
",
+ _render_meta_row(report),
+ ]
+ for label, key in (
+ ("Description", "description"),
+ ("Impact", "impact"),
+ ("Technical Analysis", "technical_analysis"),
+ ):
+ value = report.get(key)
+ if value:
+ parts.append(f"
{label}
{_esc(value)}
")
+
+ if report.get("poc_description") or report.get("poc_script_code"):
+ parts.append("")
+ if report.get("poc_description"):
+ parts.append(f"
Proof of Concept
{_esc(report['poc_description'])}
")
+ if report.get("poc_script_code"):
+ parts.append(_render_code_block("PoC Script", str(report["poc_script_code"])))
+ parts.append("")
+
+ code_locations = report.get("code_locations")
+ if isinstance(code_locations, list) and code_locations:
+ parts.append("
Code Locations
")
+ for loc in code_locations:
+ if not isinstance(loc, dict):
+ continue
+ file_ref = _esc(loc.get("file") or "unknown")
+ line = loc.get("start_line")
+ line_ref = f":{_esc(line)}" if line is not None else ""
+ parts.append(f'
{file_ref}{line_ref}
')
+ snippet = loc.get("snippet")
+ if snippet:
+ parts.append(f'