stackparity 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackparity/__init__.py +17 -0
- stackparity/_engine/agents/investigator.py +294 -0
- stackparity/_engine/agents/memory_agent.py +37 -0
- stackparity/_engine/agents/pipeline_agent.py +152 -0
- stackparity/_engine/agents/remediation_agent.py +248 -0
- stackparity/_engine/agents/runtime.py +177 -0
- stackparity/_engine/agents/specialists.py +709 -0
- stackparity/_engine/agents/suspicious_change_agent.py +1275 -0
- stackparity/_engine/cli/__init__.py +2 -0
- stackparity/_engine/cli/main.py +1252 -0
- stackparity/_engine/cli/remediate.py +461 -0
- stackparity/_engine/cli/term.py +44 -0
- stackparity/_engine/config/__init__.py +0 -0
- stackparity/_engine/config/constants.py +88 -0
- stackparity/_engine/config/loader.py +155 -0
- stackparity/_engine/config/settings.py +108 -0
- stackparity/_engine/containers/__init__.py +12 -0
- stackparity/_engine/containers/discovery.py +143 -0
- stackparity/_engine/containers/models.py +72 -0
- stackparity/_engine/containers/trivy_image_scanner.py +165 -0
- stackparity/_engine/core/__init__.py +0 -0
- stackparity/_engine/core/capabilities.py +107 -0
- stackparity/_engine/core/finding_schema.py +305 -0
- stackparity/_engine/core/git_manager.py +206 -0
- stackparity/_engine/core/http.py +64 -0
- stackparity/_engine/core/models.py +109 -0
- stackparity/_engine/core/netpolicy.py +242 -0
- stackparity/_engine/core/plugins.py +43 -0
- stackparity/_engine/core/repository_inspector.py +243 -0
- stackparity/_engine/core/safe_env.py +48 -0
- stackparity/_engine/core/scan_orchestrator.py +289 -0
- stackparity/_engine/core/scan_state.py +58 -0
- stackparity/_engine/core/url_validator.py +135 -0
- stackparity/_engine/ecosystems/__init__.py +1 -0
- stackparity/_engine/ecosystems/registry.py +138 -0
- stackparity/_engine/evidence/__init__.py +1 -0
- stackparity/_engine/evidence/store.py +65 -0
- stackparity/_engine/explainability/__init__.py +0 -0
- stackparity/_engine/explainability/evidence_formatter.py +30 -0
- stackparity/_engine/explainability/explanation_engine.py +132 -0
- stackparity/_engine/explainability/explanation_validator.py +54 -0
- stackparity/_engine/explainability/prompt_templates.py +18 -0
- stackparity/_engine/graph/__init__.py +0 -0
- stackparity/_engine/graph/dependency_tracer.py +86 -0
- stackparity/_engine/graph/graph_builder.py +165 -0
- stackparity/_engine/graph/graph_diff.py +57 -0
- stackparity/_engine/graph/graph_exporter.py +194 -0
- stackparity/_engine/graph/graph_validator.py +46 -0
- stackparity/_engine/graph/impact_analyzer.py +23 -0
- stackparity/_engine/graph/tree_view.py +185 -0
- stackparity/_engine/intel/__init__.py +0 -0
- stackparity/_engine/intel/epss.py +53 -0
- stackparity/_engine/llm/__init__.py +1 -0
- stackparity/_engine/llm/client.py +138 -0
- stackparity/_engine/monitor/__init__.py +0 -0
- stackparity/_engine/monitor/watch.py +171 -0
- stackparity/_engine/non_cve/__init__.py +7 -0
- stackparity/_engine/non_cve/base.py +62 -0
- stackparity/_engine/non_cve/iac.py +144 -0
- stackparity/_engine/non_cve/sast.py +272 -0
- stackparity/_engine/non_cve/supply_chain.py +147 -0
- stackparity/_engine/orchestration/__init__.py +1 -0
- stackparity/_engine/orchestration/pipeline.py +279 -0
- stackparity/_engine/orchestration/supervisor.py +167 -0
- stackparity/_engine/pipeline_analysis/__init__.py +0 -0
- stackparity/_engine/pipeline_analysis/analyzer.py +90 -0
- stackparity/_engine/pipeline_analysis/ci.py +189 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/__init__.py +24 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/azure_pipelines.py +221 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/base.py +239 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/circleci.py +176 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/github_actions.py +356 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/gitlab_ci.py +268 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/jenkins.py +180 -0
- stackparity/_engine/pipeline_analysis/ci_adapters/registry.py +80 -0
- stackparity/_engine/pipeline_analysis/ci_models.py +72 -0
- stackparity/_engine/pipeline_analysis/dockerfile.py +235 -0
- stackparity/_engine/pipeline_analysis/eol.py +62 -0
- stackparity/_engine/pipeline_analysis/models.py +37 -0
- stackparity/_engine/policy/__init__.py +0 -0
- stackparity/_engine/policy/engine.py +216 -0
- stackparity/_engine/policy/resources/default.yaml +56 -0
- stackparity/_engine/policy/resources/strict.yaml +35 -0
- stackparity/_engine/reachability/__init__.py +0 -0
- stackparity/_engine/reachability/app_reachability.py +186 -0
- stackparity/_engine/reachability/scanners.py +215 -0
- stackparity/_engine/remediation/__init__.py +0 -0
- stackparity/_engine/remediation/adapters.py +198 -0
- stackparity/_engine/remediation/apply_local.py +309 -0
- stackparity/_engine/remediation/code_fixes.py +383 -0
- stackparity/_engine/remediation/compat.py +156 -0
- stackparity/_engine/remediation/container_plan.py +127 -0
- stackparity/_engine/remediation/delivery.py +31 -0
- stackparity/_engine/remediation/export.py +44 -0
- stackparity/_engine/remediation/lifecycle.py +623 -0
- stackparity/_engine/remediation/local_trial.py +358 -0
- stackparity/_engine/remediation/patchers.py +215 -0
- stackparity/_engine/remediation/planner.py +285 -0
- stackparity/_engine/remediation/pr_template_engine.py +234 -0
- stackparity/_engine/remediation/reachability_impact.py +147 -0
- stackparity/_engine/remediation/versions.py +92 -0
- stackparity/_engine/remediation/whatif.py +64 -0
- stackparity/_engine/remediation/worktree_pr.py +434 -0
- stackparity/_engine/reporting/__init__.py +0 -0
- stackparity/_engine/reporting/counts.py +63 -0
- stackparity/_engine/reporting/fix_pdf.py +343 -0
- stackparity/_engine/reporting/fix_report.py +135 -0
- stackparity/_engine/reporting/json_exporter.py +61 -0
- stackparity/_engine/reporting/report_generator.py +200 -0
- stackparity/_engine/reporting/sarif.py +71 -0
- stackparity/_engine/reporting/vex.py +57 -0
- stackparity/_engine/reporting/view.py +166 -0
- stackparity/_engine/risk_analysis/__init__.py +0 -0
- stackparity/_engine/risk_analysis/contextual_scorer.py +253 -0
- stackparity/_engine/risk_analysis/evidence_collector.py +62 -0
- stackparity/_engine/risk_analysis/evidence_normalizer.py +37 -0
- stackparity/_engine/risk_analysis/finding_correlator.py +90 -0
- stackparity/_engine/risk_analysis/function_impact.py +184 -0
- stackparity/_engine/risk_analysis/production_context.py +252 -0
- stackparity/_engine/risk_analysis/risk_rules.py +81 -0
- stackparity/_engine/risk_analysis/risk_scorer.py +390 -0
- stackparity/_engine/sandbox/__init__.py +0 -0
- stackparity/_engine/sandbox/runner.py +142 -0
- stackparity/_engine/sbom/__init__.py +0 -0
- stackparity/_engine/sbom/adapters/__init__.py +19 -0
- stackparity/_engine/sbom/adapters/builtin.py +29 -0
- stackparity/_engine/sbom/adapters/syft.py +26 -0
- stackparity/_engine/sbom/adapters/trivy.py +76 -0
- stackparity/_engine/sbom/builtin_generator.py +227 -0
- stackparity/_engine/sbom/cyclonedx_validator.py +166 -0
- stackparity/_engine/sbom/exporters.py +153 -0
- stackparity/_engine/sbom/fusion/__init__.py +5 -0
- stackparity/_engine/sbom/fusion/engine.py +315 -0
- stackparity/_engine/sbom/fusion/hashes.py +47 -0
- stackparity/_engine/sbom/fusion/ledger.py +96 -0
- stackparity/_engine/sbom/fusion/registries.py +271 -0
- stackparity/_engine/sbom/fusion/resolver.py +143 -0
- stackparity/_engine/sbom/fusion/writer.py +114 -0
- stackparity/_engine/sbom/lockfile_analyzer.py +114 -0
- stackparity/_engine/sbom/merge.py +71 -0
- stackparity/_engine/sbom/package_extractors/common.py +104 -0
- stackparity/_engine/sbom/package_extractors/manifests.py +101 -0
- stackparity/_engine/sbom/package_extractors/npm.py +206 -0
- stackparity/_engine/sbom/package_extractors/others.py +267 -0
- stackparity/_engine/sbom/package_extractors/python.py +143 -0
- stackparity/_engine/sbom/quality_analyzer.py +191 -0
- stackparity/_engine/sbom/scanner_engine.py +98 -0
- stackparity/_engine/sbom/syft_runner.py +100 -0
- stackparity/_engine/sbom/tool_locator.py +69 -0
- stackparity/_engine/sbom/trivy_runner.py +82 -0
- stackparity/_engine/storage/__init__.py +0 -0
- stackparity/_engine/storage/cache.py +56 -0
- stackparity/_engine/storage/database.py +295 -0
- stackparity/_engine/storage/memory.py +146 -0
- stackparity/_engine/suspicious_changes/__init__.py +12 -0
- stackparity/_engine/suspicious_changes/analyzer.py +1022 -0
- stackparity/_engine/suspicious_changes/change_correlation.py +861 -0
- stackparity/_engine/suspicious_changes/lifecycle_script_detector.py +263 -0
- stackparity/_engine/suspicious_changes/lockfile_change_detector.py +316 -0
- stackparity/_engine/suspicious_changes/manifest_diff_detector.py +251 -0
- stackparity/_engine/suspicious_changes/package_risk.py +78 -0
- stackparity/_engine/suspicious_changes/popular_packages.py +94 -0
- stackparity/_engine/suspicious_changes/registry_detector.py +354 -0
- stackparity/_engine/suspicious_changes/suspicious_models.py +57 -0
- stackparity/_engine/suspicious_changes/typosquatting_detector.py +298 -0
- stackparity/_engine/tools/__init__.py +1 -0
- stackparity/_engine/tools/builtin.py +93 -0
- stackparity/_engine/tools/registry.py +66 -0
- stackparity/_engine/ui/__init__.py +0 -0
- stackparity/_engine/ui/components/__init__.py +0 -0
- stackparity/_engine/ui/components/common.py +238 -0
- stackparity/_engine/ui/components/live_progress.py +157 -0
- stackparity/_engine/ui/components/memory_panel.py +82 -0
- stackparity/_engine/ui/pages/__init__.py +0 -0
- stackparity/_engine/ui/pages/agents_page.py +76 -0
- stackparity/_engine/ui/pages/architecture_page.py +44 -0
- stackparity/_engine/ui/pages/fixes_page.py +98 -0
- stackparity/_engine/ui/pages/graph_page.py +203 -0
- stackparity/_engine/ui/pages/health_page.py +117 -0
- stackparity/_engine/ui/pages/monitor_page.py +67 -0
- stackparity/_engine/ui/pages/pipeline_page.py +219 -0
- stackparity/_engine/ui/pages/remediation_page.py +409 -0
- stackparity/_engine/ui/pages/reports_page.py +54 -0
- stackparity/_engine/ui/pages/sbom_page.py +210 -0
- stackparity/_engine/ui/pages/scan_page.py +131 -0
- stackparity/_engine/ui/pages/suspicious_page.py +551 -0
- stackparity/_engine/ui/pages/vulns_page.py +201 -0
- stackparity/_engine/ui/state.py +116 -0
- stackparity/_engine/ui/theme.py +201 -0
- stackparity/_engine/ui/visualizations/__init__.py +0 -0
- stackparity/_engine/ui/visualizations/graphs.py +373 -0
- stackparity/_engine/vulnerability/__init__.py +0 -0
- stackparity/_engine/vulnerability/cvss.py +58 -0
- stackparity/_engine/vulnerability/kev_client.py +47 -0
- stackparity/_engine/vulnerability/nvd_client.py +74 -0
- stackparity/_engine/vulnerability/osv_client.py +139 -0
- stackparity/_engine/vulnerability/remediation_engine.py +50 -0
- stackparity/_engine/vulnerability/verification.py +94 -0
- stackparity/_engine/vulnerability/version_matcher.py +299 -0
- stackparity/_engine/vulnerability/vulnerability_correlator.py +303 -0
- stackparity/_engine/vulnerability/vulnerability_models.py +64 -0
- stackparity/cli.py +30 -0
- stackparity/dashboard_app.py +95 -0
- stackparity/web_dist/assets/index-DRJYw2Du.css +1 -0
- stackparity/web_dist/assets/index-Q6LLpbEi.js +495 -0
- stackparity/web_dist/index.html +13 -0
- stackparity/web_server.py +533 -0
- stackparity-1.0.0.dist-info/METADATA +204 -0
- stackparity-1.0.0.dist-info/RECORD +212 -0
- stackparity-1.0.0.dist-info/WHEEL +4 -0
- stackparity-1.0.0.dist-info/entry_points.txt +2 -0
- stackparity-1.0.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""Shared UI helpers and reusable components (kept free of analysis logic).
|
|
2
|
+
|
|
3
|
+
Minimalist, high-density layout components with strict backward compatibility.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any, Optional
|
|
10
|
+
|
|
11
|
+
import pandas as pd
|
|
12
|
+
import streamlit as st
|
|
13
|
+
|
|
14
|
+
from ui.state import get_active_scan
|
|
15
|
+
from ui.theme import (RISK_ICON, SEV_BG_COLORS, SEV_BORDER_COLORS, SEV_COLORS, SEV_RANK,
|
|
16
|
+
SHIELD_SVG, severity_pill_html, status_pill_html, text_badge)
|
|
17
|
+
|
|
18
|
+
# Exported backward-compatible aliases
|
|
19
|
+
__all__ = [
|
|
20
|
+
"SEV_COLORS",
|
|
21
|
+
"SEV_BG_COLORS",
|
|
22
|
+
"SEV_BORDER_COLORS",
|
|
23
|
+
"SEV_RANK",
|
|
24
|
+
"RISK_ICON",
|
|
25
|
+
"badge",
|
|
26
|
+
"severity_pill_html",
|
|
27
|
+
"status_pill_html",
|
|
28
|
+
"df",
|
|
29
|
+
"get_result",
|
|
30
|
+
"require_result",
|
|
31
|
+
"page_header",
|
|
32
|
+
"repo_caption",
|
|
33
|
+
"empty_state",
|
|
34
|
+
"metric_group",
|
|
35
|
+
"risk_by_id",
|
|
36
|
+
"download_json",
|
|
37
|
+
"read_file",
|
|
38
|
+
"kv_table",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def badge(label: Optional[str]) -> str:
|
|
43
|
+
"""Text-compatible badge safe for expanders, metrics, and selects."""
|
|
44
|
+
return text_badge(label)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def df(
|
|
48
|
+
rows: list[dict] | list[list],
|
|
49
|
+
columns: Optional[list[str]] = None,
|
|
50
|
+
height: Optional[int] = None,
|
|
51
|
+
key: Optional[str] = None,
|
|
52
|
+
column_config: Optional[dict[str, Any]] = None,
|
|
53
|
+
) -> None:
|
|
54
|
+
"""Standardized DataFrame viewer with automatic Arrow serialization guards and column_config support."""
|
|
55
|
+
d = pd.DataFrame(rows, columns=columns) if columns else pd.DataFrame(rows)
|
|
56
|
+
if d.empty:
|
|
57
|
+
st.info("Nothing to show.")
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
# Mixed number/text columns (e.g. CVSS "n/a") cannot be Arrow-serialised; convert mixed object columns to text
|
|
61
|
+
for col in d.columns:
|
|
62
|
+
vals = [v for v in d[col] if v is not None and v == v]
|
|
63
|
+
if any(isinstance(v, str) for v in vals) and any(
|
|
64
|
+
isinstance(v, (int, float)) and not isinstance(v, bool) for v in vals
|
|
65
|
+
):
|
|
66
|
+
d[col] = d[col].map(lambda v: "" if v is None or v != v else str(v))
|
|
67
|
+
|
|
68
|
+
if height is None:
|
|
69
|
+
height = "content" if len(d) <= 15 else 400
|
|
70
|
+
elif len(d) <= 8:
|
|
71
|
+
height = "content"
|
|
72
|
+
|
|
73
|
+
kwargs: dict[str, Any] = {
|
|
74
|
+
"width": "stretch",
|
|
75
|
+
"hide_index": True,
|
|
76
|
+
"height": height,
|
|
77
|
+
"key": key,
|
|
78
|
+
}
|
|
79
|
+
if column_config:
|
|
80
|
+
kwargs["column_config"] = column_config
|
|
81
|
+
|
|
82
|
+
st.dataframe(d, **kwargs)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_result() -> Optional[dict]:
|
|
86
|
+
"""Retrieve active scan result from session state."""
|
|
87
|
+
return get_active_scan()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def empty_state(
|
|
91
|
+
title: str = "No Active Scan Loaded",
|
|
92
|
+
message: str = "Run <code>stackparity scan .</code> in your terminal or select a persisted scan from the sidebar.",
|
|
93
|
+
) -> None:
|
|
94
|
+
"""Minimalist, compact empty state container."""
|
|
95
|
+
st.markdown(
|
|
96
|
+
f"""
|
|
97
|
+
<div style="border:1px dashed #1E293B; border-radius:8px; padding:24px 16px; text-align:center; margin:14px 0; background:#111827;">
|
|
98
|
+
<div style="display:flex; justify-content:center; margin-bottom:8px;">{SHIELD_SVG}</div>
|
|
99
|
+
<div style="font-weight:600; font-size:14px; color:#F1F5F9;">{title}</div>
|
|
100
|
+
<div style="color:#94A3B8; font-size:12.5px; margin-top:4px;">{message}</div>
|
|
101
|
+
</div>
|
|
102
|
+
""",
|
|
103
|
+
unsafe_allow_html=True,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def require_result() -> Optional[dict]:
|
|
108
|
+
"""Guard function for pages requiring an active scan."""
|
|
109
|
+
r = get_result()
|
|
110
|
+
if not r or r.get("status") == "failed":
|
|
111
|
+
empty_state(
|
|
112
|
+
title="No Scan Results Loaded",
|
|
113
|
+
message="Run <code>stackparity scan .</code> via CLI first, or select a saved scan from the sidebar.",
|
|
114
|
+
)
|
|
115
|
+
return None
|
|
116
|
+
return r
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def repo_caption(r: dict) -> None:
|
|
120
|
+
"""Render a compact, high-density repository context chip bar."""
|
|
121
|
+
repo = r.get("repo", {})
|
|
122
|
+
summary = r.get("summary", {})
|
|
123
|
+
name = repo.get("name", "Repository")
|
|
124
|
+
sha = repo.get("commit_sha", "")[:8]
|
|
125
|
+
status = r.get("status", "completed")
|
|
126
|
+
cache_tag = " · cached" if r.get("from_cache") else ""
|
|
127
|
+
comps = summary.get("components", len(r.get("components", [])))
|
|
128
|
+
vulns = summary.get("vulnerabilities_confirmed", 0)
|
|
129
|
+
crit = summary.get("by_cvss_severity", {}).get("CRITICAL", 0)
|
|
130
|
+
high = summary.get("by_cvss_severity", {}).get("HIGH", 0)
|
|
131
|
+
|
|
132
|
+
unconf = summary.get("vulnerabilities_unknown", 0)
|
|
133
|
+
vuln_summary = f"<b>{vulns + unconf}</b> findings" + (f" ({unconf} unconfirmed)" if unconf else "")
|
|
134
|
+
if crit or high:
|
|
135
|
+
vuln_summary += f" · CVSS <span style='color:#EF4444; font-weight:600;'>{crit} critical</span> · <span style='color:#F97316; font-weight:600;'>{high} high</span>"
|
|
136
|
+
|
|
137
|
+
st.markdown(
|
|
138
|
+
f"""
|
|
139
|
+
<div style="border:1px solid #1E293B; background:#111827; border-radius:8px; padding:8px 14px; margin:2px 0 14px 0; font-size:12.5px; color:#CBD5E1; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px;">
|
|
140
|
+
<div style="display:flex; align-items:center; gap:8px;">{SHIELD_SVG} <b>{name}</b> · <code>{sha}</code>{cache_tag} · {status_pill_html(status)}</div>
|
|
141
|
+
<div>{comps} packages · {vuln_summary}</div>
|
|
142
|
+
</div>
|
|
143
|
+
""",
|
|
144
|
+
unsafe_allow_html=True,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def page_header(
|
|
149
|
+
title: str,
|
|
150
|
+
description: Optional[str] = None,
|
|
151
|
+
r: Optional[dict] = None,
|
|
152
|
+
show_context: bool = True,
|
|
153
|
+
) -> None:
|
|
154
|
+
"""Minimalist page header with compact title and optional repository context chip."""
|
|
155
|
+
st.markdown(f"### {title}")
|
|
156
|
+
if description:
|
|
157
|
+
st.markdown(
|
|
158
|
+
f"<div style='color:#8b949e; font-size:13px; margin-top:-8px; margin-bottom:8px;'>{description}</div>",
|
|
159
|
+
unsafe_allow_html=True,
|
|
160
|
+
)
|
|
161
|
+
if show_context:
|
|
162
|
+
scan = r or get_result()
|
|
163
|
+
if scan and scan.get("repo"):
|
|
164
|
+
repo_caption(scan)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def metric_group(metrics: list[dict[str, Any]]) -> None:
|
|
168
|
+
"""Render a structured row of metrics with optional labels and helper captions."""
|
|
169
|
+
if not metrics:
|
|
170
|
+
return
|
|
171
|
+
cols = st.columns(len(metrics))
|
|
172
|
+
for col, m in zip(cols, metrics):
|
|
173
|
+
col.metric(
|
|
174
|
+
label=m.get("label", ""),
|
|
175
|
+
value=m.get("value", 0),
|
|
176
|
+
delta=m.get("delta"),
|
|
177
|
+
help=m.get("help"),
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def risk_by_id(r: dict) -> dict[str, dict]:
|
|
182
|
+
"""Map finding_id to its deterministic risk assessment, auto-populating if missing."""
|
|
183
|
+
assessments = r.get("risk_assessments", [])
|
|
184
|
+
if not assessments and r.get("vulnerabilities"):
|
|
185
|
+
try:
|
|
186
|
+
from risk_analysis.finding_correlator import correlate_findings
|
|
187
|
+
from risk_analysis.risk_rules import DEFAULT_RULES
|
|
188
|
+
corr = correlate_findings(
|
|
189
|
+
r.get("vulnerabilities", []),
|
|
190
|
+
r.get("typosquatting", []),
|
|
191
|
+
r.get("lockfile_changes", []),
|
|
192
|
+
r.get("rules", DEFAULT_RULES),
|
|
193
|
+
r.get("pipeline_findings", []),
|
|
194
|
+
)
|
|
195
|
+
assessments = corr.get("assessments", [])
|
|
196
|
+
r["risk_assessments"] = assessments
|
|
197
|
+
r["correlations"] = corr.get("correlations", [])
|
|
198
|
+
except Exception:
|
|
199
|
+
assessments = []
|
|
200
|
+
return {a["finding_id"]: a for a in assessments}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def download_json(label: str, obj: Any, filename: str, key: str) -> None:
|
|
204
|
+
"""Download button for JSON payloads."""
|
|
205
|
+
st.download_button(
|
|
206
|
+
label,
|
|
207
|
+
json.dumps(obj, indent=2, default=str),
|
|
208
|
+
file_name=filename,
|
|
209
|
+
mime="application/json",
|
|
210
|
+
key=key,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def read_file(path: Optional[str]) -> Optional[bytes]:
|
|
215
|
+
"""Safe binary file reader."""
|
|
216
|
+
try:
|
|
217
|
+
if path and Path(path).exists():
|
|
218
|
+
return Path(path).read_bytes()
|
|
219
|
+
except OSError:
|
|
220
|
+
pass
|
|
221
|
+
return None
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def kv_table(d: dict) -> None:
|
|
225
|
+
"""Key-value table representation."""
|
|
226
|
+
df(
|
|
227
|
+
[
|
|
228
|
+
{
|
|
229
|
+
"Field": k,
|
|
230
|
+
"Value": (
|
|
231
|
+
""
|
|
232
|
+
if v is None
|
|
233
|
+
else (json.dumps(v, default=str) if isinstance(v, (dict, list)) else str(v))
|
|
234
|
+
),
|
|
235
|
+
}
|
|
236
|
+
for k, v in d.items()
|
|
237
|
+
]
|
|
238
|
+
)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""Minimalist live progress UI for the agent pipeline.
|
|
2
|
+
|
|
3
|
+
Drastically minimizes screen clutter:
|
|
4
|
+
- Consolidates 28 granular steps into 5 high-level milestones.
|
|
5
|
+
- Filters out verbose internal telemetry, debug statistics, and noisy observations.
|
|
6
|
+
- Displays only the most recent meaningful agent actions (max 4 lines).
|
|
7
|
+
- Cleanly collapses upon scan completion.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import streamlit as st
|
|
12
|
+
|
|
13
|
+
from agents.runtime import STEPS
|
|
14
|
+
|
|
15
|
+
# 5 High-level architectural pipeline stages
|
|
16
|
+
STAGES = [
|
|
17
|
+
("Reconnaissance", ["validate", "clone", "discover", "classify", "plan"]),
|
|
18
|
+
("SBOM & Infrastructure", ["lockfiles", "sbom_generate", "sbom_validate", "pipeline", "quality", "metadata"]),
|
|
19
|
+
("Vulnerability & Graph", ["graph", "osv", "enrich", "trace", "verify", "investigate"]),
|
|
20
|
+
("Threat & Contextual Risk", ["typosquat", "package_risk", "lockfile_history", "risk", "explain"]),
|
|
21
|
+
("Remediation & Assembly", ["remediate", "validate_fix", "memory", "summary", "export", "cleanup"]),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
# Telemetry patterns to suppress from live display to eliminate petty noise
|
|
25
|
+
NOISY_PATTERNS = (
|
|
26
|
+
"licenses 0->",
|
|
27
|
+
"hashes 0->",
|
|
28
|
+
"supplier 0->",
|
|
29
|
+
"description 0->",
|
|
30
|
+
"external_refs",
|
|
31
|
+
"published_at",
|
|
32
|
+
"registries:",
|
|
33
|
+
"0 fetched",
|
|
34
|
+
"from cache",
|
|
35
|
+
"integrity: absent",
|
|
36
|
+
"avg completeness",
|
|
37
|
+
"coverage (scanner",
|
|
38
|
+
"install-time scripts",
|
|
39
|
+
"unique packages queried",
|
|
40
|
+
"advisories returned",
|
|
41
|
+
"package names compared",
|
|
42
|
+
"similarity candidates",
|
|
43
|
+
"source file(s) analysed",
|
|
44
|
+
"routes_agree",
|
|
45
|
+
"disagreement_count",
|
|
46
|
+
"attested of",
|
|
47
|
+
"verdicts: ",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _is_noisy(msg: str) -> bool:
|
|
52
|
+
"""Filter out verbose debugging/telemetry metrics."""
|
|
53
|
+
m = msg.lower()
|
|
54
|
+
return any(p in m for p in NOISY_PATTERNS)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _clean_message(msg: str, max_len: int = 65) -> str:
|
|
58
|
+
"""Clean and condense messages to a concise single line."""
|
|
59
|
+
clean = " ".join(msg.split())
|
|
60
|
+
if len(clean) > max_len:
|
|
61
|
+
return clean[:max_len - 3] + "..."
|
|
62
|
+
return clean
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class LiveProgress:
|
|
66
|
+
"""Minimalist live progress indicator for the agent pipeline."""
|
|
67
|
+
|
|
68
|
+
def __init__(self) -> None:
|
|
69
|
+
self.bar = st.progress(0.0, text="Initializing agent pipeline...")
|
|
70
|
+
left, right = st.columns([5, 7])
|
|
71
|
+
self.steps_ph = left.empty()
|
|
72
|
+
self.log_ph = right.empty()
|
|
73
|
+
self.log: list[str] = []
|
|
74
|
+
self.status = {s[0]: "pending" for s in STEPS}
|
|
75
|
+
self._render_milestones(None, 0)
|
|
76
|
+
|
|
77
|
+
def __call__(self, e: dict) -> None:
|
|
78
|
+
self.status = e.get("status", self.status)
|
|
79
|
+
done = sum(1 for v in self.status.values() if v in ("done", "skipped", "error"))
|
|
80
|
+
running = [s for s, v in self.status.items() if v == "running"]
|
|
81
|
+
cur = running[-1] if running else None
|
|
82
|
+
|
|
83
|
+
active_label = (
|
|
84
|
+
next((lab for sid, _, lab in STEPS if sid == cur), e.get("message", "finishing"))
|
|
85
|
+
if cur
|
|
86
|
+
else "finishing"
|
|
87
|
+
)
|
|
88
|
+
active_agent = e.get("agent", "")
|
|
89
|
+
|
|
90
|
+
progress_pct = int(min(max(e.get("progress", 0.0), 0.0), 1.0) * 100)
|
|
91
|
+
self.bar.progress(
|
|
92
|
+
min(max(e.get("progress", 0.0), 0.0), 1.0),
|
|
93
|
+
text=f"{progress_pct}% · {active_agent} · {active_label}",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Filter out noisy petty telemetry: only display high-signal decisions, warnings, errors, and key milestones
|
|
97
|
+
msg = e.get("message", "")
|
|
98
|
+
kind = e.get("kind", "progress")
|
|
99
|
+
|
|
100
|
+
# Suppress internal debug observations and raw counter metrics
|
|
101
|
+
is_high_signal = kind in ("decision", "warning", "error") or (
|
|
102
|
+
kind in ("done", "start") and not _is_noisy(msg) and len(msg) < 60
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if is_high_signal and not _is_noisy(msg):
|
|
106
|
+
t_str = f"{e.get('t', 0.0):4.1f}s"
|
|
107
|
+
if kind == "decision":
|
|
108
|
+
icon = "🧭"
|
|
109
|
+
elif kind in ("warning", "error"):
|
|
110
|
+
icon = "⚠️"
|
|
111
|
+
elif kind == "done":
|
|
112
|
+
icon = "✓"
|
|
113
|
+
else:
|
|
114
|
+
icon = "•"
|
|
115
|
+
|
|
116
|
+
clean_msg = _clean_message(msg)
|
|
117
|
+
entry = f"`{t_str}` {icon} **{active_agent}** · {clean_msg}"
|
|
118
|
+
# Keep log strictly capped at 3 entries to maintain minimalism
|
|
119
|
+
if not self.log or self.log[-1] != entry:
|
|
120
|
+
self.log.append(entry)
|
|
121
|
+
|
|
122
|
+
self._render_milestones(cur, done)
|
|
123
|
+
self._render_log()
|
|
124
|
+
|
|
125
|
+
def _render_milestones(self, cur_step: str | None, done_count: int) -> None:
|
|
126
|
+
lines = ["**Pipeline**"]
|
|
127
|
+
for stage_name, steps in STAGES:
|
|
128
|
+
stage_done = all(self.status.get(s) in ("done", "skipped", "error") for s in steps)
|
|
129
|
+
stage_active = any(self.status.get(s) == "running" for s in steps) or (
|
|
130
|
+
cur_step in steps
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
if stage_done:
|
|
134
|
+
lines.append(f"✅ {stage_name}")
|
|
135
|
+
elif stage_active:
|
|
136
|
+
lines.append(f"🔵 **{stage_name}**")
|
|
137
|
+
# Show subtle active step
|
|
138
|
+
step_label = next((lab for sid, _, lab in STEPS if sid == cur_step), None)
|
|
139
|
+
if step_label:
|
|
140
|
+
lines.append(f" ↳ _{_clean_message(step_label, 36)}_")
|
|
141
|
+
else:
|
|
142
|
+
lines.append(f"⚪ <span style='color: #888;'>{stage_name}</span>")
|
|
143
|
+
|
|
144
|
+
self.steps_ph.markdown("\n\n".join(lines), unsafe_allow_html=True)
|
|
145
|
+
|
|
146
|
+
def _render_log(self) -> None:
|
|
147
|
+
recent = self.log[-3:] if self.log else ["_Awaiting agent observations..._"]
|
|
148
|
+
self.log_ph.markdown("**Activity**\n\n" + "\n\n".join(recent))
|
|
149
|
+
|
|
150
|
+
def finish(self, ok: bool = True) -> None:
|
|
151
|
+
if ok:
|
|
152
|
+
self.bar.progress(1.0, text="100% · Analysis completed successfully")
|
|
153
|
+
else:
|
|
154
|
+
self.bar.progress(1.0, text="Pipeline stopped")
|
|
155
|
+
# Drastically minimize post-scan clutter
|
|
156
|
+
self.steps_ph.empty()
|
|
157
|
+
self.log_ph.empty()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""UI for the Memory Agent: finding history banner and analyst decisions (accept risk / false positive / suppress)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import streamlit as st
|
|
5
|
+
|
|
6
|
+
from config.settings import get_settings
|
|
7
|
+
from storage.database import Database
|
|
8
|
+
from storage.memory import DECISIONS, Memory
|
|
9
|
+
|
|
10
|
+
LABELS = {"accepted_risk": "Accepted risk", "false_positive": "False positive", "suppress": "Suppressed"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _mem() -> Memory:
|
|
14
|
+
return Memory(Database(get_settings().db_path))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def active_decisions(r: dict) -> dict[str, dict]:
|
|
18
|
+
"""finding_id -> active decision for this scan's repository (decisions are looked up by stable fingerprint)."""
|
|
19
|
+
fps = (r.get("memory") or {}).get("fingerprints") or {}
|
|
20
|
+
if not fps:
|
|
21
|
+
return {}
|
|
22
|
+
try:
|
|
23
|
+
dec = _mem().decisions(r["repo"]["url"])
|
|
24
|
+
except Exception:
|
|
25
|
+
return {}
|
|
26
|
+
return {fid: dec[fp] for fid, fp in fps.items() if fp in dec}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def history_banner(r: dict) -> None:
|
|
30
|
+
diff = (r.get("memory") or {}).get("diff")
|
|
31
|
+
if not diff:
|
|
32
|
+
return
|
|
33
|
+
if diff.get("baseline"):
|
|
34
|
+
st.caption("History: first scan of this repository - this scan is the baseline for future comparisons.")
|
|
35
|
+
return
|
|
36
|
+
c = diff["counts"]
|
|
37
|
+
cols = st.columns(4)
|
|
38
|
+
cols[0].metric("New since last scan", c["new"])
|
|
39
|
+
cols[1].metric("Persisting", c["persisting"])
|
|
40
|
+
cols[2].metric("Fixed", c["fixed"])
|
|
41
|
+
cols[3].metric("Reappeared", c["regressed"])
|
|
42
|
+
if diff.get("fixed"):
|
|
43
|
+
with st.expander(f"{len(diff['fixed'])} finding(s) fixed since the previous scan"):
|
|
44
|
+
for f in diff["fixed"][:25]:
|
|
45
|
+
st.markdown(f"- ~~{f['title']}~~ ({f.get('severity') or 'n/a'})")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def decisions_panel(r: dict) -> None:
|
|
49
|
+
mem_info = r.get("memory") or {}
|
|
50
|
+
fps, titles = mem_info.get("fingerprints") or {}, mem_info.get("titles") or {}
|
|
51
|
+
repo_url = r["repo"]["url"]
|
|
52
|
+
if not fps:
|
|
53
|
+
st.caption("No findings to decide on.")
|
|
54
|
+
return
|
|
55
|
+
try:
|
|
56
|
+
mem = _mem()
|
|
57
|
+
current = mem.decisions(repo_url)
|
|
58
|
+
except Exception as e: # database problems must not break the page
|
|
59
|
+
st.warning(f"Decision memory unavailable: {e}")
|
|
60
|
+
return
|
|
61
|
+
st.caption("Decisions are remembered per repository, shown next to the finding (never hidden), and can expire. They do not change the risk score.")
|
|
62
|
+
with st.form("decision_form", clear_on_submit=True):
|
|
63
|
+
c1, c2, c3 = st.columns([3, 1.4, 1])
|
|
64
|
+
pick = c1.selectbox("Finding", list(fps), format_func=lambda fid: f"{fid} - {titles.get(fid, '')}")
|
|
65
|
+
kind = c2.selectbox("Decision", DECISIONS, format_func=lambda d: LABELS[d])
|
|
66
|
+
days = c3.number_input("Expires in (days, 0 = never)", 0, 365, 30)
|
|
67
|
+
reason = st.text_input("Reason (required)")
|
|
68
|
+
if st.form_submit_button("Record decision"):
|
|
69
|
+
try:
|
|
70
|
+
mem.add_decision(repo_url, fps[pick], kind, reason, titles.get(pick, ""), int(days) or None)
|
|
71
|
+
st.success("Decision recorded.")
|
|
72
|
+
st.rerun()
|
|
73
|
+
except ValueError as e:
|
|
74
|
+
st.error(str(e))
|
|
75
|
+
if current:
|
|
76
|
+
st.markdown("**Active decisions**")
|
|
77
|
+
for fp, d in current.items():
|
|
78
|
+
a, b = st.columns([6, 1])
|
|
79
|
+
a.markdown(f"**{LABELS[d['decision']]}** · {d.get('title') or fp} - _{d['reason']}_ ({'expires ' + d['expires_at'][:10] if d['expires_at'] else 'no expiry'})")
|
|
80
|
+
if b.button("Remove", key=f"rm{d['id']}"):
|
|
81
|
+
mem.remove_decision(d["id"])
|
|
82
|
+
st.rerun()
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Page: Agent Activity - who did what, what each agent decided and why."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import streamlit as st
|
|
5
|
+
|
|
6
|
+
from agents.runtime import STEPS
|
|
7
|
+
from ui.components.common import df, page_header, require_result
|
|
8
|
+
from ui.components.live_progress import _is_noisy
|
|
9
|
+
|
|
10
|
+
ICON = {"pending": "⚪", "running": "🔵", "done": "✅", "skipped": "⏭️", "error": "❌"}
|
|
11
|
+
KIND_ICON = {"start": "▶", "progress": "•", "done": "✔", "skip": "⏭", "decision": "🧭", "observation": "👁", "warning": "⚠️", "error": "❌"}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def render() -> None:
|
|
15
|
+
page_header("Agent Activity", "Supervisor orchestration plan, 8 specialist agents, autonomous decisions, and complete execution trace.")
|
|
16
|
+
from config.settings import get_settings
|
|
17
|
+
s = get_settings()
|
|
18
|
+
if not s.llm_api_key:
|
|
19
|
+
st.warning("⚠️ **LLM Provider API Key Missing**: Please add an LLM provider API key in `.env` (e.g. `LLM_API_KEY=gsk_...` for Groq, `AIza...` for Gemini, `sk-ant-...` for Anthropic, or `sk-...` for OpenAI) since requirements for this phase require an active LLM for autonomous investigator reasoning.")
|
|
20
|
+
|
|
21
|
+
r = require_result()
|
|
22
|
+
if not r:
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
trace, agents = r.get("agent_trace", []), r.get("agents", [])
|
|
26
|
+
if not trace:
|
|
27
|
+
st.info("No agent trace available for this scan.")
|
|
28
|
+
return
|
|
29
|
+
|
|
30
|
+
c = st.columns(4)
|
|
31
|
+
c[0].metric("Agents", len(agents))
|
|
32
|
+
c[1].metric("Pipeline Steps", len(STEPS))
|
|
33
|
+
c[2].metric("Decisions", sum(a["decisions"] for a in agents))
|
|
34
|
+
c[3].metric("Duration", f"{r.get('total_seconds', '?')}s")
|
|
35
|
+
|
|
36
|
+
t1, t2, t3, t4 = st.tabs(["Agents & Steps", "Decisions", "Full Timeline", "Execution Plan"])
|
|
37
|
+
|
|
38
|
+
with t1:
|
|
39
|
+
for a in agents:
|
|
40
|
+
with st.expander(f"**{a['agent']}** — {a['decisions']} decisions, {a['observations']} observations", expanded=False):
|
|
41
|
+
st.caption(a["role"])
|
|
42
|
+
df([{"": ICON[s["status"]], "Step": s["label"], "Status": s["status"], "Seconds": s["seconds"]} for s in a["steps"]], height=160)
|
|
43
|
+
|
|
44
|
+
with t2:
|
|
45
|
+
dec = [e for e in trace if e["kind"] == "decision"]
|
|
46
|
+
st.caption(f"{len(dec)} autonomous agent decision(s) recorded")
|
|
47
|
+
df([{"Time (s)": e["t"], "Agent": e["agent"], "Decision": e["message"], "Reason": e["detail"].get("reason", "")} for e in dec], height=380)
|
|
48
|
+
|
|
49
|
+
with t3:
|
|
50
|
+
a, b, c_min = st.columns([2, 2, 2])
|
|
51
|
+
f_agent = a.multiselect("Agent", [x["agent"] for x in agents])
|
|
52
|
+
kinds = sorted({e["kind"] for e in trace})
|
|
53
|
+
f_kind = b.multiselect("Event Type", kinds, default=[k for k in kinds if k != "progress"])
|
|
54
|
+
hide_telemetry = c_min.checkbox("Minimalist View", value=True, help="Hide raw internal telemetry counts and debug observations")
|
|
55
|
+
rows = [
|
|
56
|
+
e for e in trace
|
|
57
|
+
if (not f_agent or e["agent"] in f_agent)
|
|
58
|
+
and e["kind"] in f_kind
|
|
59
|
+
and (not hide_telemetry or not _is_noisy(e.get("message", "")))
|
|
60
|
+
]
|
|
61
|
+
df([{"Time (s)": e["t"], "Agent": e["agent"], "Type": f"{KIND_ICON.get(e['kind'], '')} {e['kind']}", "Message": e["message"]} for e in rows], height=420)
|
|
62
|
+
|
|
63
|
+
with t4:
|
|
64
|
+
st.markdown("**Supervisor Analysis Plan**")
|
|
65
|
+
for p in r.get("plan", []):
|
|
66
|
+
st.markdown(f"• {p}")
|
|
67
|
+
st.caption("Safety rules: Static reads only · No repo code executed · No installs or builds")
|
|
68
|
+
|
|
69
|
+
orch = r.get("orchestration") or {}
|
|
70
|
+
if orch:
|
|
71
|
+
st.markdown("**Orchestration** (LangGraph state graph)")
|
|
72
|
+
st.caption(f"Engine: {orch.get('engine')} · executed nodes: {' → '.join(orch.get('trail', []))}")
|
|
73
|
+
with st.expander("Graph definition (Mermaid)"):
|
|
74
|
+
st.code(orch.get("graph", ""), language="text")
|
|
75
|
+
if orch.get("callback_errors"):
|
|
76
|
+
st.warning(f"{orch['callback_errors']} UI callback error(s) occurred while streaming progress (scan unaffected).")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Architecture overview: agents, tools, data sources, AI interaction points, approval points and evidence storage."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import streamlit as st
|
|
5
|
+
|
|
6
|
+
from agents.runtime import AGENT_ROLES, STEPS
|
|
7
|
+
from ecosystems.registry import capability_matrix
|
|
8
|
+
from tools.registry import catalogue
|
|
9
|
+
from orchestration.pipeline import workflow_payload
|
|
10
|
+
from ui.components.common import df, page_header
|
|
11
|
+
from ui.visualizations.graphs import render_workflow_graph
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def render() -> None:
|
|
15
|
+
page_header("Architecture", "Agents, tools, data sources, AI interaction points, approval points and evidence storage.")
|
|
16
|
+
t_flow, t_agents, t_eco, t_ai = st.tabs(["Agent workflow", "Agents & tools", "Ecosystems", "AI, approvals & safety"])
|
|
17
|
+
with t_flow:
|
|
18
|
+
st.caption("The real LangGraph pipeline (generated from the compiled graph). Click an agent for its role, steps and safety notes.")
|
|
19
|
+
render_workflow_graph(workflow_payload(), 460)
|
|
20
|
+
st.caption("Artifacts flow left to right: repository -> components (SBOM) -> dependency graph -> findings -> verdicts -> remediation proposals -> reports / policy gate.")
|
|
21
|
+
with t_agents:
|
|
22
|
+
steps_by_agent: dict[str, list[str]] = {}
|
|
23
|
+
for sid, ag, lab in STEPS:
|
|
24
|
+
steps_by_agent.setdefault(ag, []).append(f"{sid}: {lab}")
|
|
25
|
+
df([{"Agent": a, "Role": AGENT_ROLES.get(a, ""), "Steps": " | ".join(steps_by_agent.get(a, []))} for a in AGENT_ROLES], height=420)
|
|
26
|
+
st.markdown("**Read-only tool registry** (used by the deterministic planner and, if enabled, the LLM planner)")
|
|
27
|
+
df([{"Tool": t["name"], "Description": t["description"], "Arguments": ", ".join(f"{k}: {v}" for k, v in t["params"].items())} for t in catalogue()], height=260)
|
|
28
|
+
with t_eco:
|
|
29
|
+
st.markdown("**Ecosystem capability matrix** (computed from the plugin registry, never hand-written)")
|
|
30
|
+
df(capability_matrix(), height=420)
|
|
31
|
+
with t_ai:
|
|
32
|
+
st.markdown("""
|
|
33
|
+
**Where AI is used (all optional, off unless `LLM_API_KEY` is set):** Investigator reasoning (bounded tool loop), explanation phrasing. Everything else - detection, version matching, scoring, reachability, EPSS/KEV, what-if simulation, policy - is deterministic.
|
|
34
|
+
|
|
35
|
+
**How hallucination is controlled**
|
|
36
|
+
- the model may only call *read-only* tools; every fact it can use is an **evidence record with an id**
|
|
37
|
+
- its answer is accepted only if it cites existing evidence ids, mentions only advisory ids/facts present in the evidence, and does not contradict hard evidence (e.g. "no import" while an import exists)
|
|
38
|
+
- rejected proposals are kept and shown; the deterministic verdict stays; AI-assisted conclusions are labelled
|
|
39
|
+
|
|
40
|
+
**Human approval points:** every remediation (approve / reject / needs review, reason required) before a patch or PR text can be exported; optional sandbox build/test run needs a second explicit confirmation. Nothing is applied, pushed or merged automatically.
|
|
41
|
+
|
|
42
|
+
**Source code and secrets:** repository code is only *read* (never executed, except inside the opt-in Docker sandbox). Only package names, advisory facts and <= 11-line import snippets can leave the machine, and only to the configured LLM provider; secret-shaped strings are redacted; every call is logged (size + hash) in the report's disclosure section. Subprocesses never receive API keys.
|
|
43
|
+
""")
|
|
44
|
+
st.markdown("**Evidence storage:** every scan keeps its evidence store (`result.evidence_store`), tool traces and decision log in SQLite (`data/scanner.db`); approvals and the audit trail live in `approvals` / `audit_log`.")
|