From fa666b7f433c571b8f4eb08b6894a0a61229ec7b Mon Sep 17 00:00:00 2001 From: Satyanarayana Vuppala Date: Sat, 7 Nov 2026 11:03:48 +0000 Subject: [PATCH 1/6] Show design verdicts as a short label plus reason; list the 5 newest Agents write the Design verdict as a full sentence, and the page put the whole sentence inside a badge: badges don't wrap, so on the architecture diagram card it ran out of the box, and the Design verdicts panel was a wrap of long coloured pills in no particular order. - report/architecture.split_design_verdict: sentence -> (label, reason), label from classify_design_verdict so it always matches the badge colour (Sound / Sound with conditions / Not sound / Not applicable / Unclear). - Design verdicts panel: a table of the 5 most recent reviews, newest first -- project, label badge, reason (clamped to two lines, full text in the tooltip), review date -- with "Latest N of M projects". - Diagram card: label badge with the reason as wrapping text below it. - Rows link to the successful review the verdict came from, not the project's latest run (which may have failed). - "Projects not cleanly Sound" compares the label, not the sentence. Co-Authored-By: Claude Opus 5.5 --- src/secfoo/report/architecture.py | 32 +++++ src/secfoo/storage/repository.py | 6 +- src/secfoo/web/routes/activities.py | 23 +++- src/secfoo/web/static/css/dashboard.css | 17 +++ .../web/templates/activities/detail.html | 43 +++++-- tests/test_web/test_design_verdicts.py | 118 ++++++++++++++++++ 6 files changed, 224 insertions(+), 15 deletions(-) create mode 100644 tests/test_web/test_design_verdicts.py diff --git a/src/secfoo/report/architecture.py b/src/secfoo/report/architecture.py index 14982303..74ba4487 100644 --- a/src/secfoo/report/architecture.py +++ b/src/secfoo/report/architecture.py @@ -264,3 +264,35 @@ def classify_design_verdict(value: str | None) -> str | None: if v.startswith("sound"): return "approve" return None + + +_VERDICT_LABELS = {"approve": "Sound", "conditions": "Sound with conditions", "reject": "Not sound"} +# Longest first: "sound" is a prefix of "sound with conditions". +_VERDICT_PREFIXES = ("sound with conditions", "not applicable", "not sound", "sound") + + +def split_design_verdict(value: str | None) -> tuple[str, str]: + """A Design verdict line -> (short label, the rest of the sentence). + + Agents write the verdict as a full sentence ("Not sound for any + deployment handling real users. It fits its declared purpose..."). The + label comes from classify_design_verdict, so it always agrees with the + badge colour and the gate-decision mix; the reason is whatever follows + the leading verdict phrase, for display beside the label. + """ + text = (value or "").strip() + lower = text.lower() + bucket = classify_design_verdict(text) + if bucket: + label = _VERDICT_LABELS[bucket] + elif lower.startswith(("not applicable", "n/a")): + label = "Not applicable" + else: + label = "Unclear" + rest = text + for prefix in _VERDICT_PREFIXES: + if lower.startswith(prefix): + rest = text[len(prefix):] + break + rest = rest.lstrip(" \t\u2014\u2013-:;,.").strip() + return label, (rest[:1].upper() + rest[1:]) if rest else "" diff --git a/src/secfoo/storage/repository.py b/src/secfoo/storage/repository.py index 77c38169..f0017a4c 100644 --- a/src/secfoo/storage/repository.py +++ b/src/secfoo/storage/repository.py @@ -575,12 +575,16 @@ def activity_summary_by_project(self, skill_id: str) -> list[dict]: # (diagram, design verdict) -- a failed/timeout run has no # report to read, but shouldn't hide an earlier successful one. latest_success = self._conn.execute( - "SELECT report_path FROM runs WHERE skill_id = ? AND project_id = ? " + "SELECT run_uuid, report_path, finished_at FROM runs WHERE skill_id = ? AND project_id = ? " "AND status = 'success' AND report_path IS NOT NULL " "ORDER BY started_at DESC LIMIT 1", (skill_id, data["project_id"]), ).fetchone() data["latest_success_report_path"] = latest_success["report_path"] if latest_success else None + # Which run that content came from, and when -- so a verdict links + # to the review it was read from, not a later failed run. + data["latest_success_run_uuid"] = latest_success["run_uuid"] if latest_success else None + data["latest_success_at"] = latest_success["finished_at"] if latest_success else None summary.append(data) return summary diff --git a/src/secfoo/web/routes/activities.py b/src/secfoo/web/routes/activities.py index e1c5ea93..3756ef86 100644 --- a/src/secfoo/web/routes/activities.py +++ b/src/secfoo/web/routes/activities.py @@ -21,7 +21,12 @@ from fastapi import APIRouter, Form, HTTPException, Request from fastapi.responses import RedirectResponse -from secfoo.report.architecture import count_trust_boundaries, extract_design_verdict, extract_mermaid_diagram +from secfoo.report.architecture import ( + count_trust_boundaries, + extract_design_verdict, + extract_mermaid_diagram, + split_design_verdict, +) from secfoo.skills.loader import SkillLoadError, load_skill from secfoo.storage.repository import RunRepository from secfoo.web import architecture_dashboard as arch_dashboard @@ -35,6 +40,10 @@ router = APIRouter() +# The Design verdicts panel shows only the newest reviews; the stat card +# above it still counts every project. +RECENT_VERDICTS_LIMIT = 5 + _GATE_MIX_COLORS = { "approve": "var(--color-success)", "conditions": "var(--color-warning)", @@ -81,6 +90,10 @@ def _attach_architecture_signals(projects: list[dict]) -> bool: text = Path(report_path).read_text(encoding="utf-8", errors="replace") project["diagram_source"] = extract_mermaid_diagram(text) project["design_verdict"] = extract_design_verdict(text) + if project["design_verdict"]: + # Agents write the verdict as a full sentence; badges show only + # the short label and the rest is displayed as wrapping text. + project["verdict_label"], project["verdict_reason"] = split_design_verdict(project["design_verdict"]) project["boundary_count"] = count_trust_boundaries(text) if project["diagram_source"]: any_diagram = True @@ -126,6 +139,12 @@ def activity_detail(request: Request, skill_id: str, diagram_project: int | None ) diagrams_available = _attach_architecture_signals(projects) + verdict_count = sum(1 for p in projects if p.get("design_verdict")) + recent_verdicts = sorted( + (p for p in projects if p.get("design_verdict")), + key=lambda p: p.get("latest_success_at") or "", + reverse=True, + )[:RECENT_VERDICTS_LIMIT] # A gallery rendering every project's diagram at once doesn't scale # past a couple of projects -- instead show one at a time, picked via @@ -150,6 +169,8 @@ def activity_detail(request: Request, skill_id: str, diagram_project: int | None ), "run_count": sum(p["run_count"] for p in projects), "diagrams_available": diagrams_available, + "recent_verdicts": recent_verdicts, + "verdict_count": verdict_count, "diagram_projects": diagram_projects, "selected_diagram_project": selected_diagram_project, "mermaid_available": mermaid_bundle_available(), diff --git a/src/secfoo/web/static/css/dashboard.css b/src/secfoo/web/static/css/dashboard.css index 65b37185..41d8a857 100644 --- a/src/secfoo/web/static/css/dashboard.css +++ b/src/secfoo/web/static/css/dashboard.css @@ -190,3 +190,20 @@ tr.run-row:hover { background-color: var(--color-primary-50); } .u-border-t-warning-3 { border-top: 3px solid var(--color-warning) !important; } .u-wrap-anywhere { overflow-wrap: anywhere !important; } .u-cursor-pointer { cursor: pointer !important; } + +/* Design verdicts: agents write the verdict as a sentence. The badge shows + the short label; the reason wraps beside/under it instead of overflowing + a no-wrap badge. In the table it is clamped to two lines (full text in + the title tooltip). */ +.verdict-summary { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); } +.verdict-summary > p { overflow-wrap: anywhere; max-width: 44rem; } +.verdict-table td { vertical-align: top; } +.verdict-reason { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + line-clamp: 2; + overflow: hidden; + overflow-wrap: anywhere; + min-width: 16rem; +} diff --git a/src/secfoo/web/templates/activities/detail.html b/src/secfoo/web/templates/activities/detail.html index b0c3d1ae..1fa2765d 100644 --- a/src/secfoo/web/templates/activities/detail.html +++ b/src/secfoo/web/templates/activities/detail.html @@ -57,7 +57,7 @@ {% if verdict_projects %}
- {{ verdict_projects | rejectattr("design_verdict", "in", ["Sound"]) | list | length }}/{{ verdict_projects | length }} + {{ verdict_projects | rejectattr("verdict_label", "equalto", "Sound") | list | length }}/{{ verdict_projects | length }} Projects not cleanly Sound
@@ -68,18 +68,30 @@
{% endif %} -{% if verdict_projects %} +{% if recent_verdicts %}
-

Design verdicts

-

- From each project's most recent successful review. -

-
- {% for p in verdict_projects %} - - {{ p.project_display_name }}: {{ p.design_verdict }} - - {% endfor %} +
+

Design verdicts

+ + {% if verdict_count > recent_verdicts | length %}Latest {{ recent_verdicts | length }} of {{ verdict_count }} projects{% else %}Latest review per project{% endif %} + +
+
+ + + + + + {% for p in recent_verdicts %} + + + + + + + {% endfor %} + +
ProjectVerdictWhyReviewed
{{ p.project_display_name }}{{ p.verdict_label }}{{ p.verdict_reason or "—" }}{{ (p.latest_success_at or "")[:10] or "—" }}
{% endif %} @@ -120,7 +132,12 @@

Architecture diagram

{{ selected_diagram_project.project_display_name }} {% if selected_diagram_project.design_verdict %} - {{ selected_diagram_project.design_verdict }} +
+ {{ selected_diagram_project.verdict_label }} + {% if selected_diagram_project.verdict_reason %} +

{{ selected_diagram_project.verdict_reason }}

+ {% endif %} +
{% endif %} {% if mermaid_available %}
diff --git a/tests/test_web/test_design_verdicts.py b/tests/test_web/test_design_verdicts.py new file mode 100644 index 00000000..2b262957 --- /dev/null +++ b/tests/test_web/test_design_verdicts.py @@ -0,0 +1,118 @@ +"""The Security Architecture page's Design verdicts panel and the verdict +shown on the architecture diagram card. + +Agents write the verdict as a full sentence, so the page shows a short +label in the badge and the rest as wrapping text -- never the whole +sentence inside a (no-wrap) badge -- and the panel lists only the newest +reviews. +""" + +from __future__ import annotations + +import re + +import pytest +from fastapi.testclient import TestClient + +from secfoo.report.architecture import split_design_verdict +from secfoo.storage.repository import RunRepository +from secfoo.web.app import create_app + + +@pytest.fixture +def client(tmp_path, monkeypatch): + monkeypatch.setattr("secfoo.storage.repository.DB_PATH", tmp_path / "db.sqlite") + monkeypatch.setattr("secfoo.storage.repository.ensure_store_dirs", lambda: None) + return TestClient(create_app()) + + +def _report(verdict: str) -> str: + return ( + "# Security Architecture Review Report\n\n## 3. Data Flow Diagram\n\n```mermaid\nflowchart LR\n" + " a([User]) -->|\"B1: HTTPS\"| b[\"API\"]\n```\n\n" + f"## 11. Design Verdict & Remediation Roadmap\n\n**Design verdict:** {verdict}\n" + ) + + +def _seed(tmp_path, project: str, verdict: str, finished_at: str) -> str: + repo = RunRepository() + project_id = repo.upsert_project(f"https://github.com/{project}", project, "github") + run_uuid = repo.create_run(project_id=project_id, skill_id="security-architecture-review", + skill_name="Security Architecture Review", agent_id="claude", confluence_urls=[]) + path = tmp_path / f"{run_uuid}.md" + path.write_text(_report(verdict)) + repo.complete_run(run_uuid, status="success", exit_code=0, duration_seconds=1.0, report_path=str(path), + prompt_path=None, stderr_excerpt=None) + repo._conn.execute("UPDATE runs SET finished_at = ? WHERE run_uuid = ?", (finished_at, run_uuid)) + repo._conn.commit() + repo.close() + return run_uuid + + +@pytest.mark.parametrize( + "verdict, label, reason", + [ + ("Sound", "Sound", ""), + ("Sound.", "Sound", ""), + ("Sound with conditions: rotate the signing key first", "Sound with conditions", + "Rotate the signing key first"), + ("Not sound for any deployment handling real users or data. It fits its training purpose.", + "Not sound", "For any deployment handling real users or data. It fits its training purpose."), + ("Not sound — but only in the trivial sense that no design is present", "Not sound", + "But only in the trivial sense that no design is present"), + ("Not applicable — there is no design to render a verdict on", "Not applicable", + "There is no design to render a verdict on"), + ("Inconclusive pending the vendor's docs", "Unclear", "Inconclusive pending the vendor's docs"), + (None, "Unclear", ""), + ], +) +def test_split_design_verdict(verdict, label, reason): + assert split_design_verdict(verdict) == (label, reason) + + +def _badges(html: str) -> list[str]: + return [b.strip() for b in re.findall(r'([^<]*)', html)] + + +def test_panel_lists_the_five_newest_reviews_newest_first(client, tmp_path): + for day in range(1, 8): # seven projects, reviewed on days 1..7 + _seed(tmp_path, f"acme/app-{day}", "Not sound for production use. Details follow.", f"2026-11-0{day}T10:00:00") + html = client.get("/activities/security-architecture-review").text + panel = html[html.index("Design verdicts"):html.index("", html.index("Design verdicts"))] + + shown = re.findall(r"acme/app-(\d)", panel) + assert shown == ["7", "6", "5", "4", "3"] + assert "Latest 5 of 7 projects" in panel + # The badge carries only the short label; the sentence is the "Why". + assert "Not sound" in _badges(panel) + assert all(len(b) <= len("Sound with conditions") for b in _badges(panel)) + assert "For production use. Details follow" in panel + + +def test_panel_row_links_to_the_review_the_verdict_came_from(client, tmp_path): + good = _seed(tmp_path, "acme/app", "Sound", "2026-11-01T10:00:00") + repo = RunRepository() + project_id = repo.upsert_project("https://github.com/acme/app", "acme/app", "github") + failed = repo.create_run(project_id=project_id, skill_id="security-architecture-review", + skill_name="Security Architecture Review", agent_id="claude", confluence_urls=[]) + repo.complete_run(failed, status="failed", exit_code=1, duration_seconds=1.0, report_path=None, + prompt_path=None, stderr_excerpt="boom") + repo.close() + + html = client.get("/activities/security-architecture-review").text + # Only the verdicts panel: the "By project" table rightly links the latest run. + panel = html[html.index("Design verdicts"):html.index("", html.index("Design verdicts"))] + assert f'data-href="/runs/{good}"' in panel + assert f'data-href="/runs/{failed}"' not in panel + + +def test_diagram_card_shows_label_badge_and_wrapping_reason(client, tmp_path): + long_verdict = "Not sound for any deployment handling real users or data. It fits its declared purpose." + _seed(tmp_path, "acme/app", long_verdict, "2026-11-01T10:00:00") + html = client.get("/activities/security-architecture-review").text + card = html[html.index("Architecture diagram"):] + assert long_verdict not in _badges(card) + assert "Not sound" in _badges(card) + assert '
Date: Sat, 7 Nov 2026 11:06:48 +0000 Subject: [PATCH 2/6] Unreviewed & stale: newest 5 only; review status column in By project - The "Unreviewed & stale" panel lists only the five most recently active projects (by last run), with "Latest N of M" and a link to the full table when more exist. - "By project" ends with a Review status column for every project: Current / Stale (Nd) / Trust boundary changed / No successful review, from the same stale list the dashboard already computes -- so trimming the panel hides nothing. - unreviewed_and_stale_projects (and boundary-changed rows) now carry last_activity_at so lists can be ordered by recency. Co-Authored-By: Claude Opus 5.5 --- src/secfoo/storage/repository.py | 4 +- src/secfoo/web/architecture_dashboard.py | 10 ++ src/secfoo/web/dashboard_common.py | 1 + src/secfoo/web/routes/activities.py | 3 + .../activities/architecture_dashboard.html | 9 +- .../web/templates/activities/detail.html | 12 ++- .../test_architecture_review_status.py | 97 +++++++++++++++++++ 7 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 tests/test_web/test_architecture_review_status.py diff --git a/src/secfoo/storage/repository.py b/src/secfoo/storage/repository.py index f0017a4c..13ed2c22 100644 --- a/src/secfoo/storage/repository.py +++ b/src/secfoo/storage/repository.py @@ -1030,7 +1030,7 @@ def unreviewed_and_stale_projects(self, skill_id: str, *, stale_days: int = 365) (never reviewed, then oldest) first. """ projects = self._conn.execute( - "SELECT DISTINCT projects.id, projects.display_name, projects.kind " + "SELECT DISTINCT projects.id, projects.display_name, projects.kind, projects.last_run_at " "FROM projects JOIN assessments ON assessments.project_id = projects.id" ).fetchall() @@ -1049,6 +1049,7 @@ def unreviewed_and_stale_projects(self, skill_id: str, *, stale_days: int = 365) "project_display_name": project["display_name"], "project_kind": project["kind"], "state": "never_reviewed", + "last_activity_at": project["last_run_at"], "last_reviewed_at": None, "days_since_review": None, } @@ -1068,6 +1069,7 @@ def unreviewed_and_stale_projects(self, skill_id: str, *, stale_days: int = 365) "project_display_name": project["display_name"], "project_kind": project["kind"], "state": "stale", + "last_activity_at": project["last_run_at"], "last_reviewed_at": latest["started_at"], "days_since_review": round(days_since), } diff --git a/src/secfoo/web/architecture_dashboard.py b/src/secfoo/web/architecture_dashboard.py index 213c4295..beef0e8f 100644 --- a/src/secfoo/web/architecture_dashboard.py +++ b/src/secfoo/web/architecture_dashboard.py @@ -61,11 +61,18 @@ class ArchitectureDashboard: disposition_total: int = 0 exception_aging: dict[str, int] = field(default_factory=dict) stale_projects: list[dict] = field(default_factory=list) + # The "Unreviewed & stale" panel shows only the most recently active + # few; the full list above still drives each project's review status + # in the "By project" table. + recent_stale_projects: list[dict] = field(default_factory=list) root_causes: list[tuple[str, int]] = field(default_factory=list) gate_mix: dict[str, int] = field(default_factory=dict) top_standards: list[tuple[str, int]] = field(default_factory=list) +RECENT_STALE_LIMIT = 5 + + def build(repo: RunRepository) -> ArchitectureDashboard: dash = ArchitectureDashboard() @@ -176,5 +183,8 @@ def build(repo: RunRepository) -> ArchitectureDashboard: dash.stale_projects = repo.unreviewed_and_stale_projects(SKILL_ID, stale_days=STALE_DAYS) append_boundary_changed_projects(repo, SKILL_ID, projects, dash.stale_projects) + dash.recent_stale_projects = sorted( + dash.stale_projects, key=lambda p: p.get("last_activity_at") or "", reverse=True + )[:RECENT_STALE_LIMIT] return dash diff --git a/src/secfoo/web/dashboard_common.py b/src/secfoo/web/dashboard_common.py index 3bcef061..8b4a1c34 100644 --- a/src/secfoo/web/dashboard_common.py +++ b/src/secfoo/web/dashboard_common.py @@ -63,6 +63,7 @@ def append_boundary_changed_projects( "project_kind": project["project_kind"], "state": "boundary_changed", "last_reviewed_at": project.get("latest_started_at"), + "last_activity_at": project.get("latest_started_at"), "days_since_review": None, } ) diff --git a/src/secfoo/web/routes/activities.py b/src/secfoo/web/routes/activities.py index 3756ef86..d67600c4 100644 --- a/src/secfoo/web/routes/activities.py +++ b/src/secfoo/web/routes/activities.py @@ -170,6 +170,9 @@ def activity_detail(request: Request, skill_id: str, diagram_project: int | None "run_count": sum(p["run_count"] for p in projects), "diagrams_available": diagrams_available, "recent_verdicts": recent_verdicts, + # Architecture only: every project's review state (stale / boundary + # changed), shown as the last column of the "By project" table. + "review_states": {p["project_id"]: p for p in dash.stale_projects} if dash else None, "verdict_count": verdict_count, "diagram_projects": diagram_projects, "selected_diagram_project": selected_diagram_project, diff --git a/src/secfoo/web/templates/activities/architecture_dashboard.html b/src/secfoo/web/templates/activities/architecture_dashboard.html index 3ab9457a..e50dc9d1 100644 --- a/src/secfoo/web/templates/activities/architecture_dashboard.html +++ b/src/secfoo/web/templates/activities/architecture_dashboard.html @@ -90,13 +90,18 @@

Exception aging

-

Unreviewed & stale

+
{% if dash.stale_projects %}
- {% for p in dash.stale_projects %} + {% for p in dash.recent_stale_projects %}
ProjectStateLast reviewed
{{ p.project_display_name }} diff --git a/src/secfoo/web/templates/activities/detail.html b/src/secfoo/web/templates/activities/detail.html index 1fa2765d..31493b21 100644 --- a/src/secfoo/web/templates/activities/detail.html +++ b/src/secfoo/web/templates/activities/detail.html @@ -155,7 +155,7 @@

Architecture diagram

{% endif %} {% endif %} -

By project

+

By project

{% if projects %}
@@ -164,6 +164,7 @@

By project

{% if verdict_projects %}{% endif %} + {% if review_states is not none %}{% endif %} @@ -183,6 +184,15 @@

By project

Assessment {% endif %} + {% if review_states is not none %} + {% set rs = review_states.get(p.project_id) %} + + {% endif %} {% endfor %} diff --git a/tests/test_web/test_architecture_review_status.py b/tests/test_web/test_architecture_review_status.py new file mode 100644 index 00000000..0468eae0 --- /dev/null +++ b/tests/test_web/test_architecture_review_status.py @@ -0,0 +1,97 @@ +"""Security Architecture page: the "Unreviewed & stale" panel shows only the +five most recently active projects, and every project's review status is +the last column of the "By project" table.""" + +from __future__ import annotations + +import re + +import pytest +from fastapi.testclient import TestClient + +from secfoo.storage.repository import RunRepository +from secfoo.web.app import create_app + +SKILL = "security-architecture-review" +REPORT = "# Security Architecture Review Report\n\n**Design verdict:** Sound\n" + + +@pytest.fixture +def client(tmp_path, monkeypatch): + monkeypatch.setattr("secfoo.storage.repository.DB_PATH", tmp_path / "db.sqlite") + monkeypatch.setattr("secfoo.storage.repository.ensure_store_dirs", lambda: None) + return TestClient(create_app()) + + +def _project(repo: RunRepository, name: str, last_run_at: str) -> int: + project_id = repo.upsert_project(f"https://github.com/{name}", name, "github") + repo.create_assessment(project_id=project_id, assessment_type="internal", status="in_progress") + repo._conn.execute("UPDATE projects SET last_run_at = ? WHERE id = ?", (last_run_at, project_id)) + repo._conn.commit() + return project_id + + +def _run(repo: RunRepository, tmp_path, project_id: int, *, status: str, started_at: str) -> None: + run_uuid = repo.create_run(project_id=project_id, skill_id=SKILL, skill_name="Security Architecture Review", + agent_id="claude", confluence_urls=[]) + path = tmp_path / f"{run_uuid}.md" + path.write_text(REPORT) + repo.complete_run(run_uuid, status=status, exit_code=0 if status == "success" else 1, duration_seconds=1.0, + report_path=str(path) if status == "success" else None, prompt_path=None, stderr_excerpt=None) + repo._conn.execute("UPDATE runs SET started_at = ? WHERE run_uuid = ?", (started_at, run_uuid)) + repo._conn.commit() + + +def _section(html: str, start: str, end: str) -> str: + i = html.index(start) + return html[i:html.index(end, i)] + + +def test_stale_panel_shows_the_five_most_recently_active(client): + repo = RunRepository() + for day in range(1, 8): # seven never-reviewed projects, last active on days 1..7 + _project(repo, f"acme/svc-{day}", f"2026-11-0{day}T09:00:00+00:00") + repo.close() + + html = client.get(f"/activities/{SKILL}").text + panel = _section(html, "Unreviewed & stale", "
ProjectRunsLatestStatusBoundariesFindingsReview status
+ {% if not p.latest_success_run_uuid %}No successful review + {% elif rs and rs.state == "boundary_changed" %}Trust boundary changed + {% elif rs and rs.state == "stale" %}Stale ({{ rs.days_since_review }}d) + {% else %}Current{% endif %} +
") + assert re.findall(r"acme/svc-(\d)", panel) == ["7", "6", "5", "4", "3"] + assert "Latest 5 of 7" in panel + assert 'href="#by-project"' in panel + + +def test_by_project_ends_with_each_projects_review_status(client, tmp_path): + repo = RunRepository() + current = _project(repo, "acme/current", "2026-11-07T09:00:00+00:00") + _run(repo, tmp_path, current, status="success", started_at="2026-11-07T09:00:00+00:00") + stale = _project(repo, "acme/stale", "2024-01-01T09:00:00+00:00") + _run(repo, tmp_path, stale, status="success", started_at="2024-01-01T09:00:00+00:00") + broken = _project(repo, "acme/broken", "2026-11-06T09:00:00+00:00") + _run(repo, tmp_path, broken, status="failed", started_at="2026-11-06T09:00:00+00:00") + repo.close() + + html = client.get(f"/activities/{SKILL}").text + table = _section(html, 'id="by-project"', "
") + header = re.findall(r"([^<]*)", table) + assert header[-1] == "Review status" + + def status_of(name: str) -> str: + row = re.search(rf"]*>(?:(?!).)*{re.escape(name)}(?:(?!).)*", table, re.S).group(0) + cells = re.findall(r"]*>(.*?)", row, re.S) + return re.sub(r"<[^>]+>", "", cells[-1]).strip() + + assert status_of("acme/current") == "Current" + assert re.fullmatch(r"Stale \(\d+d\)", status_of("acme/stale")) + assert status_of("acme/broken") == "No successful review" + + +def test_other_activities_have_no_review_status_column(client, tmp_path): + repo = RunRepository() + project_id = _project(repo, "acme/app", "2026-11-07T09:00:00+00:00") + run_uuid = repo.create_run(project_id=project_id, skill_id="sast", skill_name="SAST", agent_id="claude", + confluence_urls=[]) + repo.complete_run(run_uuid, status="success", exit_code=0, duration_seconds=1.0, report_path=None, + prompt_path=None, stderr_excerpt=None) + repo.close() + html = client.get("/activities/sast").text + assert "Review status" not in html From 9918a56449d7d55ad2bd30cf6f67fa0034f09164 Mon Sep 17 00:00:00 2001 From: Satyanarayana Vuppala Date: Sat, 7 Nov 2026 11:51:45 +0000 Subject: [PATCH 3/6] Threat modeling: info button on every widget; clearer depth mix and STRIDE - New info_tip macro (_macros.html): a small (i) button in a widget's top-right corner that opens a short explanation of what the widget shows, where the number comes from, and what to do about it. Built on
, so it works without inline script under the portal CSP; interactive.js keeps one open at a time and closes it on an outside click or Escape (focus returns to the button). - All 12 Threat Modeling widgets get one. - Model depth mix: each count now carries its name and meaning (Full = whole system, Feature-level = one feature or data flow, Lightweight = fast checklist pass), the model total, and a hint when lightweight models outnumber full ones. - STRIDE x asset-class matrix: full names for S/T/R/I/D/E (legend and hover) and a colour key (none / 1-2 / 3+). Co-Authored-By: Claude Opus 5.5 --- src/secfoo/web/static/css/dashboard.css | 45 ++++++++ src/secfoo/web/static/js/interactive.js | 24 ++++ src/secfoo/web/templates/_macros.html | 17 +++ .../activities/threat_modeling_dashboard.html | 107 ++++++++++++++---- tests/test_web/test_widget_info_tips.py | 103 +++++++++++++++++ 5 files changed, 276 insertions(+), 20 deletions(-) create mode 100644 tests/test_web/test_widget_info_tips.py diff --git a/src/secfoo/web/static/css/dashboard.css b/src/secfoo/web/static/css/dashboard.css index 41d8a857..8700e211 100644 --- a/src/secfoo/web/static/css/dashboard.css +++ b/src/secfoo/web/static/css/dashboard.css @@ -207,3 +207,48 @@ tr.run-row:hover { background-color: var(--color-primary-50); } overflow-wrap: anywhere; min-width: 16rem; } + +/* Widget info button (macro info_tip in _macros.html). */ +.has-info { position: relative; } +.has-info > .card__title, +.has-info > .stat-card__label { padding-right: 2rem; } +.info-tip { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 5; } +.info-tip--inline { position: relative; top: auto; right: auto; display: inline-block; vertical-align: middle; margin-left: var(--space-2); } +.info-tip__trigger { + list-style: none; + display: inline-flex; align-items: center; justify-content: center; + width: 1.25rem; height: 1.25rem; border-radius: 999px; + border: 1px solid var(--color-border); background: var(--color-surface); + color: var(--color-text-muted); font: italic 600 0.75rem/1 Georgia, "Times New Roman", serif; + cursor: pointer; user-select: none; + transition: color var(--duration-base, .15s), border-color var(--duration-base, .15s); +} +.info-tip__trigger::-webkit-details-marker { display: none; } +.info-tip__trigger::marker { content: ""; } +.info-tip__trigger:hover, .info-tip[open] > .info-tip__trigger { color: var(--color-primary-700, #1d4ed8); border-color: currentColor; } +.info-tip__trigger:focus-visible { outline: 2px solid var(--color-primary-600, #2563eb); outline-offset: 2px; } +.info-tip__panel { + position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 20; + width: min(22rem, 80vw); + background: var(--color-surface); color: var(--color-text, inherit); + border: 1px solid var(--color-border); border-radius: var(--radius-md, 8px); + box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.12)); + padding: var(--space-4); text-align: left; + font: var(--text-body-sm); font-style: normal; font-weight: 400; letter-spacing: normal; text-transform: none; +} +.info-tip--inline .info-tip__panel { left: 0; right: auto; } +.info-tip__title { font-weight: 600; margin: 0 0 var(--space-2); } +.info-tip__panel p { margin: 0 0 var(--space-2); } +.info-tip__panel p:last-child { margin-bottom: 0; } + +/* Threat modeling: model depth breakdown and STRIDE legend. */ +.depth-mix { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); } +.depth-mix__item { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: center; gap: var(--space-3); } +.depth-mix__count { font-size: 1.75rem; font-weight: 700; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; } +.depth-mix__item .ds-caption { display: block; line-height: 1.4; } +.depth-mix__name { font-weight: 600; display: block; } +.stride-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin-top: var(--space-3); } +.stride-legend abbr { text-decoration: none; font-weight: 600; } +.stride-key { display: inline-flex; align-items: center; gap: var(--space-1); } +.stride-key__swatch { width: 0.75rem; height: 0.75rem; border-radius: 3px; display: inline-block; } + diff --git a/src/secfoo/web/static/js/interactive.js b/src/secfoo/web/static/js/interactive.js index 76ca0fca..4907d240 100644 --- a/src/secfoo/web/static/js/interactive.js +++ b/src/secfoo/web/static/js/interactive.js @@ -115,3 +115,27 @@ document.addEventListener("change", function (event) { box.checked = all.checked; }); }); + +// Widget info buttons (
): one open at a time, +// closed by a click elsewhere or Escape (focus returns to the button). +document.addEventListener("toggle", function (event) { + const tip = event.target; + if (!(tip instanceof HTMLDetailsElement) || !tip.classList.contains("info-tip") || !tip.open) return; + document.querySelectorAll("details.info-tip[open]").forEach(function (other) { + if (other !== tip) other.open = false; + }); +}, true); +document.addEventListener("click", function (event) { + document.querySelectorAll("details.info-tip[open]").forEach(function (tip) { + if (!tip.contains(event.target)) tip.open = false; + }); +}); +document.addEventListener("keydown", function (event) { + if (event.key !== "Escape") return; + document.querySelectorAll("details.info-tip[open]").forEach(function (tip) { + tip.open = false; + const trigger = tip.querySelector("summary"); + if (trigger) trigger.focus(); + }); +}); + diff --git a/src/secfoo/web/templates/_macros.html b/src/secfoo/web/templates/_macros.html index 59992b21..25e1bc14 100644 --- a/src/secfoo/web/templates/_macros.html +++ b/src/secfoo/web/templates/_macros.html @@ -40,3 +40,20 @@ {%- endfor %} {% endmacro %} + +{#- Small (i) button for a widget's top-right corner; clicking it explains + what the widget shows. A native
, so it works with no inline + script under the portal's CSP; static/js/interactive.js closes it on an + outside click or Escape and keeps one open at a time. The widget needs + the `has-info` class (position: relative). Pass inline=True to sit + after a section heading instead of in a corner. + Usage: {% call info_tip("Coverage") %}

...

{% endcall %} -#} +{% macro info_tip(title, inline=False) %} +
+ +
+

{{ title }}

+ {{ caller() }} +
+
+{% endmacro %} diff --git a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html index 3cc5f139..bfbec4ed 100644 --- a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html +++ b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html @@ -5,14 +5,16 @@ mix, post-build misses, and falsified assumptions. See web/threat_modeling_dashboard.py for what's real vs. approximated. #} +{% from "_macros.html" import info_tip %} + {% macro stride_table(matrix) %}
- {% for letter in ["S", "T", "R", "I", "D", "E"] %} - + {% for letter, name in [("S", "Spoofing"), ("T", "Tampering"), ("R", "Repudiation"), ("I", "Information disclosure"), ("D", "Denial of service"), ("E", "Elevation of privilege")] %} + {% endfor %} @@ -36,30 +38,59 @@ Program dashboard
-
+
+ {% call info_tip("Coverage") %} +

Share of in-scope systems that have at least one successful threat model.

+

In scope means every project that has an assessment. To raise it, model the projects listed under Models needing rework.

+ {% endcall %} {{ tm_dash.coverage_pct }}% Coverage — {{ tm_dash.coverage_reviewed }} / {{ tm_dash.coverage_in_scope }} in-scope systems
-
+
+ {% call info_tip("Open threats past due") %} +

Threats a model left as a Gap (no mitigation) where that model is more than {{ past_due_sla_days }} days old.

+

Threats have no individual due dates, so the model's age stands in for one. Close the gap, or record a risk acceptance with secfoo accept create.

+ {% endcall %} {{ tm_dash.open_threats_past_due }} Open threats past due (>{{ past_due_sla_days }}d)
-
+
+ {% call info_tip("Mitigated but untested") %} +

Threats marked Mitigated with no test reference in the threat register: the control is claimed, not proven.

+

Add a test, pen-test or scan reference in the next model to move them to Mitigated + tested.

+ {% endcall %} {{ tm_dash.mitigated_untested }} Threats mitigated but untested
-
+
+ {% call info_tip("Median threats per model") %} +

The middle value of how many threats each project's latest model found.

+

A very low number usually means a shallow model rather than a safe system. Compare with Model depth mix.

+ {% endcall %} {{ tm_dash.median_threats_per_model if tm_dash.median_threats_per_model is not none else "—" }} Median threats per model
-
+
+ {% call info_tip("STRIDE × asset-class coverage") %} +

Counts the threats in each project's latest model by STRIDE category (columns) and by the kind of element they target (rows).

+

Red cells (none found) are the ones to read: that combination was never examined, which is not the same as safe. The per-project tables show which system a gap belongs to.

+ {% endcall %}

STRIDE × asset-class coverage

-

+

Empty cells are the signal — a blank column means that category was never exercised, not that it's safe from it.

+
+ S SpoofingT TamperingR Repudiation + I Information disclosureD Denial of serviceE Elevation of privilege +
+
+ None found + 1–2 threats + 3 or more +
Portfolio total (every modeled project, summed)
@@ -84,7 +115,11 @@

STRIDE × asset-class coverage

-
+
+ {% call info_tip("Threat disposition") %} +

What happened to every threat in each project's latest model:

+

Mitigated + tested (control proven), Mitigated, untested (claimed only), Accepted (risk taken on), Transferred (to a vendor or insurer), Open (a gap), and Past due (a gap in a model older than {{ past_due_sla_days }} days).

+ {% endcall %}

Threat disposition

{% if tm_dash.disposition_total %}
@@ -108,7 +143,11 @@

Threat disposition

-
+
+ {% call info_tip("Accepted threats") %} +

Every threat a model marked Accepted, matched with the person who signed it off.

+

A threat with no owner shown has not been signed off by anyone yet. Record the owner with secfoo accept create.

+ {% endcall %}

Accepted threats

Every threat marked Accepted, reconciled with who actually signed off — secfoo accept create is how "not recorded" turns into a real name. @@ -140,7 +179,12 @@

Accepted threats

-

Models needing rework

+

Models needing rework + {% call info_tip("Models needing rework", inline=True) %} +

In-scope projects whose threat model is missing, stale (latest successful model is over a year old), or whose trust boundaries changed between the last two models.

+

Sorted by open findings, as a stand-in for how critical the system is.

+ {% endcall %} +

{% if tm_dash.needs_rework %}
Asset class{{ letter }}{{ letter }}
@@ -166,7 +210,12 @@

Models needing rework

-

Recurring threat patterns

+

Recurring threat patterns + {% call info_tip("Recurring threat patterns", inline=True) %} +

The most common kinds of threat across every successful threat model, including older ones.

+

A pattern that keeps coming back is best fixed once, at platform level (a shared control or library), rather than project by project.

+ {% endcall %} +

{% if tm_dash.recurring_patterns %}
{% for archetype, count in tm_dash.recurring_patterns %} @@ -185,16 +234,30 @@

Recurring threat patterns

-
+
+ {% call info_tip("Model depth mix") %} +

How thorough each project's latest threat model was, as the model declares about itself.

+

Full covers the whole system. Feature-level covers one feature or new data flow. Lightweight is a fast checklist pass.

+

Lightweight models miss more. Critical systems should have a Full model; a mostly-lightweight portfolio means coverage looks better than it is.

+ {% endcall %}

Model depth mix

-
-
{{ tm_dash.model_depth_mix.full }}Full
-
{{ tm_dash.model_depth_mix.feature_level }}Feature-level
-
{{ tm_dash.model_depth_mix.lightweight }}Lightweight
-
+ {% set depth_total = tm_dash.model_depth_mix.full + tm_dash.model_depth_mix.feature_level + tm_dash.model_depth_mix.lightweight %} +

How deep each project's latest model went{% if depth_total %} ({{ depth_total }} model{{ "s" if depth_total != 1 else "" }}){% endif %}.

+
    +
  • {{ tm_dash.model_depth_mix.full }}FullWhole system: every component and trust boundary
  • +
  • {{ tm_dash.model_depth_mix.feature_level }}Feature-levelOne feature or new data flow
  • +
  • {{ tm_dash.model_depth_mix.lightweight }}LightweightFast checklist pass
  • +
+ {% if tm_dash.model_depth_mix.lightweight > tm_dash.model_depth_mix.full %} +

More lightweight than full models: re-run critical systems at --depth standard.

+ {% endif %}
-
+
+ {% call info_tip("Threats found post-build") %} +

Threats discovered after release (an incident, a pen test, a later scan) that an earlier model should have caught.

+

Recorded by hand with secfoo miss, since a model can't know what it missed. A rising count means models are too shallow.

+ {% endcall %}

Threats found post-build

{{ tm_dash.post_build_count_recent }} in the last 90 days ({{ tm_dash.post_build_count_total }} all-time) @@ -209,7 +272,11 @@

Threats found post-build

{% endif %}
-
+
+ {% call info_tip("Falsified assumptions") %} +

Assumptions a model relied on (for example, "only internal traffic reaches this service") that it then checked against the code and found false.

+

Each one marks a place where the design and the real system disagree.

+ {% endcall %}

Falsified assumptions

{{ tm_dash.falsified_assumptions | length }} {% if tm_dash.falsified_assumptions %} diff --git a/tests/test_web/test_widget_info_tips.py b/tests/test_web/test_widget_info_tips.py new file mode 100644 index 00000000..1bfca9b4 --- /dev/null +++ b/tests/test_web/test_widget_info_tips.py @@ -0,0 +1,103 @@ +"""Widget info buttons (macro info_tip) on the Threat Modeling dashboard, +and the clearer Model depth mix / STRIDE matrix.""" + +from __future__ import annotations + +import re +from pathlib import Path + +import pytest +from fastapi.testclient import TestClient + +from secfoo.storage.repository import RunRepository +from secfoo.web.app import create_app + +STATIC_JS = Path(__file__).parents[2] / "src" / "secfoo" / "web" / "static" / "js" / "interactive.js" + +TM_REPORT = """\ +# Threat Modeling Report + +## 1. Executive Summary +Summary. **Overall risk rating:** High + +**Model depth:** {depth} + +## Threat Register +| ID | Threat | STRIDE | Asset class | Archetype | Disposition | Test reference | +|----|--------|--------|-------------|-----------|-------------|----------------| +| T1 | Forged token | S | Process | Auth bypass | Gap | none | +""" + + +@pytest.fixture +def client(tmp_path, monkeypatch): + monkeypatch.setattr("secfoo.storage.repository.DB_PATH", tmp_path / "db.sqlite") + monkeypatch.setattr("secfoo.storage.repository.ensure_store_dirs", lambda: None) + return TestClient(create_app()) + + +def _seed(tmp_path, project: str, depth: str) -> None: + repo = RunRepository() + project_id = repo.upsert_project(f"https://github.com/{project}", project, "github") + repo.create_assessment(project_id=project_id, assessment_type="internal", status="in_progress") + run_uuid = repo.create_run(project_id=project_id, skill_id="threat-modeling", skill_name="Threat Modeling", + agent_id="claude", confluence_urls=[]) + path = tmp_path / f"{run_uuid}.md" + path.write_text(TM_REPORT.format(depth=depth)) + repo.complete_run(run_uuid, status="success", exit_code=0, duration_seconds=1.0, report_path=str(path), + prompt_path=None, stderr_excerpt=None) + repo.close() + + +WIDGETS = [ + "Coverage", "Open threats past due", "Mitigated but untested", "Median threats per model", + "STRIDE × asset-class coverage", "Threat disposition", "Accepted threats", "Models needing rework", + "Recurring threat patterns", "Model depth mix", "Threats found post-build", "Falsified assumptions", +] + + +def test_every_threat_modeling_widget_has_an_info_tip(client, tmp_path): + _seed(tmp_path, "acme/app", "Lightweight") + html = client.get("/activities/threat-modeling").text + tips = re.findall(r'
.*?
', html, re.S) + titles = [re.search(r'

([^<]*)

', t).group(1) for t in tips] + assert titles == WIDGETS + for tip in tips: + # An accessible button and a real explanation, not an empty panel. + assert 'aria-label="What is' in tip + body = re.sub(r"<[^>]+>", " ", tip.split('class="info-tip__title"', 1)[1]) + assert len(body.split()) >= 15 + + +def test_model_depth_mix_explains_each_depth(client, tmp_path): + _seed(tmp_path, "acme/a", "Lightweight") + _seed(tmp_path, "acme/b", "Lightweight") + _seed(tmp_path, "acme/c", "Full") + html = client.get("/activities/threat-modeling").text + card = html[html.index('

Model depth mix

'):] + card = card[:card.index("")] + assert "(3 models)" in card + assert "Whole system" in card and "One feature or new data flow" in card and "Fast checklist pass" in card + counts = re.findall(r'(\d+)', card) + assert counts == ["1", "0", "2"] + assert "More lightweight than full models" in html + + +def test_no_lightweight_hint_when_models_are_full(client, tmp_path): + _seed(tmp_path, "acme/a", "Full") + assert "More lightweight than full models" not in client.get("/activities/threat-modeling").text + + +def test_stride_matrix_names_its_letters_and_colours(client, tmp_path): + _seed(tmp_path, "acme/app", "Full") + html = client.get("/activities/threat-modeling").text + for name in ("Spoofing", "Tampering", "Repudiation", "Information disclosure", "Denial of service", + "Elevation of privilege"): + assert f'' in html + assert "None found" in html and "1–2 threats" in html and "3 or more" in html + + +def test_info_tips_close_on_outside_click_and_escape(): + js = STATIC_JS.read_text() + assert "details.info-tip[open]" in js + assert '"Escape"' in js and '"toggle"' in js From 5ba840c9f18ec47db2a512893f7ec263798b4bd6 Mon Sep 17 00:00:00 2001 From: Satyanarayana Vuppala Date: Sat, 7 Nov 2026 12:01:04 +0000 Subject: [PATCH 4/6] Put section-heading info buttons right after the heading text WebKit always lays a
out as a block, so the inline info button under "Models needing rework" and "Recurring threat patterns" dropped to its own line. The heading is now a flex row (heading-with-info), which keeps the button after the last word in every browser. Co-Authored-By: Claude Opus 5.5 --- src/secfoo/web/static/css/dashboard.css | 6 +++++- .../templates/activities/threat_modeling_dashboard.html | 4 ++-- tests/test_web/test_widget_info_tips.py | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/secfoo/web/static/css/dashboard.css b/src/secfoo/web/static/css/dashboard.css index 8700e211..4f9f5332 100644 --- a/src/secfoo/web/static/css/dashboard.css +++ b/src/secfoo/web/static/css/dashboard.css @@ -213,7 +213,11 @@ tr.run-row:hover { background-color: var(--color-primary-50); } .has-info > .card__title, .has-info > .stat-card__label { padding-right: 2rem; } .info-tip { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 5; } -.info-tip--inline { position: relative; top: auto; right: auto; display: inline-block; vertical-align: middle; margin-left: var(--space-2); } +.info-tip--inline { position: relative; top: auto; right: auto; } +/* A heading followed by its info button: the button sits right after the + last word. Flex rather than an inline
, because WebKit always + lays
out as a block. */ +.heading-with-info { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); } .info-tip__trigger { list-style: none; display: inline-flex; align-items: center; justify-content: center; diff --git a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html index bfbec4ed..02b176bf 100644 --- a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html +++ b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html @@ -179,7 +179,7 @@

Accepted threats

-

Models needing rework +

Models needing rework {% call info_tip("Models needing rework", inline=True) %}

In-scope projects whose threat model is missing, stale (latest successful model is over a year old), or whose trust boundaries changed between the last two models.

Sorted by open findings, as a stand-in for how critical the system is.

@@ -210,7 +210,7 @@

Models needing rework

-

Recurring threat patterns +

Recurring threat patterns {% call info_tip("Recurring threat patterns", inline=True) %}

The most common kinds of threat across every successful threat model, including older ones.

A pattern that keeps coming back is best fixed once, at platform level (a shared control or library), rather than project by project.

diff --git a/tests/test_web/test_widget_info_tips.py b/tests/test_web/test_widget_info_tips.py index 1bfca9b4..4f3023d0 100644 --- a/tests/test_web/test_widget_info_tips.py +++ b/tests/test_web/test_widget_info_tips.py @@ -101,3 +101,12 @@ def test_info_tips_close_on_outside_click_and_escape(): js = STATIC_JS.read_text() assert "details.info-tip[open]" in js assert '"Escape"' in js and '"toggle"' in js + + +def test_section_heading_info_tips_follow_the_heading_text(client, tmp_path): + _seed(tmp_path, "acme/app", "Full") + html = client.get("/activities/threat-modeling").text + for title in ("Models needing rework", "Recurring threat patterns"): + heading = re.search(rf'

{title}\s*
', html) + assert heading, f"{title}: info button must come right after the heading text" + assert "heading-with-info" in heading.group(1) From 14702637a7bdbc53ae4cccdeb3567dcaeac2fdc9 Mon Sep 17 00:00:00 2001 From: Satyanarayana Vuppala Date: Sat, 7 Nov 2026 13:37:17 +0000 Subject: [PATCH 5/6] Explain the other dashboards and scroll widget lists after ten rows. Threat-modeling cards match that pattern: each widget says what it counts, and a list longer than ten rows scrolls inside the card. Co-authored-by: Cursor --- src/secfoo/web/architecture_dashboard.py | 4 +- src/secfoo/web/sast_dashboard.py | 2 +- src/secfoo/web/static/css/dashboard.css | 170 +++++++++++++++++- src/secfoo/web/static/js/interactive.js | 47 +++++ .../activities/architecture_dashboard.html | 92 ++++++++-- .../web/templates/activities/detail.html | 54 ++++-- .../templates/activities/sast_dashboard.html | 56 +++++- .../templates/activities/sca_dashboard.html | 47 ++++- .../activities/secret_scanning_dashboard.html | 45 ++++- .../activities/threat_modeling_dashboard.html | 152 ++++++++++------ .../web/templates/assessments/detail.html | 12 +- src/secfoo/web/templates/overview.html | 74 ++++++-- src/secfoo/web/templates/responsible_ai.html | 21 ++- src/secfoo/web/templates/third_party.html | 12 +- src/secfoo/web/threat_modeling_dashboard.py | 2 +- tests/test_web/test_widget_info_tips.py | 108 ++++++++++- 16 files changed, 758 insertions(+), 140 deletions(-) diff --git a/src/secfoo/web/architecture_dashboard.py b/src/secfoo/web/architecture_dashboard.py index beef0e8f..fc8a63bd 100644 --- a/src/secfoo/web/architecture_dashboard.py +++ b/src/secfoo/web/architecture_dashboard.py @@ -173,8 +173,8 @@ def build(repo: RunRepository) -> ArchitectureDashboard: ) dash.uncovered_ccm_domains = [name for code, name in CCM_DOMAINS if not ccm_assessed[code]] - dash.root_causes = root_cause_counter.most_common(8) - dash.top_standards = standards_counter.most_common(5) + dash.root_causes = root_cause_counter.most_common() + dash.top_standards = standards_counter.most_common() dash.gate_mix = { "approve": gate_counter.get("approve", 0), "conditions": gate_counter.get("conditions", 0), diff --git a/src/secfoo/web/sast_dashboard.py b/src/secfoo/web/sast_dashboard.py index f0edea04..294336e6 100644 --- a/src/secfoo/web/sast_dashboard.py +++ b/src/secfoo/web/sast_dashboard.py @@ -73,7 +73,7 @@ def build(repo: RunRepository) -> SastDashboard: exploitable_count += 1 dash.cvss_band_counts = {band: band_counter.get(band, 0) for band in _CVSS_BANDS} - dash.top_cwe_counts = cwe_counter.most_common(10) + dash.top_cwe_counts = cwe_counter.most_common() dash.funnel = { "findings": len(dash.open_findings), "exploitable": exploitable_count, diff --git a/src/secfoo/web/static/css/dashboard.css b/src/secfoo/web/static/css/dashboard.css index 4f9f5332..51ad39d9 100644 --- a/src/secfoo/web/static/css/dashboard.css +++ b/src/secfoo/web/static/css/dashboard.css @@ -210,8 +210,20 @@ tr.run-row:hover { background-color: var(--color-primary-50); } /* Widget info button (macro info_tip in _macros.html). */ .has-info { position: relative; } +/* Stat cards clip their accent stripe with overflow:hidden. An open info + panel has to escape that clip, and sit above the next card. */ +.stat-card.has-info { overflow: visible; } +.stat-card.has-info:has(.info-tip[open]), +.card.has-info:has(.info-tip[open]) { z-index: 6; } +/* A stat card that is also a link: the hit target sits under the text so + the info button (higher z-index) still receives the click. */ +.stat-card__cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; } +.stat-card:has(.stat-card__cover) .stat-card__value, +.stat-card:has(.stat-card__cover) .stat-card__label, +.stat-card:has(.stat-card__cover) .stat-card__icon { position: relative; z-index: 2; pointer-events: none; } .has-info > .card__title, -.has-info > .stat-card__label { padding-right: 2rem; } +.has-info > .stat-card__label, +.has-info > .u-d-flex { padding-right: 2rem; } .info-tip { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 5; } .info-tip--inline { position: relative; top: auto; right: auto; } /* A heading followed by its info button: the button sits right after the @@ -245,12 +257,156 @@ tr.run-row:hover { background-color: var(--color-primary-50); } .info-tip__panel p { margin: 0 0 var(--space-2); } .info-tip__panel p:last-child { margin-bottom: 0; } -/* Threat modeling: model depth breakdown and STRIDE legend. */ -.depth-mix { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); } -.depth-mix__item { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: center; gap: var(--space-3); } -.depth-mix__count { font-size: 1.75rem; font-weight: 700; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; } -.depth-mix__item .ds-caption { display: block; line-height: 1.4; } -.depth-mix__name { font-weight: 600; display: block; } +/* Lists and tables marked data-scroll-rows: interactive.js sizes the box + to that many rows. Overflow only appears once there are more. */ +.widget-scroll { overflow-y: auto; overscroll-behavior: contain; } +.widget-scroll thead th { position: sticky; top: 0; z-index: 1; } + +/* Threat modeling: rework list, pattern bars, model-depth mix, STRIDE legend. + These sit in half- and third-width cards, so labels stack above their + bars instead of sharing a row with a fixed-width column. */ +.tm-accent { border-top: 3px solid var(--color-primary-600); } +.tm-accent--amber { border-top-color: var(--color-warning); } +.tm-accent--teal { border-top-color: var(--color-teal-500); } +.tm-accent--error { border-top-color: var(--color-error); } +.tm-panel__title { font: var(--text-h4); letter-spacing: -0.01em; margin-bottom: var(--space-4); width: 100%; } +.tm-panel__count { + margin-left: auto; + min-width: 1.5rem; height: 1.5rem; padding-inline: 0.45rem; + display: inline-flex; align-items: center; justify-content: center; + border-radius: var(--radius-pill); + background: var(--color-primary-50); color: var(--color-primary-700); + font: var(--text-caption); font-weight: 700; font-variant-numeric: tabular-nums; +} +.tm-accent--amber .tm-panel__count { background: var(--color-warning-bg); color: var(--color-warning); } +.tm-accent--teal .tm-panel__count { background: var(--color-teal-100); color: var(--color-teal-700); } + +.rework-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); } +.rework-row { + display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3); + padding: var(--space-3); + border: 1px solid var(--color-border); border-radius: var(--radius-md); + background: var(--color-surface); + text-decoration: none; color: inherit; + transition: border-color var(--duration-base) var(--ease-standard), + background-color var(--duration-base) var(--ease-standard), + box-shadow var(--duration-base) var(--ease-standard); +} +.rework-row:hover { border-color: var(--color-primary-300); background: var(--color-primary-50); box-shadow: var(--shadow-sm); } +.rework-row:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; } +.rework-row__mark { + width: 2.25rem; height: 2.25rem; border-radius: var(--radius-md); + display: grid; place-items: center; + font-weight: 700; font-size: 0.875rem; +} +.rework-row--never .rework-row__mark { background: var(--color-error-bg); color: var(--color-error); } +.rework-row--stale .rework-row__mark { background: var(--color-warning-bg); color: var(--color-warning); } +.rework-row__body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); min-width: 0; } +.rework-row__name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; } +.rework-row__when { font: var(--text-caption); color: var(--color-text-muted); white-space: nowrap; } +.rework-row__chevron { + width: 0.4rem; height: 0.4rem; margin-right: 0.15rem; + border-right: 2px solid var(--color-gray-400); border-top: 2px solid var(--color-gray-400); + transform: rotate(45deg); +} +[data-theme="dark"] .rework-row:hover { background: #0f3a4c; border-color: var(--color-primary-400); } +[data-theme="dark"] .tm-panel__count { background: #0f3a4c; color: var(--color-primary-200); } +[data-theme="dark"] .tm-accent--amber .tm-panel__count { background: var(--color-warning-bg); color: var(--color-warning); } +[data-theme="dark"] .tm-accent--teal .tm-panel__count { background: #0d3d3a; color: var(--color-teal-300); } + +.pattern-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); } +.pattern-row { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); align-items: center; gap: var(--space-3); } +.pattern-row__rank { + width: 1.75rem; height: 1.75rem; border-radius: var(--radius-circle); + display: grid; place-items: center; + background: var(--color-bg-subtle); color: var(--color-text-muted); + font-size: 0.6875rem; font-weight: 700; font-variant-numeric: tabular-nums; +} +.pattern-row--top .pattern-row__rank { background: var(--color-teal-100); color: var(--color-teal-700); } +.pattern-row__body { min-width: 0; } +.pattern-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); } +.pattern-row__label { min-width: 0; font: var(--text-body-sm); font-weight: 600; color: var(--color-text); overflow-wrap: anywhere; } +.pattern-row__count { + flex-shrink: 0; min-width: 1.5rem; padding: 0 0.4rem; + border-radius: var(--radius-pill); background: var(--color-bg-subtle); + text-align: center; font: var(--text-caption); font-weight: 700; font-variant-numeric: tabular-nums; +} +.pattern-row--top .pattern-row__count { background: var(--color-teal-100); color: var(--color-teal-700); } +.pattern-row__track { + margin-top: var(--space-2); height: 0.5rem; border-radius: var(--radius-pill); + background: var(--color-gray-100); overflow: hidden; +} +.pattern-row__fill { + height: 100%; width: 0; border-radius: inherit; + background: linear-gradient(90deg, var(--color-teal-300), var(--color-teal-500)); +} +.pattern-row--top .pattern-row__fill { background: linear-gradient(90deg, var(--color-teal-500), var(--color-teal-700)); } +[data-theme="dark"] .pattern-row__track { background: var(--color-gray-900); } +[data-theme="dark"] .pattern-row__rank, +[data-theme="dark"] .pattern-row__count { background: var(--color-gray-900); color: var(--color-gray-300); } +[data-theme="dark"] .pattern-row--top .pattern-row__rank, +[data-theme="dark"] .pattern-row--top .pattern-row__count { background: #0d3d3a; color: var(--color-teal-300); } + +.depth-mix-bar { margin-top: var(--space-4); height: 0.55rem; gap: 3px; background: transparent; } +.depth-mix-bar .stacked-bar__segment { border-radius: var(--radius-pill); } +.depth-mix { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-2); } +.depth-mix__item { + display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); + padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid transparent; +} +.depth-mix__item--full { background: var(--color-success-bg); } +.depth-mix__item--feature { background: var(--color-info-bg); } +.depth-mix__item--light { background: var(--color-warning-bg); } +.depth-mix__swatch { width: 0.625rem; height: 0.625rem; border-radius: var(--radius-circle); } +.depth-mix__name { display: block; font-weight: 600; font-size: 0.875rem; line-height: 1.3; } +.depth-mix__item .ds-caption { display: block; line-height: 1.35; } +.depth-mix__figure { display: flex; flex-direction: column; align-items: flex-end; gap: 0.125rem; } +.depth-mix__count { font-size: 1.125rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } +.depth-mix__pct { font: var(--text-caption); color: var(--color-text-muted); font-variant-numeric: tabular-nums; } +.depth-mix__fill--full { background-color: var(--color-success); } +.depth-mix__fill--feature { background-color: var(--color-primary-400); } +.depth-mix__fill--light { background-color: var(--color-warning); } +.depth-mix__hint { + margin: var(--space-4) 0 0; padding: var(--space-3); + border-radius: var(--radius-md); background: var(--color-warning-bg); + font: var(--text-caption); line-height: 1.45; color: var(--color-warning); +} + +.miss-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-4); } +.miss-stat { padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-error-bg); } +.miss-stat--quiet { background: var(--color-bg-subtle); } +.miss-stat__value { display: block; font-size: 1.375rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } +.miss-stat__label { display: block; margin-top: var(--space-1); font: var(--text-caption); color: var(--color-text-muted); } +.miss-list, .assume-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); } +.assume-list { margin-top: var(--space-4); } +.miss-row, .assume-row { + display: grid; gap: var(--space-3); align-items: flex-start; + padding: var(--space-3); border-radius: var(--radius-md); +} +.miss-row { + grid-template-columns: auto minmax(0, 1fr); + background: var(--color-bg-subtle); text-decoration: none; color: inherit; + transition: background-color var(--duration-base) var(--ease-standard); +} +.miss-row:hover { background: var(--color-error-bg); } +.miss-row:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; } +.miss-row__mark { + width: 2rem; height: 2rem; border-radius: var(--radius-md); background: var(--color-error-bg); + display: grid; place-items: center; flex-shrink: 0; +} +.miss-row__mark::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--color-error); } +.miss-row:hover .miss-row__mark { background: var(--color-surface); } +.miss-row__title, .assume-row__text { display: block; font: var(--text-body-sm); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; } +.miss-row__meta { display: block; margin-top: 0.15rem; font: var(--text-caption); color: var(--color-text-muted); } +.assume-row { grid-template-columns: auto minmax(0, 1fr); background: var(--color-warning-bg); } +.assume-row__mark { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; line-height: 1; font-weight: 700; color: var(--color-warning); } +.assume-row__text { font-weight: 500; padding-top: 0.15rem; } +.signal-empty { + margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--radius-md); + background: var(--color-bg-subtle); font: var(--text-body-sm); color: var(--color-text-muted); +} +[data-theme="dark"] .miss-row:hover { background: #3d1a18; } +[data-theme="dark"] .miss-row:hover .miss-row__mark { background: var(--color-gray-800); } .stride-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin-top: var(--space-3); } .stride-legend abbr { text-decoration: none; font-weight: 600; } .stride-key { display: inline-flex; align-items: center; gap: var(--space-1); } diff --git a/src/secfoo/web/static/js/interactive.js b/src/secfoo/web/static/js/interactive.js index 4907d240..6ef36de2 100644 --- a/src/secfoo/web/static/js/interactive.js +++ b/src/secfoo/web/static/js/interactive.js @@ -139,3 +139,50 @@ document.addEventListener("keydown", function (event) { }); }); +// data-scroll-rows="10" on a list or a .table-wrap: show that many rows, +// then scroll. Measured from the rows themselves so wrapped text still +// counts as one row. ResizeObserver remeasures when the card gets narrower. +(function () { + const widgets = document.querySelectorAll("[data-scroll-rows]"); + if (!widgets.length) return; + + function rowsOf(el) { + const body = el.querySelector(":scope > table > tbody"); + return body ? [...body.children] : [...el.children]; + } + + function cap(el) { + const limit = parseInt(el.getAttribute("data-scroll-rows"), 10); + const rows = rowsOf(el); + if (!isFinite(limit) || limit < 1 || rows.length <= limit) { + if (el.style.maxHeight) el.style.maxHeight = ""; + return; + } + const style = getComputedStyle(el); + const extra = (parseFloat(style.paddingBottom) || 0) + (parseFloat(style.borderBottomWidth) || 0); + const height = Math.ceil( + rows[limit - 1].getBoundingClientRect().bottom - el.getBoundingClientRect().top + el.scrollTop + extra + ); + const next = height + "px"; + if (el.style.maxHeight !== next) el.style.maxHeight = next; + } + + function capAll() { + widgets.forEach(cap); + } + + capAll(); + if (typeof ResizeObserver === "undefined") { + window.addEventListener("resize", capAll); + return; + } + let framing = false; + const observer = new ResizeObserver(function () { + if (framing) return; + framing = true; + capAll(); + framing = false; + }); + widgets.forEach(function (el) { observer.observe(el); }); +})(); + diff --git a/src/secfoo/web/templates/activities/architecture_dashboard.html b/src/secfoo/web/templates/activities/architecture_dashboard.html index e50dc9d1..c8e37747 100644 --- a/src/secfoo/web/templates/activities/architecture_dashboard.html +++ b/src/secfoo/web/templates/activities/architecture_dashboard.html @@ -3,37 +3,64 @@ recurring root causes, gate decisions, and standards deviation. See web/architecture_dashboard.py for what's real vs. approximated. #} +{% from "_macros.html" import info_tip %} + Program dashboard
-
+
+ {% call info_tip("Coverage") %} +

Share of in-scope systems that have at least one successful architecture review.

+

In scope means every project that has an assessment.

+ {% endcall %} {{ dash.coverage_pct }}% Coverage — {{ dash.coverage_reviewed }} / {{ dash.coverage_in_scope }} in-scope systems
-
+
+ {% call info_tip("Exceptions past expiry") %} +

Active exceptions whose expiry date has already passed.

+

Close the exception, or record a new one with a later date, to take it off this count.

+ {% endcall %} {{ dash.exceptions_past_expiry }} Exceptions past expiry
-
+
+ {% call info_tip("Open findings past due") %} +

Findings a review left as Confirmed where that review is more than {{ past_due_sla_days }} days old.

+

Findings have no individual due dates, so the review's age stands in for one.

+ {% endcall %} {{ dash.open_findings_past_due }} Open findings past due (>{{ past_due_sla_days }}d)
-
+
+ {% call info_tip("Unverified mitigations") %} +

Findings the review marked Conditional: a fix was proposed, but not confirmed in the code.

+

Confirm the mitigation in the next review to move them off this count.

+ {% endcall %} {{ dash.unverified_mitigations }} Unverified mitigations
-
+
+ {% call info_tip("Cycle time p90") %} +

How many days nine out of ten assessments take, from start to completion.

+

One in ten takes longer than this number. A dash means no completed assessment has a duration yet.

+ {% endcall %} {{ dash.cycle_time_p90_days if dash.cycle_time_p90_days is not none else "—" }} Cycle time p90 (days)
-
+
+ {% call info_tip("CCM domain conformance") %} +

Average score per Cloud Controls Matrix domain, taken from each project's latest review.

+

Hatched bars were not assessed (process-assured or not applicable). That is not a failing score.

+ {% endcall %}

CCM domain conformance

Hatched = not assessed by review (process-assured or not applicable), not a failing score.

+
{% for row in dash.ccm_rows %}
{{ row.name }} @@ -47,10 +74,15 @@

CCM domain conformance

{{ row.code }} — {% if row.hatched %}not assessed{% else %}{{ row.score }}%{% endif %}
{% endfor %} +
-
+
+ {% call info_tip("Risk disposition") %} +

What happened to findings across the latest reviews.

+

Remediated is the drop in finding count between a project's last two reviews. Mitigated is a Conditional verdict. Accepted is an active recorded exception. Open is Confirmed and not yet past due. Past due is Confirmed on a review older than {{ past_due_sla_days }} days.

+ {% endcall %}

Risk disposition

{% if dash.disposition_total %}
@@ -73,7 +105,11 @@

Risk disposition

-
+
+ {% call info_tip("Exception aging") %} +

Active exceptions grouped by how soon they expire.

+

Past expiry is already overdue. The other three buckets are still inside 30, 60, and 90 days.

+ {% endcall %}

Exception aging

@@ -91,13 +127,18 @@

Exception aging

-

Unreviewed & stale

+

Unreviewed & stale + {% call info_tip("Unreviewed & stale", inline=True) %} +

In-scope projects whose architecture review is missing, stale (latest successful review is over a year old), or whose trust boundaries changed.

+

The table shows the most recently active of these. The rest are in By project below.

+ {% endcall %} +

{% if dash.stale_projects | length > dash.recent_stale_projects | length %} Latest {{ dash.recent_stale_projects | length }} of {{ dash.stale_projects | length }} · all in By project {% endif %}
{% if dash.stale_projects %} -
+

@@ -121,9 +162,15 @@

Unreviewed & stale

-

Top recurring root causes

+

Top recurring root causes + {% call info_tip("Top recurring root causes", inline=True) %} +

The most common root causes cited across architecture reviews, including older ones.

+

A cause that keeps coming back is best fixed once, at platform level, rather than project by project.

+ {% endcall %} +

{% if dash.root_causes %}
+
{% for cause, count in dash.root_causes %}
@@ -132,6 +179,7 @@

Top recurring root causes

{{ count }}
{% endfor %} +
{% else %}
No findings yet to aggregate.
@@ -140,7 +188,11 @@

Top recurring root causes

-
+
+ {% call info_tip("Gate decision mix") %} +

How each project's latest review was gated, from the design verdict in the report.

+

Approve is a sound design. With conditions can proceed once named fixes land. Reject should not proceed as designed.

+ {% endcall %}

Gate decision mix

@@ -154,9 +206,14 @@

Gate decision mix

-
+
+ {% call info_tip("Most-deviated standards") %} +

Standards the reviews cite most often as not being met.

+

A standard high on this list is a candidate for a shared control, rather than a one-off fix in each project.

+ {% endcall %}

Most-deviated standards

{% if dash.top_standards %} +
{% for standard, count in dash.top_standards %}
@@ -165,16 +222,21 @@

Most-deviated standards

{{ count }}
{% endfor %} +
{% else %}

No standard-specific findings cited yet.

{% endif %}
-
+
+ {% call info_tip("Uncovered CCM domains") %} +

Cloud Controls Matrix domains that no architecture review has assessed yet.

+

A domain listed here has no score. That is not the same as failing it.

+ {% endcall %}

Uncovered CCM domains

{{ dash.uncovered_ccm_domains | length }} / 17 {% if dash.uncovered_ccm_domains %} -
    +
      {% for name in dash.uncovered_ccm_domains %}
    • {{ name }}
    • {% endfor %} diff --git a/src/secfoo/web/templates/activities/detail.html b/src/secfoo/web/templates/activities/detail.html index 31493b21..3694b8f0 100644 --- a/src/secfoo/web/templates/activities/detail.html +++ b/src/secfoo/web/templates/activities/detail.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% from "_macros.html" import findings_badges, empty_state %} +{% from "_macros.html" import findings_badges, empty_state, info_tip %} {% set verdict_projects = projects | selectattr("design_verdict") | list %} {% block title %}{{ skill.nav_label }} — secfoo{% endblock %} {% block content %} @@ -39,28 +39,52 @@ and trust-boundary counts with more specific tiles -- this generic block would just duplicate them. #}
      -
      +
      + {% call info_tip("Projects covered") %} +

      Projects with at least one run of this activity.

      +

      A project with only a failed run is still listed. Coverage on the program dashboards counts successful reviews only.

      + {% endcall %} {{ projects | length }} Projects covered
      -
      +
      + {% call info_tip("Runs") %} +

      How many times this activity has been run, across those projects.

      +

      Repeats count. This is not the number of projects.

      + {% endcall %} {{ run_count }} Runs
      -
      +
      + {% call info_tip("Total findings") %} +

      Finding counts written on this activity's runs, added together.

      +

      Repeat runs count again, so this can be higher than the open findings you would fix today.

      + {% endcall %} {{ severity.total }} Total findings
      -
      +
      + {% call info_tip("Critical + High") %} +

      The critical and high counts from those same runs, added together.

      +

      Medium, low, and info findings are in Total findings and not in this number.

      + {% endcall %} {{ severity.critical + severity.high }} Critical + High
      {% if verdict_projects %} -
      +
      + {% call info_tip("Projects not cleanly Sound") %} +

      Projects whose latest design verdict is anything other than Sound.

      +

      The first number is those projects. The second is every project that has a verdict.

      + {% endcall %} {{ verdict_projects | rejectattr("verdict_label", "equalto", "Sound") | list | length }}/{{ verdict_projects | length }} Projects not cleanly Sound
      -
      +
      + {% call info_tip("Trust boundaries identified") %} +

      Trust boundaries called out in the latest review of each project, added together.

      +

      A boundary is a place data crosses from one trust level to another, such as from the internet into an API.

      + {% endcall %} {{ projects | sum(attribute="boundary_count") }} Trust boundaries identified
      @@ -69,14 +93,18 @@ {% endif %} {% if recent_verdicts %} -
      +
      + {% call info_tip("Design verdicts") %} +

      The design verdict from each project's latest successful review, and the reason the report gave.

      +

      Open a row to read the full review. Only the latest verdict per project is shown.

      + {% endcall %}

      Design verdicts

      {% if verdict_count > recent_verdicts | length %}Latest {{ recent_verdicts | length }} of {{ verdict_count }} projects{% else %}Latest review per project{% endif %}
      -
      +
ProjectStateLast reviewed
@@ -101,7 +129,11 @@

Design verdicts

already have their own severity/disposition breakdowns -- a raw severity-count bar here would just be a second, less specific cut of the same findings. #} -
+
+ {% call info_tip("Findings by severity") %} +

Severity counts written on this activity's runs.

+

Repeat runs count again. A project scanned twice contributes both scans.

+ {% endcall %}

Findings by severity

{% for row in severity_rows %}
@@ -157,7 +189,7 @@

Architecture diagram

By project

{% if projects %} -
+
ProjectVerdictWhyReviewed
diff --git a/src/secfoo/web/templates/activities/sast_dashboard.html b/src/secfoo/web/templates/activities/sast_dashboard.html index 0de231f7..f15215c8 100644 --- a/src/secfoo/web/templates/activities/sast_dashboard.html +++ b/src/secfoo/web/templates/activities/sast_dashboard.html @@ -6,33 +6,60 @@ of report text re-parsed on every request. See web/sast_dashboard.py's module docstring for why. #} +{% from "_macros.html" import info_tip %} + Program dashboard
-
+
+ {% call info_tip("Open findings") %} +

SAST findings still open in the register.

+

A finding stays open until a later scan no longer reports it, or a reviewer closes it.

+ {% endcall %} {{ sast_dash.funnel.findings }} Open findings
-
+
+ {% call info_tip("Exploitable") %} +

Open findings the scan did not mark Latent.

+

Latent means the vulnerable code is present but not reachable in the current build.

+ {% endcall %} {{ sast_dash.funnel.exploitable }} Exploitable (not Latent)
-
+
+ {% call info_tip("Verified") %} +

Open findings with a Confirmed verdict.

+

The scan checked the code and believes the issue is real, not just a pattern match.

+ {% endcall %} {{ sast_dash.funnel.verified }} Verified (Confirmed verdict)
-
+
+ {% call info_tip("Severe") %} +

Open findings whose CVSS v3.1 score is High or Critical (7.0 or above).

+

secfoo computes the score from the finding's own vector. The model does not pick the band.

+ {% endcall %} {{ sast_dash.funnel.severe }} Severe (CVSS High/Critical)
- +
-
+
+ {% call info_tip("CVSS severity") %} +

Open findings banded by the CVSS v3.1 score secfoo computes from each finding's vector.

+

None means the finding had no vector, so no score could be computed.

+ {% endcall %}

CVSS severity

Computed by secfoo from each finding's own CVSS v3.1 vector -- never asserted directly by the model. @@ -51,12 +78,17 @@

CVSS severity

-
+
+ {% call info_tip("Top vulnerability types") %} +

Open findings grouped by CWE, the weakness type.

+

Findings without a specific CWE ("unverified") are left out of this breakdown.

+ {% endcall %}

Top vulnerability types

Open findings by CWE. Findings without a specific CWE ("unverified") are excluded from this breakdown.

{% if sast_dash.top_cwe_counts %} +
{% for cwe, count in sast_dash.top_cwe_counts %}
@@ -65,6 +97,7 @@

Top vulnerability types

{{ count }}
{% endfor %} +
{% else %}

No findings with a specific CWE yet.

{% endif %} @@ -74,7 +107,12 @@

Top vulnerability types

{% set top_findings = sast_dash.open_findings[:5] %}
-

Top findings

+

Top findings + {% call info_tip("Top findings", inline=True) %} +

The five highest-CVSS open findings across every project.

+

The full register, including closed findings and filters, is on the findings page.

+ {% endcall %} +

The highest-CVSS open findings across all projects.

View all findings ({{ sast_dash.open_findings | length }} open, {{ sast_dash.closed_findings | length }} closed) → diff --git a/src/secfoo/web/templates/activities/sca_dashboard.html b/src/secfoo/web/templates/activities/sca_dashboard.html index 532313bb..0b96b555 100644 --- a/src/secfoo/web/templates/activities/sca_dashboard.html +++ b/src/secfoo/web/templates/activities/sca_dashboard.html @@ -7,6 +7,8 @@ doesn't (never a fabricated CVE ID -- see web/sca_dashboard.py for what's real vs. approximated). #} +{% from "_macros.html" import info_tip %} + Program dashboard {% if sca_dash.osv_unreachable %} @@ -16,26 +18,46 @@ {% endif %}
-
+
+ {% call info_tip("Coverage") %} +

Share of in-scope systems that have at least one successful SCA reachability review.

+

In scope means every project that has an assessment.

+ {% endcall %} {{ sca_dash.coverage_pct }}% Coverage — {{ sca_dash.coverage_reviewed }} / {{ sca_dash.coverage_in_scope }} in-scope systems
-
+
+ {% call info_tip("Distinct vulnerabilities") %} +

Unique package vulnerabilities across projects. The same package and CVE in two projects counts once.

+

A finding with no real CVE stays separate unless the issue text actually matches another one. secfoo never invents a CVE id.

+ {% endcall %} {{ sca_dash.vulnerabilities | length }} Distinct vulnerabilities across all projects
-
+
+ {% call info_tip("Reachable") %} +

Vulnerabilities a review marked reachable: the vulnerable code is on a path the application can actually hit.

+

Not reachable and conditionally reachable are counted separately, on each vulnerability's row.

+ {% endcall %} {{ sca_dash.reachability_counts.reachable }} Reachable
-
+
+ {% call info_tip("Unrecognized ecosystem") %} +

Findings whose package ecosystem OSV.dev does not recognize, so they could not be checked against a known advisory.

+

They stay in the register as the report wrote them. They are not dropped.

+ {% endcall %} {{ sca_dash.unmapped_ecosystem_count }} Findings with an ecosystem OSV.dev doesn't recognize
-
+
+ {% call info_tip("Severity") %} +

Counts from each finding's own Risk Register severity.

+

This is the rating the review wrote. It is not translated from a CVSS score.

+ {% endcall %}

Severity

From each finding's own Risk Register severity -- never translated from a CVSS score. @@ -53,12 +75,17 @@

Severity

-
+
+ {% call info_tip("Vulnerabilities by ecosystem") %} +

How the vulnerabilities above split by package ecosystem, such as npm or PyPI.

+

This is not a count of every dependency in every manifest. Only findings are included.

+ {% endcall %}

Vulnerabilities by ecosystem

A breakdown of the findings above, not of every dependency in every manifest.

{% if sca_dash.ecosystem_counts %} +
{% for ecosystem, count in sca_dash.ecosystem_counts %}
@@ -67,6 +94,7 @@

Vulnerabilities by ecosystem

{{ count }}
{% endfor %} +
{% else %}

No vulnerabilities yet.

{% endif %} @@ -76,7 +104,12 @@

Vulnerabilities by ecosystem

{% set top_vulnerabilities = sca_dash.vulnerabilities[:5] %}
-

Top vulnerabilities

+

Top vulnerabilities + {% call info_tip("Top vulnerabilities", inline=True) %} +

The five highest-severity vulnerabilities across projects.

+

Reachability and a fixed version, when the report or OSV.dev has one, are on each row.

+ {% endcall %} +

The highest-severity vulnerabilities across all projects.

View all vulnerabilities ({{ sca_dash.vulnerabilities | length }}) → diff --git a/src/secfoo/web/templates/activities/secret_scanning_dashboard.html b/src/secfoo/web/templates/activities/secret_scanning_dashboard.html index a6bcf937..7e4630d0 100644 --- a/src/secfoo/web/templates/activities/secret_scanning_dashboard.html +++ b/src/secfoo/web/templates/activities/secret_scanning_dashboard.html @@ -2,29 +2,51 @@ source breakdown, and a "Top findings" preview linking to the full register at /activities/secret-scanning/findings. #} +{% from "_macros.html" import info_tip %} + Program dashboard
-
+
+ {% call info_tip("Secrets found") %} +

Secrets reported in each project's latest successful secret scan.

+

The same secret found again on a later scan of that project is not counted twice here.

+ {% endcall %} {{ secret_dash.total }} Secrets found
-
+
+ {% call info_tip("Looks live") %} +

Secrets the scan judged still valid.

+

Rotate these before anything else. A secret that only looks leaked, but not live, is less urgent.

+ {% endcall %} {{ secret_dash.looks_live_count }} Looks live — rotate now
-
+
+ {% call info_tip("Found in documentation") %} +

Secrets found in docs, READMEs, or other written material rather than in source.

+

They are easy to publish by accident, and they are not covered by a code-only review.

+ {% endcall %} {{ secret_dash.docs_count }} Found in documentation
-
+
+ {% call info_tip("Version-control history only") %} +

Secrets that appear only in version-control history, not in the current tree.

+

They can still be cloned from the past. Removing the file from the latest commit does not remove them.

+ {% endcall %} {{ secret_dash.history_count }} Version-control history only
-
+
+ {% call info_tip("Severity") %} +

How the scan rated each secret: High, Medium, or Low.

+

This is separate from whether the secret still looks live. A high-severity secret can already be revoked.

+ {% endcall %}

Severity

{% set severity_total = secret_dash.severity_counts.high + secret_dash.severity_counts.medium + secret_dash.severity_counts.low %}
@@ -39,7 +61,11 @@

Severity

-
+
+ {% call info_tip("By source") %} +

Where each secret was found: current code, config, version-control history, or documentation.

+

Code and config are in the tree you ship. History and docs are easier to miss in a normal review.

+ {% endcall %}

By source

Where each secret was found.

{% for key, label in [("code", "Code"), ("config", "Config"), ("history", "Version-control history"), ("docs", "Documentation")] %} @@ -56,7 +82,12 @@

By source

{% set top_findings = secret_dash.findings[:5] %}
-

Top findings

+

Top findings + {% call info_tip("Top findings", inline=True) %} +

The five highest-severity secrets across projects.

+

Validity says whether the secret still looks live. The full register is on the findings page.

+ {% endcall %} +

The highest-severity secrets found across all projects.

View all findings ({{ secret_dash.total }}) → diff --git a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html index 02b176bf..77eca1d8 100644 --- a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html +++ b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html @@ -8,7 +8,7 @@ {% from "_macros.html" import info_tip %} {% macro stride_table(matrix) %} -
+
@@ -101,7 +101,7 @@

STRIDE × asset-class coverage

By project — a blank cell here is a real gap on that specific system; the total above can't say which project it came from.

-
+
{% for entry in tm_dash.stride_by_project %}
{{ entry.project_display_name }} ({{ entry.threat_count }} threat{{ "s" if entry.threat_count != 1 else "" }}) @@ -153,7 +153,7 @@

Accepted threats

Every threat marked Accepted, reconciled with who actually signed off — secfoo accept create is how "not recorded" turns into a real name.

{% if tm_dash.accepted_threats %} -
+
@@ -177,56 +177,63 @@

Accepted threats

-
-
-

Models needing rework +
+
+

Models needing rework {% call info_tip("Models needing rework", inline=True) %}

In-scope projects whose threat model is missing, stale (latest successful model is over a year old), or whose trust boundaries changed between the last two models.

Sorted by open findings, as a stand-in for how critical the system is.

{% endcall %} + {% if tm_dash.needs_rework %}{{ tm_dash.needs_rework | length }}{% endif %}

{% if tm_dash.needs_rework %} -
-

ThreatProjectAccepted by
- - - {% for p in tm_dash.needs_rework %} - - - - - - {% endfor %} - -
ProjectStateLast modeled
{{ p.project_display_name }} - {% if p.state == "never_reviewed" %}Never modeled - {% elif p.state == "boundary_changed" %}Trust boundary changed - {% else %}Stale ({{ p.days_since_review }}d){% endif %} - {{ (p.last_reviewed_at | fmt_time) if p.last_reviewed_at else "Never" }}
-
+ {% else %}
Nothing needs rework — every in-scope project has a current model.
{% endif %}
-
-

Recurring threat patterns +
+

Recurring threat patterns {% call info_tip("Recurring threat patterns", inline=True) %}

The most common kinds of threat across every successful threat model, including older ones.

A pattern that keeps coming back is best fixed once, at platform level (a shared control or library), rather than project by project.

{% endcall %} + {% if tm_dash.recurring_patterns %}{{ tm_dash.recurring_patterns | length }}{% endif %}

{% if tm_dash.recurring_patterns %} -
+
    {% for archetype, count in tm_dash.recurring_patterns %} -
    - - {{ archetype }} -
    - {{ count }} -
    +
  • + +
    +
    + {{ archetype }} + {{ count }} +
    +
    +
    +
    +
    +
  • {% endfor %} -
+ {% else %}
No threats yet to aggregate.
{% endif %} @@ -234,59 +241,100 @@

Recurring threat patterns

-
+
{% call info_tip("Model depth mix") %}

How thorough each project's latest threat model was, as the model declares about itself.

Full covers the whole system. Feature-level covers one feature or new data flow. Lightweight is a fast checklist pass.

Lightweight models miss more. Critical systems should have a Full model; a mostly-lightweight portfolio means coverage looks better than it is.

{% endcall %}

Model depth mix

- {% set depth_total = tm_dash.model_depth_mix.full + tm_dash.model_depth_mix.feature_level + tm_dash.model_depth_mix.lightweight %} + {% set full_n = tm_dash.model_depth_mix.full %} + {% set feature_n = tm_dash.model_depth_mix.feature_level %} + {% set light_n = tm_dash.model_depth_mix.lightweight %} + {% set depth_total = full_n + feature_n + light_n %}

How deep each project's latest model went{% if depth_total %} ({{ depth_total }} model{{ "s" if depth_total != 1 else "" }}){% endif %}.

+ {% if depth_total %} + + {% endif %}
    -
  • {{ tm_dash.model_depth_mix.full }}FullWhole system: every component and trust boundary
  • -
  • {{ tm_dash.model_depth_mix.feature_level }}Feature-levelOne feature or new data flow
  • -
  • {{ tm_dash.model_depth_mix.lightweight }}LightweightFast checklist pass
  • +
  • + + FullWhole system: every component and trust boundary + {{ full_n }}{% if depth_total %}{{ (full_n / depth_total * 100) | round | int }}%{% endif %} +
  • +
  • + + Feature-levelOne feature or new data flow + {{ feature_n }}{% if depth_total %}{{ (feature_n / depth_total * 100) | round | int }}%{% endif %} +
  • +
  • + + LightweightFast checklist pass + {{ light_n }}{% if depth_total %}{{ (light_n / depth_total * 100) | round | int }}%{% endif %} +
- {% if tm_dash.model_depth_mix.lightweight > tm_dash.model_depth_mix.full %} -

More lightweight than full models: re-run critical systems at --depth standard.

+ {% if light_n > full_n %} +

More lightweight than full models: re-run critical systems at --depth standard.

{% endif %}
-
+
{% call info_tip("Threats found post-build") %}

Threats discovered after release (an incident, a pen test, a later scan) that an earlier model should have caught.

Recorded by hand with secfoo miss, since a model can't know what it missed. A rising count means models are too shallow.

{% endcall %}

Threats found post-build

- {{ tm_dash.post_build_count_recent }} - in the last 90 days ({{ tm_dash.post_build_count_total }} all-time) +
+
+ {{ tm_dash.post_build_count_recent }} + Last 90 days +
+
+ {{ tm_dash.post_build_count_total }} + All-time +
+
{% if tm_dash.post_build_recent %} -
-
+
{% call info_tip("Falsified assumptions") %}

Assumptions a model relied on (for example, "only internal traffic reaches this service") that it then checked against the code and found false.

Each one marks a place where the design and the real system disagree.

{% endcall %}

Falsified assumptions

- {{ tm_dash.falsified_assumptions | length }} +

{{ tm_dash.falsified_assumptions | length }} checked against the code and found false.

{% if tm_dash.falsified_assumptions %} -
    +
      {% for assumption in tm_dash.falsified_assumptions %} -
    • {{ assumption }}
    • +
    • + + {{ assumption }} +
    • {% endfor %}
    {% else %} -

    No falsified assumptions recorded yet.

    +

    No falsified assumptions recorded yet.

    {% endif %}
diff --git a/src/secfoo/web/templates/assessments/detail.html b/src/secfoo/web/templates/assessments/detail.html index 892e932c..60271cb6 100644 --- a/src/secfoo/web/templates/assessments/detail.html +++ b/src/secfoo/web/templates/assessments/detail.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% block title %}{{ assessment.project_display_name }} — secfoo{% endblock %} +{% from "_macros.html" import info_tip %} {% block content %} ← All assessments
@@ -65,7 +66,12 @@

Review pipeline

-

Findings by severity

+

Findings by severity + {% call info_tip("Findings by severity", inline=True) %} +

Severity counts from the runs attached to this assessment.

+

Repeat runs of the same activity count again, so this can be higher than the findings still open.

+ {% endcall %} +

{% for row in severity_rows %}
@@ -79,7 +85,7 @@

Findings by severity

Attached runs

{% if runs %} -
+
@@ -104,7 +110,7 @@

Attached runs

Attachments

AI-BOM: {{ models_count }} model(s), {{ tools_count }} tool(s) tracked.

{% if attachments %} -
+
StartedSkillAgentStatusCost
diff --git a/src/secfoo/web/templates/overview.html b/src/secfoo/web/templates/overview.html index 68e822fd..d7861aa8 100644 --- a/src/secfoo/web/templates/overview.html +++ b/src/secfoo/web/templates/overview.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% from "_macros.html" import findings_badges %} +{% from "_macros.html" import findings_badges, info_tip %} {% block title %}secfoo — Dashboard{% endblock %} {% block content %} {% from "_icons.html" import icon %} @@ -64,27 +64,49 @@

Four steps to your first signed-off review

{% endif %}
-
+
+ {% call info_tip("Applications reviewed") %} +

Every application recorded in this local store.

+

A project appears here once it has been added, including ones that have not finished a review.

+ {% endcall %} {{ icon("projects") }} {{ projects | length }} Applications reviewed
-
+
+ {% call info_tip("Total findings") %} +

Finding counts written on runs, added up across every activity.

+

Repeat scans count again. This is not the same as Top findings, which lists open Critical and High items only.

+ {% endcall %} {{ icon("findings") }} {{ severity.total }} Total findings
- + +
+ {% call info_tip("Responsible AI coverage") %} +

Assessments that have a Responsible AI risk rating.

+

The rating comes from an attached Responsible AI Compliance run. An assessment without that run is not counted.

+ {% endcall %} +
{{ icon("responsible-ai") }} {{ responsible_ai_count }} Responsible AI coverage - -
+
+
+ {% call info_tip("AI spend") %} +

Cost that metered agents have reported back to secfoo.

+

Subscription agents run on your own plan and do not report a price, so they are not in this total.

+ {% endcall %} {{ icon("spend") }} {{ total_cost | fmt_cost }} AI spend @@ -99,7 +121,7 @@

Top findings across the program

in a report can appear here as Critical.

{% if top_findings %} -
+
FileKindUploaded
@@ -122,7 +144,11 @@

Top findings across the program

{% endif %}
-
+
+ {% call info_tip("Findings by severity") %} +

Counts the severity written in each run's report, summed across all runs.

+

Repeat scans count again. It can differ from Top findings, which lists open, de-duplicated items scored by CVSS.

+ {% endcall %}

Findings by severity

Counts the severity written in each run's report, summed across all runs (repeat scans count again). @@ -138,10 +164,14 @@

Findings by severity

{% endfor %}
-
+
+ {% call info_tip("Activity coverage") %} +

How many applications have at least one successful run of each activity.

+

The total is every application in this store, including ones that have never been scanned with that activity.

+ {% endcall %}

Activity coverage

Projects with at least one successful run of each activity.

-
SeveritySourceFindingProjectDetail
@@ -186,6 +225,7 @@

AI spend by agent

{% endfor %}
AgentRunsTokensCost
+

Subscription agents run on your own plan and don't report their cost to secfoo.

{% else %}

No runs yet.

@@ -195,7 +235,7 @@

AI spend by agent

Recent runs

{% if recent_runs %} -
    +
      {% for r in recent_runs %} {% set blocked = r.status in ('binary_not_found', 'failed', 'timeout') %}
    • @@ -221,7 +261,7 @@

      Recent runs

      Agents

      All agents →
-