diff --git a/src/secfoo/web/architecture_dashboard.py b/src/secfoo/web/architecture_dashboard.py
index a79db3f3..7a6536fc 100644
--- a/src/secfoo/web/architecture_dashboard.py
+++ b/src/secfoo/web/architecture_dashboard.py
@@ -68,10 +68,18 @@ class ArchitectureDashboard:
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)
+ top_standards_preview: list[tuple[str, int]] = field(default_factory=list)
+ standards_total: int = 0
RECENT_STALE_LIMIT = 5
+# The card shows the top of the ranking. The page behind the click shows
+# more, but still only the head of the list — a long tail of one-off
+# citations is not useful here.
+STANDARDS_PREVIEW_LIMIT = 5
+STANDARDS_LIST_LIMIT = 15
+
def build(repo: RunRepository) -> ArchitectureDashboard:
dash = ArchitectureDashboard()
@@ -174,7 +182,10 @@ 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()
- dash.top_standards = standards_counter.most_common()
+ ranked_standards = standards_counter.most_common()
+ dash.standards_total = len(ranked_standards)
+ dash.top_standards = ranked_standards[:STANDARDS_LIST_LIMIT]
+ dash.top_standards_preview = ranked_standards[:STANDARDS_PREVIEW_LIMIT]
dash.gate_mix = {
"approve": gate_counter.get("approve", 0),
"conditions": gate_counter.get("conditions", 0),
diff --git a/src/secfoo/web/routes/activities.py b/src/secfoo/web/routes/activities.py
index 064ae355..8adc07fb 100644
--- a/src/secfoo/web/routes/activities.py
+++ b/src/secfoo/web/routes/activities.py
@@ -214,6 +214,23 @@ def activity_detail(
return templates.TemplateResponse(request, "activities/detail.html", context)
+@router.get("/activities/security-architecture-review/standards")
+def architecture_standards(request: Request):
+ """The longer most-deviated-standards ranking. Capped, so the page
+ stays a short list rather than every standard ever cited. The
+ dashboard card shows only the top five."""
+ with RunRepository() as repo:
+ dash = arch_dashboard.build(repo)
+ return templates.TemplateResponse(
+ request,
+ "activities/architecture_standards.html",
+ {
+ "standards": dash.top_standards,
+ "standards_total": dash.standards_total,
+ },
+ )
+
+
@router.get("/activities/threat-modeling/post-build")
def threat_modeling_post_build(request: Request):
"""Every threat recorded with `secfoo miss`. The dashboard card shows
@@ -225,6 +242,17 @@ def threat_modeling_post_build(request: Request):
)
+@router.get("/activities/threat-modeling/accepted")
+def threat_modeling_accepted(request: Request):
+ """Every accepted threat, newest first. The dashboard card shows
+ only the newest handful."""
+ with RunRepository() as repo:
+ threats = tm_dashboard.build(repo).accepted_threats
+ return templates.TemplateResponse(
+ request, "activities/threat_modeling_accepted.html", {"threats": threats}
+ )
+
+
@router.get("/activities/threat-modeling/assumptions")
def threat_modeling_assumptions(request: Request):
"""Every falsified assumption from the latest model of each project.
diff --git a/src/secfoo/web/templates/activities/architecture_dashboard.html b/src/secfoo/web/templates/activities/architecture_dashboard.html
index 49361e98..b203261c 100644
--- a/src/secfoo/web/templates/activities/architecture_dashboard.html
+++ b/src/secfoo/web/templates/activities/architecture_dashboard.html
@@ -210,19 +210,21 @@
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.
+ This card shows the top five. The longer ranking is one click away, and it stops at the top fifteen.
{% endcall %}
Most-deviated standards
- {% if dash.top_standards %}
-
+ {% if dash.standards_total > dash.top_standards_preview | length %}
+ {% if dash.standards_total > dash.top_standards | length %}View top {{ dash.top_standards | length }}{% else %}View all {{ dash.standards_total }}{% endif %} →
+ {% endif %}
{% else %}
No standard-specific findings cited yet.
{% endif %}
diff --git a/src/secfoo/web/templates/activities/architecture_standards.html b/src/secfoo/web/templates/activities/architecture_standards.html
new file mode 100644
index 00000000..6942aa67
--- /dev/null
+++ b/src/secfoo/web/templates/activities/architecture_standards.html
@@ -0,0 +1,30 @@
+{% extends "base.html" %}
+{% block title %}Most-deviated standards — secfoo{% endblock %}
+{% block content %}
+← Back to Security Architecture
+Security Architecture
+Most-deviated standards
+
+ Standards the reviews cite most often as not being met.
+ {% if standards_total > standards | length %}
+ Showing the top {{ standards | length }} of {{ standards_total }}.
+ {% elif standards %}
+ {{ standards | length }} standard{{ "s" if standards | length != 1 else "" }} cited.
+ {% endif %}
+
+
+{% if standards %}
+
+ {% for standard, count in standards %}
+
+
+
{{ standard }}
+
+
{{ count }}
+
+ {% endfor %}
+
+{% else %}
+No standard-specific findings cited yet.
+{% endif %}
+{% endblock %}
diff --git a/src/secfoo/web/templates/activities/threat_modeling_accepted.html b/src/secfoo/web/templates/activities/threat_modeling_accepted.html
new file mode 100644
index 00000000..0cca3ee9
--- /dev/null
+++ b/src/secfoo/web/templates/activities/threat_modeling_accepted.html
@@ -0,0 +1,35 @@
+{% extends "base.html" %}
+{% block title %}Accepted threats — secfoo{% endblock %}
+{% block content %}
+← Back to Threat Modeling
+Threat Modeling
+Accepted threats
+
+ Every threat marked Accepted, reconciled with who signed it off. Record an owner with secfoo accept create.
+
+
+{% if threats %}
+
+
+
+ | Threat | Project | Accepted by | When |
+
+
+ {% for item in threats %}
+
+ | {{ item.threat }} |
+ {{ item.project }} |
+
+ {% if item.accepted_by %}{{ item.accepted_by }}
+ {% else %}Not recorded{% endif %}
+ |
+ {{ item.accepted_at | fmt_ago }} |
+
+ {% endfor %}
+
+
+
+{% else %}
+No accepted threats yet. Record one with secfoo accept create.
+{% endif %}
+{% endblock %}
diff --git a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html
index f7edc4cf..fdefc43b 100644
--- a/src/secfoo/web/templates/activities/threat_modeling_dashboard.html
+++ b/src/secfoo/web/templates/activities/threat_modeling_dashboard.html
@@ -152,17 +152,18 @@ 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.
+ This card shows the newest ones. The full list is on its own page.
{% 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.
+ The newest threats marked Accepted, reconciled with who signed off. secfoo accept create is how "not recorded" turns into a real name.
- {% if tm_dash.accepted_threats %}
-
+ {% if tm_dash.accepted_preview %}
+
| Threat | Project | Accepted by |
- {% for item in tm_dash.accepted_threats %}
+ {% for item in tm_dash.accepted_preview %}
| {{ item.threat }} |
{{ item.project }} |
@@ -175,6 +176,9 @@ Accepted threats
+ {% if tm_dash.accepted_threats | length > tm_dash.accepted_preview | length %}
+
View all {{ tm_dash.accepted_threats | length }} →
+ {% endif %}
{% else %}
No accepted threats yet.
{% endif %}
diff --git a/src/secfoo/web/threat_modeling_dashboard.py b/src/secfoo/web/threat_modeling_dashboard.py
index 8945e318..de5475d3 100644
--- a/src/secfoo/web/threat_modeling_dashboard.py
+++ b/src/secfoo/web/threat_modeling_dashboard.py
@@ -28,9 +28,12 @@
SKILL_ID = "threat-modeling"
-# The post-build and falsified-assumption cards show only the newest
-# handful. The rest live on their own pages.
+# The post-build, falsified-assumption, and accepted-threat cards show
+# only the newest handful. The rest live on their own pages. The
+# accepted-threat preview is shorter because each row is a full table
+# row, and the whole list made that card too tall.
LIST_PREVIEW_LIMIT = 8
+ACCEPTED_PREVIEW_LIMIT = 5
# A Gap-disposition threat is "past due" once its most recent model is
# older than this -- the same coarse, run-level proxy used for the
@@ -79,6 +82,7 @@ class ThreatModelingDashboard:
disposition: dict[str, int] = field(default_factory=dict)
disposition_total: int = 0
accepted_threats: list[dict] = field(default_factory=list)
+ accepted_preview: list[dict] = field(default_factory=list)
needs_rework: list[dict] = field(default_factory=list)
recurring_patterns: list[tuple[str, int]] = field(default_factory=list)
model_depth_mix: dict[str, int] = field(default_factory=dict)
@@ -180,6 +184,9 @@ def build(repo: RunRepository) -> ThreatModelingDashboard:
"project": project["project_display_name"],
"threat_ref": row["id"],
"threat": row["threat"],
+ # No per-threat acceptance time exists on the report.
+ # The model's own start is the closest "when".
+ "modeled_at": started,
}
)
elif disposition == "transferred":
@@ -227,10 +234,14 @@ def build(repo: RunRepository) -> ThreatModelingDashboard:
matched_keys.add(key)
merged_accepted.append(
{
+ "project_id": entry["project_id"],
"project": entry["project"],
"threat_ref": entry["threat_ref"],
"threat": entry["threat"],
"accepted_by": record.accepted_by if record else None,
+ # A recorded sign-off has a real time. Otherwise fall back
+ # to when the model marked the threat Accepted.
+ "accepted_at": record.created_at if record else entry.get("modeled_at"),
}
)
# A recorded acceptance whose threat no longer shows up as "Accepted" in
@@ -243,13 +254,17 @@ def build(repo: RunRepository) -> ThreatModelingDashboard:
continue
merged_accepted.append(
{
+ "project_id": record.project_id,
"project": record.project_display_name,
"threat_ref": record.threat_ref,
"threat": record.title,
"accepted_by": record.accepted_by,
+ "accepted_at": record.created_at,
}
)
+ merged_accepted.sort(key=lambda entry: entry.get("accepted_at") or "", reverse=True)
dash.accepted_threats = merged_accepted
+ dash.accepted_preview = merged_accepted[:ACCEPTED_PREVIEW_LIMIT]
dash.model_depth_mix = {
"full": depth_counter.get("Full", 0),
diff --git a/tests/test_web/test_architecture_dashboard.py b/tests/test_web/test_architecture_dashboard.py
index ddd5c553..bf54c6a9 100644
--- a/tests/test_web/test_architecture_dashboard.py
+++ b/tests/test_web/test_architecture_dashboard.py
@@ -150,6 +150,38 @@ def test_dashboard_shows_standard_from_findings_register(client, tmp_path):
assert "ISO 27001 A.10" in resp.text
+def test_most_deviated_standards_shows_five_and_links_to_a_capped_list(client, tmp_path):
+ """The card keeps the top five. The page behind the click keeps going,
+ but only through the top fifteen."""
+ rows = []
+ row_id = 1
+ for n in range(1, 19):
+ for _ in range(19 - n):
+ rows.append(
+ f"| A{row_id} | Finding | High | Secrets Management | STD {n:02d} | Confirmed |"
+ )
+ row_id += 1
+ rows = "\n".join(rows)
+ report = ARCHITECTURE_REPORT.replace(
+ "| A1 | Hardcoded key | High | Secrets Management | ISO 27001 A.10 | Confirmed |\n"
+ "| A2 | Missing rate limit | Medium | Authorization | N/A | Conditional |",
+ rows,
+ )
+ _seed(tmp_path, report_text=report)
+
+ page = client.get("/activities/security-architecture-review").text
+ card = page[page.index(">Most-deviated standards"):page.index(">Uncovered CCM domains")]
+ assert "STD 01" in card and "STD 05" in card
+ assert "STD 06" not in card
+ assert "View top 15" in card
+
+ full = client.get("/activities/security-architecture-review/standards")
+ assert full.status_code == 200
+ assert "STD 15" in full.text
+ assert "STD 16" not in full.text
+ assert "Showing the top 15 of 18" in full.text
+
+
def test_dashboard_shows_exceptions_past_expiry(client, tmp_path):
project_id, _, _ = _seed(tmp_path)
repo = RunRepository()
diff --git a/tests/test_web/test_threat_modeling_dashboard.py b/tests/test_web/test_threat_modeling_dashboard.py
index 85535f9b..15043cde 100644
--- a/tests/test_web/test_threat_modeling_dashboard.py
+++ b/tests/test_web/test_threat_modeling_dashboard.py
@@ -370,6 +370,43 @@ def test_post_build_card_keeps_eight_and_links_to_the_rest(client, tmp_path):
assert "Miss 1" in full.text and "Miss 10" in full.text
+def test_accepted_threats_card_keeps_five_recent_and_links_to_the_rest(client, tmp_path):
+ """The card shows the five newest acceptances. Older ones stay off the
+ dashboard and are reachable from View all."""
+ project_id, _, _ = _seed(tmp_path)
+ repo = RunRepository()
+ for day in range(1, 8):
+ repo.create_threat_acceptance(
+ project_id=project_id,
+ threat_ref=f"T{100 + day}",
+ title=f"Accepted threat {day}",
+ justification="j",
+ accepted_by="Jane Doe",
+ )
+ repo._conn.execute(
+ "UPDATE threat_acceptances SET created_at = ? WHERE threat_ref = ?",
+ (f"2026-01-{day:02d}T00:00:00+00:00", f"T{100 + day}"),
+ )
+ repo._conn.commit()
+ repo.close()
+
+ page = client.get("/activities/threat-modeling").text
+ card = page[page.index(">Accepted threats"):page.index('heading-with-info">Models needing rework')]
+ # The seeded report's T4 is newer than the January sign-offs, so it
+ # leads the preview. The oldest recorded titles stay off the card.
+ assert "Risk accepted for legacy endpoint" in card
+ assert "Accepted threat 7" in card
+ assert "Accepted threat 4" in card
+ assert "Accepted threat 3" not in card
+ assert "View all 8" in card
+
+ full = client.get("/activities/threat-modeling/accepted")
+ assert full.status_code == 200
+ assert "Accepted threat 1" in full.text
+ assert "Accepted threat 7" in full.text
+ assert "Risk accepted for legacy endpoint" in full.text
+
+
def test_dashboard_shows_accept_cli_hint(client, tmp_path):
_seed(tmp_path)
resp = client.get("/activities/threat-modeling")
diff --git a/tests/test_web/test_widget_info_tips.py b/tests/test_web/test_widget_info_tips.py
index 6b6a5568..57d14b42 100644
--- a/tests/test_web/test_widget_info_tips.py
+++ b/tests/test_web/test_widget_info_tips.py
@@ -113,7 +113,7 @@ def test_long_lists_scroll_after_ten_rows():
tm = (STATIC_JS.parents[2] / "templates" / "activities" / "threat_modeling_dashboard.html").read_text()
for marker in ("rework-list widget-scroll", "pattern-list widget-scroll", "miss-list widget-scroll", "assume-list widget-scroll"):
assert marker in tm
- assert tm.count('data-scroll-rows="10"') >= 4
+ assert tm.count('data-scroll-rows="10"') >= 3
assert 'miss-list widget-scroll" data-scroll-rows="6"' in tm
assert 'assume-list widget-scroll" data-scroll-rows="6"' in tm