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,551 @@
|
|
|
1
|
+
"""Page 5: Suspicious Changes & Autonomous Forensic Investigations.
|
|
2
|
+
|
|
3
|
+
Integrates Person 2 (Phases 1, 2, 3):
|
|
4
|
+
- Layer 1: Deterministic Forensic Evidence (29 findings across Git Diff, Manifests, Lifecycle Scripts, Dependency Sources, CI/CD, Containers, Typosquatting).
|
|
5
|
+
- Layer 2: Correlated Attack Chains (Multi-vector scenario synthesis).
|
|
6
|
+
- Layer 3: Autonomous AI Investigations (LangGraph tool-using investigator with Grounding Gate).
|
|
7
|
+
- Backward-compatible support for core package risk signals and live repository scans.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any, Dict, List
|
|
14
|
+
import streamlit as st
|
|
15
|
+
|
|
16
|
+
from ui.components.common import badge, df, get_result, page_header, require_result, risk_by_id
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_non_cve_scope(f: Dict[str, Any]) -> str:
|
|
20
|
+
"""Return specific Non-CVE classification for the finding."""
|
|
21
|
+
cat = f.get("category", "")
|
|
22
|
+
target = f.get("affected_file", "")
|
|
23
|
+
if cat == "Dependency Change":
|
|
24
|
+
return "Floating Version Constraint"
|
|
25
|
+
elif cat == "Dependency Source":
|
|
26
|
+
return "Mutable Git Branch Source"
|
|
27
|
+
elif cat == "Typosquatting":
|
|
28
|
+
return "Name Similarity / Typosquatting"
|
|
29
|
+
elif cat == "Lifecycle Script":
|
|
30
|
+
return "Install-Time Script Hook"
|
|
31
|
+
elif cat == "Docker & CI/CD":
|
|
32
|
+
if ".github" in target:
|
|
33
|
+
return "CI/CD Pipeline Security Posture"
|
|
34
|
+
return "Container Image Configuration / EOL"
|
|
35
|
+
return "Supply Chain Integrity Anomaly"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _get_non_cve_rationale(f: Dict[str, Any]) -> str:
|
|
39
|
+
"""Explain why traditional CVE/NVD scanners miss this finding."""
|
|
40
|
+
cat = f.get("category", "")
|
|
41
|
+
target = f.get("affected_file", "")
|
|
42
|
+
if cat == "Dependency Change":
|
|
43
|
+
return "Floating dependencies (e.g. 'latest') are not recorded in NVD/CVE databases because they are repository configuration choices, yet they expose builds to unreviewed upstream updates."
|
|
44
|
+
elif cat == "Dependency Source":
|
|
45
|
+
return "Direct Git branch heads bypass npm registry integrity metadata (checksums, immutable tarballs). No CVE tracks mutable branch head dependencies."
|
|
46
|
+
elif cat == "Typosquatting":
|
|
47
|
+
return "Typosquatting and companion packages exploit human confusion and brand similarity. They have no assigned CVE unless an intentional malicious backdoor is published and cataloged."
|
|
48
|
+
elif cat == "Lifecycle Script":
|
|
49
|
+
return "Install-time scripts (pre/postinstall) run arbitrary shell commands during package installation. This is a supported npm feature with high supply chain risk, not a CVE software bug."
|
|
50
|
+
elif cat == "Docker & CI/CD":
|
|
51
|
+
if ".github" in target:
|
|
52
|
+
return "Undeclared GITHUB_TOKEN permissions and mutable version tags (@v2) represent CI pipeline hygiene weaknesses that are completely outside the scope of CVE/NVD catalogs."
|
|
53
|
+
return "Using unpinned or EOL base images represents container hygiene and drift risk. Traditional vulnerability scanners only scan package manifests, missing Dockerfile configuration drift."
|
|
54
|
+
return "This is a structural supply chain risk outside conventional CVE vulnerability databases."
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def render() -> None:
|
|
58
|
+
page_header(
|
|
59
|
+
"Suspicious Changes & Forensic Investigation",
|
|
60
|
+
"Multi-layer supply chain anomaly detection beyond conventional CVE/NVD databases (Person 2 - Phases 1, 2 & 3)."
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
r = get_result()
|
|
64
|
+
if not r:
|
|
65
|
+
require_result()
|
|
66
|
+
return
|
|
67
|
+
|
|
68
|
+
susp_data: Dict[str, Any] = r.get("suspicious_changes") or {}
|
|
69
|
+
|
|
70
|
+
findings: List[Dict[str, Any]] = susp_data.get("findings", [])
|
|
71
|
+
scenarios: List[Dict[str, Any]] = susp_data.get("correlated_scenarios", [])
|
|
72
|
+
ai_invs: List[Dict[str, Any]] = susp_data.get("ai_investigations", [])
|
|
73
|
+
metrics: Dict[str, Any] = susp_data.get("metrics", {})
|
|
74
|
+
|
|
75
|
+
# Build fast lookup map for AI investigations (compound key + fallback)
|
|
76
|
+
ai_map: Dict[Any, Dict[str, Any]] = {}
|
|
77
|
+
for inv in ai_invs:
|
|
78
|
+
fid = inv.get("finding_id", "")
|
|
79
|
+
aff = inv.get("affected_file", "")
|
|
80
|
+
if fid and aff:
|
|
81
|
+
ai_map[(fid, aff)] = inv
|
|
82
|
+
if fid and fid not in ai_map:
|
|
83
|
+
ai_map[fid] = inv
|
|
84
|
+
|
|
85
|
+
def _get_ai_data(finding_id: str, target_file: str) -> Optional[Dict[str, Any]]:
|
|
86
|
+
if (finding_id, target_file) in ai_map:
|
|
87
|
+
return ai_map[(finding_id, target_file)]
|
|
88
|
+
if finding_id in ai_map:
|
|
89
|
+
inv_candidate = ai_map[finding_id]
|
|
90
|
+
inv_aff = inv_candidate.get("affected_file", "")
|
|
91
|
+
if not inv_aff or not target_file or inv_aff == target_file:
|
|
92
|
+
return inv_candidate
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
# Extract legacy signals if available
|
|
96
|
+
risks = risk_by_id(r) if r else {}
|
|
97
|
+
pkg = (r.get("package_risk") or {}) if r else {}
|
|
98
|
+
pkg_findings = pkg.get("findings", [])
|
|
99
|
+
|
|
100
|
+
# --------------------------------------------------------------------------------------------------
|
|
101
|
+
# Top Metrics Banner
|
|
102
|
+
# --------------------------------------------------------------------------------------------------
|
|
103
|
+
total_count = len(findings) if findings else len(pkg_findings)
|
|
104
|
+
introduced_count = sum(1 for f in findings if f.get("change_origin") == "INTRODUCED_IN_RANGE")
|
|
105
|
+
high_crit_count = sum(1 for f in findings if f.get("severity") in ("CRITICAL", "HIGH"))
|
|
106
|
+
scenarios_count = len(scenarios)
|
|
107
|
+
ai_count = len(ai_invs)
|
|
108
|
+
|
|
109
|
+
benign_ai = sum(1 for inv in ai_invs if inv.get("verdict") == "BENIGN_EXPLANATION")
|
|
110
|
+
anomaly_ai = sum(1 for inv in ai_invs if inv.get("verdict") == "CONFIRMED_ANOMALY")
|
|
111
|
+
attack_ai = sum(1 for inv in ai_invs if inv.get("verdict") == "SUSPECTED_SUPPLY_CHAIN_ATTACK")
|
|
112
|
+
|
|
113
|
+
m_cols = st.columns(5)
|
|
114
|
+
m_cols[0].metric("Total Findings", total_count, help="All deterministic forensic indicators discovered across diffs, manifests, scripts, CI/CD and sources.")
|
|
115
|
+
m_cols[1].metric("Introduced in Diff", introduced_count, help="Findings introduced in the analyzed Git commit range vs pre-existing in baseline.")
|
|
116
|
+
m_cols[2].metric("High / Critical", high_crit_count, help="Findings with high or critical potential supply chain impact.")
|
|
117
|
+
m_cols[3].metric("Correlated Scenarios", scenarios_count, help="Multi-vector attack chains synthesizing disparate indicators.")
|
|
118
|
+
m_cols[4].metric("AI Disambiguated", ai_count, f"{benign_ai} Safe · {anomaly_ai} Anomaly · {attack_ai} Attack", help="Findings autonomously investigated by AI agent.")
|
|
119
|
+
|
|
120
|
+
st.markdown("---")
|
|
121
|
+
|
|
122
|
+
tab_titles = [
|
|
123
|
+
f"Unified View ({total_count})",
|
|
124
|
+
f"AI Investigations ({ai_count})",
|
|
125
|
+
f"Attack Chains ({scenarios_count})",
|
|
126
|
+
f"Forensic Evidence ({total_count})",
|
|
127
|
+
]
|
|
128
|
+
if pkg_findings:
|
|
129
|
+
tab_titles.append(f"Package Signals ({len(pkg_findings)})")
|
|
130
|
+
|
|
131
|
+
tabs = st.tabs(tab_titles)
|
|
132
|
+
tab_unified = tabs[0]
|
|
133
|
+
tab_ai = tabs[1]
|
|
134
|
+
tab_corr = tabs[2]
|
|
135
|
+
tab_det = tabs[3]
|
|
136
|
+
tab_pkg = tabs[4] if len(tabs) > 4 else None
|
|
137
|
+
|
|
138
|
+
# ==================================================================================================
|
|
139
|
+
# TAB 1: Unified Multi-Layer View
|
|
140
|
+
# ==================================================================================================
|
|
141
|
+
with tab_unified:
|
|
142
|
+
st.markdown("#### Complete Multi-Layer Supply Chain Findings")
|
|
143
|
+
st.caption("Consolidates deterministic facts, correlated attack chains, and AI verdicts.")
|
|
144
|
+
|
|
145
|
+
# Interactive Filters
|
|
146
|
+
f_col1, f_col2, f_col3, f_col4 = st.columns([2, 1, 1, 1])
|
|
147
|
+
search_query = f_col1.text_input("Search findings (ID, file, code, or explanation)", "", key="uni_search")
|
|
148
|
+
|
|
149
|
+
categories = ["All"] + sorted(list({f.get("category", "") for f in findings if f.get("category")}))
|
|
150
|
+
cat_filter = f_col2.selectbox("Category", categories, key="uni_cat")
|
|
151
|
+
|
|
152
|
+
severities = ["All", "HIGH", "MEDIUM", "LOW"]
|
|
153
|
+
sev_filter = f_col3.selectbox("Severity", severities, key="uni_sev")
|
|
154
|
+
|
|
155
|
+
verdicts = ["All", "BENIGN_EXPLANATION", "CONFIRMED_ANOMALY", "SUSPECTED_SUPPLY_CHAIN_ATTACK", "NOT_INVESTIGATED"]
|
|
156
|
+
verdict_filter = f_col4.selectbox("AI Verdict", verdicts, key="uni_verdict")
|
|
157
|
+
|
|
158
|
+
# Apply Filters
|
|
159
|
+
filtered = []
|
|
160
|
+
for f in findings:
|
|
161
|
+
fid = f.get("id", "")
|
|
162
|
+
f_cat = f.get("category", "")
|
|
163
|
+
f_sev = f.get("severity", "")
|
|
164
|
+
f_file = f.get("affected_file", "")
|
|
165
|
+
f_ev = str(f.get("evidence", ""))
|
|
166
|
+
f_exp = str(f.get("explanation") or f.get("technical_explanation") or "")
|
|
167
|
+
ai_data = _get_ai_data(fid, f_file)
|
|
168
|
+
ai_v = ai_data.get("verdict") if ai_data else "NOT_INVESTIGATED"
|
|
169
|
+
|
|
170
|
+
if search_query:
|
|
171
|
+
sq = search_query.lower()
|
|
172
|
+
if not (sq in fid.lower() or sq in f_file.lower() or sq in f_ev.lower() or sq in f_exp.lower()):
|
|
173
|
+
continue
|
|
174
|
+
if cat_filter != "All" and f_cat != cat_filter:
|
|
175
|
+
continue
|
|
176
|
+
if sev_filter != "All" and f_sev != sev_filter:
|
|
177
|
+
continue
|
|
178
|
+
if verdict_filter != "All":
|
|
179
|
+
if verdict_filter == "NOT_INVESTIGATED" and ai_data:
|
|
180
|
+
continue
|
|
181
|
+
if verdict_filter != "NOT_INVESTIGATED" and ai_v != verdict_filter:
|
|
182
|
+
continue
|
|
183
|
+
filtered.append(f)
|
|
184
|
+
|
|
185
|
+
st.caption(f"Showing **{len(filtered)}** of **{len(findings)}** findings matching filters.")
|
|
186
|
+
|
|
187
|
+
# Summary Dataframe
|
|
188
|
+
if filtered:
|
|
189
|
+
table_rows = []
|
|
190
|
+
for f in filtered:
|
|
191
|
+
fid = f.get("id", "")
|
|
192
|
+
f_file = f.get("affected_file", "")
|
|
193
|
+
ai_data = _get_ai_data(fid, f_file)
|
|
194
|
+
remaining = ai_data.get("remaining_security_risks", []) if ai_data else []
|
|
195
|
+
table_rows.append({
|
|
196
|
+
"Finding ID": fid,
|
|
197
|
+
"Detection Scope": f.get("detection_scope", "Non-CVE Risk"),
|
|
198
|
+
"Non-CVE Risk Type": _get_non_cve_scope(f),
|
|
199
|
+
"Category": f.get("category", ""),
|
|
200
|
+
"Initial Static Severity": f.get("severity", ""),
|
|
201
|
+
"Target File": f"{f.get('affected_file', '')}:{f.get('line_number', 1)}",
|
|
202
|
+
"Origin": f.get("change_origin", "PRE_EXISTING"),
|
|
203
|
+
"Autonomous AI Verdict": ai_data.get("verdict", "—") if ai_data else "— (Uninvestigated)",
|
|
204
|
+
"AI Confidence": ai_data.get("confidence", "—") if ai_data else "—",
|
|
205
|
+
"Specific Suspicion Resolved": ai_data.get("specific_suspicion_resolved", "—") if ai_data else "—",
|
|
206
|
+
"Remaining Security Risks": "; ".join(remaining) if remaining else "None",
|
|
207
|
+
"Maintenance Status": ai_data.get("maintenance_status", "ACTIVE") if ai_data else "—",
|
|
208
|
+
})
|
|
209
|
+
df(table_rows, height=280)
|
|
210
|
+
|
|
211
|
+
# Detailed Finding Cards
|
|
212
|
+
st.markdown("##### Detailed Forensic Evidence & AI Analysis")
|
|
213
|
+
for f in filtered:
|
|
214
|
+
fid = f.get("id", "")
|
|
215
|
+
f_title = f.get("title", fid)
|
|
216
|
+
f_sev = f.get("severity", "MEDIUM")
|
|
217
|
+
f_cat = f.get("category", "")
|
|
218
|
+
f_file = f.get("affected_file", "")
|
|
219
|
+
f_orig = f.get("change_origin", "PRE_EXISTING")
|
|
220
|
+
ai_data = _get_ai_data(fid, f_file)
|
|
221
|
+
|
|
222
|
+
# Clear status badge explaining Static Scan vs AI Disambiguation
|
|
223
|
+
if ai_data:
|
|
224
|
+
v = ai_data.get("verdict")
|
|
225
|
+
if v == "BENIGN_EXPLANATION":
|
|
226
|
+
status_tag = f"[RESOLVED] (Static: {f_sev})"
|
|
227
|
+
elif v == "SUSPECTED_SUPPLY_CHAIN_ATTACK":
|
|
228
|
+
status_tag = f"[SUSPECTED ATTACK] (Static: {f_sev})"
|
|
229
|
+
else:
|
|
230
|
+
status_tag = f"[CONFIRMED ANOMALY] (Static: {f_sev})"
|
|
231
|
+
exp_title = f"{status_tag} `{fid}` · {f_title}"
|
|
232
|
+
else:
|
|
233
|
+
exp_title = f"[{f_sev}] `{fid}` · {f_title}"
|
|
234
|
+
|
|
235
|
+
with st.expander(exp_title, expanded=False):
|
|
236
|
+
c1, c2, c3 = st.columns(3)
|
|
237
|
+
c1.markdown(f"**Category:** `{f_cat}`")
|
|
238
|
+
c2.markdown(f"**Target:** `{f.get('affected_file')}:{f.get('line_number')}`")
|
|
239
|
+
c3.markdown(f"**Origin:** `{'INTRODUCED IN COMMIT RANGE' if f_orig == 'INTRODUCED_IN_RANGE' else 'PRE-EXISTING IN REPOSITORY'}`")
|
|
240
|
+
|
|
241
|
+
st.markdown(f"**Security Scope:** `Non-CVE Supply Chain Risk` · **Mechanism:** `{_get_non_cve_scope(f)}`")
|
|
242
|
+
st.caption(f"**Why Non-CVE:** {_get_non_cve_rationale(f)}")
|
|
243
|
+
|
|
244
|
+
# Evidence snippet
|
|
245
|
+
ev = f.get("evidence")
|
|
246
|
+
if ev:
|
|
247
|
+
st.markdown("**Deterministic Forensic Evidence Excerpt:**")
|
|
248
|
+
st.code(ev if isinstance(ev, str) else "\n".join(ev), language="text")
|
|
249
|
+
|
|
250
|
+
# Technical explanations
|
|
251
|
+
exp_text = f.get("technical_explanation") or f.get("explanation")
|
|
252
|
+
if exp_text:
|
|
253
|
+
st.markdown(f"**Technical Explanation:** {exp_text}")
|
|
254
|
+
if f.get("potential_impact"):
|
|
255
|
+
st.markdown(f"**Potential Supply Chain Impact:** {f.get('potential_impact')}")
|
|
256
|
+
if f.get("recommended_action"):
|
|
257
|
+
st.info(f"**Recommended Action / Remediation:** {f.get('recommended_action')}")
|
|
258
|
+
|
|
259
|
+
# AI Investigation Layer (if investigated)
|
|
260
|
+
if ai_data:
|
|
261
|
+
st.markdown("---")
|
|
262
|
+
st.markdown("#### Autonomous AI Investigator Judgement")
|
|
263
|
+
v = ai_data.get("verdict", "UNCONFIRMED")
|
|
264
|
+
conf = ai_data.get("confidence", "UNKNOWN")
|
|
265
|
+
planner = ai_data.get("planner", "deterministic")
|
|
266
|
+
m_status = ai_data.get("maintenance_status")
|
|
267
|
+
rem_risks = ai_data.get("remaining_security_risks", [])
|
|
268
|
+
|
|
269
|
+
if v == "BENIGN_EXPLANATION":
|
|
270
|
+
st.success(f"**AI Verdict: {v}** ({conf} Confidence) · Verified by Grounding Gate", icon=":material/check_circle:")
|
|
271
|
+
st.info(
|
|
272
|
+
f"**Static Heuristic vs AI Resolution:** The deterministic scanner flagged this pattern as **{f_sev}** severity. "
|
|
273
|
+
f"The AI investigator resolved the specific attack suspicion as benign while keeping independent maintenance risks separated.",
|
|
274
|
+
icon=":material/info:",
|
|
275
|
+
)
|
|
276
|
+
elif v == "SUSPECTED_SUPPLY_CHAIN_ATTACK":
|
|
277
|
+
st.error(f"**AI Verdict: SUSPECTED SUPPLY CHAIN ATTACK ({v})** ({conf} Confidence) · Elevated from Static `{f_sev}`", icon=":material/error:")
|
|
278
|
+
else:
|
|
279
|
+
st.warning(f"**AI Verdict: CONFIRMED ANOMALY ({v})** ({conf} Confidence) · Verified Non-Standard Configuration", icon=":material/warning:")
|
|
280
|
+
|
|
281
|
+
if ai_data.get("specific_suspicion_resolved"):
|
|
282
|
+
st.success(f"**Specific Suspicion Resolved:** {ai_data.get('specific_suspicion_resolved')}", icon=":material/check_circle:")
|
|
283
|
+
|
|
284
|
+
if rem_risks:
|
|
285
|
+
st.warning("**Remaining Independent Security & Maintenance Risks:**", icon=":material/warning:")
|
|
286
|
+
for rr in rem_risks:
|
|
287
|
+
st.markdown(f"• {rr}")
|
|
288
|
+
|
|
289
|
+
if m_status:
|
|
290
|
+
st.markdown(f"**Ecosystem Maintenance Status:** `{m_status}`")
|
|
291
|
+
|
|
292
|
+
st.markdown(f"**Investigator Rationale:** {ai_data.get('rationale')}")
|
|
293
|
+
|
|
294
|
+
if ai_data.get("attack_scenario"):
|
|
295
|
+
st.warning(f"**Suspected Attack Scenario:** {ai_data.get('attack_scenario')}")
|
|
296
|
+
|
|
297
|
+
# Supporting vs Contradicting Factors
|
|
298
|
+
col_sup, col_con = st.columns(2)
|
|
299
|
+
with col_sup:
|
|
300
|
+
st.markdown("**Supporting Evidence (Suspicion Indicators):**")
|
|
301
|
+
for se in ai_data.get("supporting_evidence", []):
|
|
302
|
+
st.markdown(f"• **{se.get('factor')}:** {se.get('detail')}")
|
|
303
|
+
with col_con:
|
|
304
|
+
st.markdown("**Contradicting Evidence (Safe / Legitimate Indicators):**")
|
|
305
|
+
for ce in ai_data.get("contradicting_evidence", []):
|
|
306
|
+
st.markdown(f"• **{ce.get('factor')}:** {ce.get('detail')}")
|
|
307
|
+
|
|
308
|
+
# Collapsible Tool Execution Trace
|
|
309
|
+
steps = ai_data.get("investigation_steps", [])
|
|
310
|
+
if steps:
|
|
311
|
+
with st.expander(f"Investigation Steps ({len(steps)} steps)", expanded=False):
|
|
312
|
+
for s_idx, stp in enumerate(steps, 1):
|
|
313
|
+
st.markdown(f"**Step {s_idx}: `{stp.get('tool')}`**")
|
|
314
|
+
args_str = json.dumps(stp.get("args", {}), indent=2)
|
|
315
|
+
st.caption(f"Inputs: `{args_str}`")
|
|
316
|
+
res_str = str(stp.get("result", ""))
|
|
317
|
+
if len(res_str) > 300:
|
|
318
|
+
res_str = res_str[:300] + "... [truncated]"
|
|
319
|
+
st.code(res_str, language="json" if "{" in res_str else "text")
|
|
320
|
+
|
|
321
|
+
# ==================================================================================================
|
|
322
|
+
# TAB 2: Autonomous AI Investigations (Layer 3)
|
|
323
|
+
# ==================================================================================================
|
|
324
|
+
with tab_ai:
|
|
325
|
+
st.markdown("#### Autonomous AI Investigations (LangGraph Agent)")
|
|
326
|
+
st.caption(
|
|
327
|
+
f"**{len(ai_invs)}** high-priority findings investigated autonomously using read-only Git, AST, and filesystem tools. "
|
|
328
|
+
"All findings pass a strict Grounding Gate: zero unverified host breach claims, citations must match observed files, "
|
|
329
|
+
"and verdicts strictly follow allowed vocabulary."
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
if ai_invs:
|
|
333
|
+
ai_table = []
|
|
334
|
+
for inv in ai_invs:
|
|
335
|
+
rem = inv.get("remaining_security_risks", [])
|
|
336
|
+
ai_table.append({
|
|
337
|
+
"Finding ID": inv.get("finding_id"),
|
|
338
|
+
"Detection Scope": "Non-CVE Risk",
|
|
339
|
+
"Non-CVE Risk Type": _get_non_cve_scope(inv),
|
|
340
|
+
"Target": f"{inv.get('affected_file')}:{inv.get('line_number')}",
|
|
341
|
+
"Verdict": inv.get("verdict"),
|
|
342
|
+
"Confidence": inv.get("confidence"),
|
|
343
|
+
"Specific Suspicion Resolved": inv.get("specific_suspicion_resolved", "—"),
|
|
344
|
+
"Remaining Risks": "; ".join(rem) if rem else "None",
|
|
345
|
+
"Maintenance Status": inv.get("maintenance_status", "ACTIVE") or "ACTIVE",
|
|
346
|
+
"Supporting Factors": len(inv.get("supporting_evidence", [])),
|
|
347
|
+
"Contradicting Factors": len(inv.get("contradicting_evidence", [])),
|
|
348
|
+
})
|
|
349
|
+
df(ai_table, height=280)
|
|
350
|
+
|
|
351
|
+
st.markdown("##### Detailed Investigation Cards")
|
|
352
|
+
for inv in ai_invs:
|
|
353
|
+
v = inv.get("verdict", "UNCONFIRMED")
|
|
354
|
+
fid = inv.get("finding_id", "")
|
|
355
|
+
conf = inv.get("confidence", "UNKNOWN")
|
|
356
|
+
|
|
357
|
+
with st.expander(f"`{fid}` · {v} ({conf} Confidence)", expanded=False):
|
|
358
|
+
c1, c2, c3 = st.columns(3)
|
|
359
|
+
c1.markdown(f"**Target File:** `{inv.get('affected_file')}:{inv.get('line_number')}`")
|
|
360
|
+
c2.markdown(f"**Planner Model:** `{inv.get('planner', 'Gemini 2.5 Flash Lite')}`")
|
|
361
|
+
c3.markdown(f"**Maintenance Status:** `{inv.get('maintenance_status', 'ACTIVE') or 'ACTIVE'}`")
|
|
362
|
+
|
|
363
|
+
if inv.get("specific_suspicion_resolved"):
|
|
364
|
+
st.success(f"**Specific Suspicion Resolved:** {inv.get('specific_suspicion_resolved')}", icon=":material/check_circle:")
|
|
365
|
+
|
|
366
|
+
rem_risks = inv.get("remaining_security_risks", [])
|
|
367
|
+
if rem_risks:
|
|
368
|
+
st.warning("**Remaining Independent Security & Maintenance Risks:**", icon=":material/warning:")
|
|
369
|
+
for rr in rem_risks:
|
|
370
|
+
st.markdown(f"• {rr}")
|
|
371
|
+
|
|
372
|
+
st.markdown(f"**Autonomous Rationale:** {inv.get('rationale')}")
|
|
373
|
+
|
|
374
|
+
if inv.get("attack_scenario"):
|
|
375
|
+
st.error(f"**Suspected Attack Scenario:** {inv.get('attack_scenario')}")
|
|
376
|
+
|
|
377
|
+
cs1, cs2 = st.columns(2)
|
|
378
|
+
with cs1:
|
|
379
|
+
st.markdown("**Supporting Evidence (Suspicion Factors):**")
|
|
380
|
+
for se in inv.get("supporting_evidence", []):
|
|
381
|
+
st.markdown(f"• **{se.get('factor')}:** {se.get('detail')}")
|
|
382
|
+
with cs2:
|
|
383
|
+
st.markdown("**Contradicting Evidence (Safe / Legitimate Factors):**")
|
|
384
|
+
for ce in inv.get("contradicting_evidence", []):
|
|
385
|
+
st.markdown(f"• **{ce.get('factor')}:** {ce.get('detail')}")
|
|
386
|
+
|
|
387
|
+
# Collapsible Tool Execution Trace
|
|
388
|
+
steps = inv.get("investigation_steps", [])
|
|
389
|
+
if steps:
|
|
390
|
+
with st.expander(f"Investigation Steps ({len(steps)} steps)", expanded=False):
|
|
391
|
+
for s_idx, stp in enumerate(steps, 1):
|
|
392
|
+
st.markdown(f"**Step {s_idx}: `{stp.get('tool')}`**")
|
|
393
|
+
st.caption(f"Inputs: `{json.dumps(stp.get('args', {}))}`")
|
|
394
|
+
res_str = str(stp.get("result", ""))
|
|
395
|
+
if len(res_str) > 300:
|
|
396
|
+
res_str = res_str[:300] + "... [truncated]"
|
|
397
|
+
st.code(res_str, language="text")
|
|
398
|
+
|
|
399
|
+
if inv.get("recommended_action"):
|
|
400
|
+
st.info(f"**Recommended Action:** {inv.get('recommended_action')}")
|
|
401
|
+
else:
|
|
402
|
+
st.info("No autonomous AI investigations available.")
|
|
403
|
+
|
|
404
|
+
# ==================================================================================================
|
|
405
|
+
# TAB 3: Correlated Attack Chains (Layer 2)
|
|
406
|
+
# ==================================================================================================
|
|
407
|
+
with tab_corr:
|
|
408
|
+
st.markdown("#### Correlated Attack Chains (Multi-Vector Scenarios)")
|
|
409
|
+
st.caption(
|
|
410
|
+
f"**{len(scenarios)}** multi-vector attack scenarios synthesized by correlating disparate indicators "
|
|
411
|
+
"(e.g., combining Docker base image drift, unpinned CI actions, and unverified registry mirrors)."
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
if scenarios:
|
|
415
|
+
for sc in scenarios:
|
|
416
|
+
with st.expander(f"`{sc.get('composite_id')}` · {sc.get('scenario_name')} ({sc.get('severity')})", expanded=True, icon=":material/warning:"):
|
|
417
|
+
st.markdown(f"**MITRE ATT&CK Technique:** `{sc.get('attack_technique')}`")
|
|
418
|
+
st.markdown(f"**Suspected Scenario Narrative:** {sc.get('suspected_scenario')}")
|
|
419
|
+
st.markdown(f"**Contributing Findings:** `{', '.join(sc.get('primary_finding_ids', []))}`")
|
|
420
|
+
|
|
421
|
+
if sc.get("reasoning_chain"):
|
|
422
|
+
st.markdown("**Step-by-Step Reasoning Chain:**")
|
|
423
|
+
for step_no, step in enumerate(sc.get("reasoning_chain", []), 1):
|
|
424
|
+
st.markdown(f"{step_no}. {step}")
|
|
425
|
+
else:
|
|
426
|
+
st.info("No correlated attack chains synthesized for this scan.")
|
|
427
|
+
|
|
428
|
+
# ==================================================================================================
|
|
429
|
+
# TAB 4: Deterministic Forensic Evidence (Layer 1)
|
|
430
|
+
# ==================================================================================================
|
|
431
|
+
with tab_det:
|
|
432
|
+
st.markdown("#### Layer 1 Deterministic Forensic Evidence")
|
|
433
|
+
st.caption("Direct static findings from repository diffs, manifest verifiers, AST lifecycle scripts, CI/CD linters, and typosquatting detectors.")
|
|
434
|
+
|
|
435
|
+
cat_names = sorted(list({f.get("category", "") for f in findings if f.get("category")}))
|
|
436
|
+
if cat_names:
|
|
437
|
+
sub_tabs = st.tabs([f"{cat} ({sum(1 for f in findings if f.get('category') == cat)})" for cat in cat_names])
|
|
438
|
+
for idx, cat in enumerate(cat_names):
|
|
439
|
+
with sub_tabs[idx]:
|
|
440
|
+
cat_findings = [f for f in findings if f.get("category") == cat]
|
|
441
|
+
cat_rows = []
|
|
442
|
+
for cf in cat_findings:
|
|
443
|
+
cat_rows.append({
|
|
444
|
+
"ID": cf.get("id"),
|
|
445
|
+
"Detection Scope": "Non-CVE Risk",
|
|
446
|
+
"Non-CVE Risk Type": _get_non_cve_scope(cf),
|
|
447
|
+
"Severity": cf.get("severity"),
|
|
448
|
+
"Target": f"{cf.get('affected_file')}:{cf.get('line_number')}",
|
|
449
|
+
"Origin": cf.get("change_origin"),
|
|
450
|
+
"Confidence": cf.get("confidence"),
|
|
451
|
+
})
|
|
452
|
+
df(cat_rows, height=240)
|
|
453
|
+
|
|
454
|
+
for cf in cat_findings:
|
|
455
|
+
with st.expander(f"[{cf.get('severity')}] {cf.get('id')} · {cf.get('title')}", expanded=False):
|
|
456
|
+
st.markdown(f"**File:** `{cf.get('affected_file')}:{cf.get('line_number')}`")
|
|
457
|
+
st.markdown(f"**Explanation:** {cf.get('technical_explanation') or cf.get('explanation')}")
|
|
458
|
+
if cf.get("evidence"):
|
|
459
|
+
st.code(cf.get("evidence"), language="text")
|
|
460
|
+
if cf.get("recommended_action"):
|
|
461
|
+
st.info(f"**Remediation:** {cf.get('recommended_action')}")
|
|
462
|
+
else:
|
|
463
|
+
st.info("No deterministic forensic findings recorded.")
|
|
464
|
+
|
|
465
|
+
# ==================================================================================================
|
|
466
|
+
# TAB 5: Package Risk Signals (Legacy / Core Scanner)
|
|
467
|
+
# ==================================================================================================
|
|
468
|
+
if tab_pkg and pkg_findings:
|
|
469
|
+
with tab_pkg:
|
|
470
|
+
st.markdown("#### Core Scanner Package Risk Signals")
|
|
471
|
+
st.caption("Registry integrity, install-script presence, and deprecation signals from the core scan pipeline.")
|
|
472
|
+
|
|
473
|
+
pv = pkg.get("provenance") or {}
|
|
474
|
+
if pv:
|
|
475
|
+
st.caption(f"Build provenance published for {pv.get('attested', 0)} of {pv.get('with_registry_data', 0)} packages with registry data.")
|
|
476
|
+
|
|
477
|
+
pkg_rows = []
|
|
478
|
+
for pf in pkg_findings:
|
|
479
|
+
fid = pf.get("finding_id") or pf.get("id")
|
|
480
|
+
pkg_rows.append({
|
|
481
|
+
"ID": fid,
|
|
482
|
+
"Severity": pf.get("severity"),
|
|
483
|
+
"Signal": pf.get("rule_id") or pf.get("category"),
|
|
484
|
+
"Target": pf.get("subject") or pf.get("affected_file"),
|
|
485
|
+
"Finding": pf.get("title"),
|
|
486
|
+
"Risk": risks.get(fid, {}).get("label", pf.get("severity", ""))
|
|
487
|
+
})
|
|
488
|
+
df(pkg_rows, height=280)
|
|
489
|
+
|
|
490
|
+
for pf in pkg_findings[:20]:
|
|
491
|
+
fid = pf.get("finding_id") or pf.get("id")
|
|
492
|
+
rid = pf.get("rule_id") or pf.get("category")
|
|
493
|
+
with st.expander(f"{fid} · {rid} · {pf.get('title')}", expanded=False):
|
|
494
|
+
st.markdown(f"**Why it matters:** {pf.get('why') or pf.get('explanation')}")
|
|
495
|
+
if pf.get("remediation"):
|
|
496
|
+
st.markdown(f"**What to do:** {pf.get('remediation')}")
|
|
497
|
+
if pf.get("evidence"):
|
|
498
|
+
st.code(pf.get("evidence"))
|
|
499
|
+
|
|
500
|
+
# ==================================================================================================
|
|
501
|
+
# Modular Non-CVE Layers (Supply-Chain Anomalies, SAST/Taint, IaC)
|
|
502
|
+
# ==================================================================================================
|
|
503
|
+
if r:
|
|
504
|
+
sc_anom = r.get("supply_chain_anomalies") or []
|
|
505
|
+
sast_f = r.get("sast_findings") or []
|
|
506
|
+
iac_f = r.get("iac_findings") or []
|
|
507
|
+
if sc_anom or sast_f or iac_f:
|
|
508
|
+
st.markdown("---")
|
|
509
|
+
st.markdown("### Modular Non-CVE Detection Layers")
|
|
510
|
+
c1, c2, c3 = st.columns(3)
|
|
511
|
+
c1.metric("Supply-Chain Anomalies", len(sc_anom))
|
|
512
|
+
c2.metric("SAST / Taint Findings", len(sast_f))
|
|
513
|
+
c3.metric("IaC Security Findings", len(iac_f))
|
|
514
|
+
combined = [
|
|
515
|
+
{
|
|
516
|
+
"Layer": "Supply Chain",
|
|
517
|
+
"Rule": x.get("rule_id"),
|
|
518
|
+
"Severity": x.get("severity"),
|
|
519
|
+
"Confidence": x.get("confidence"),
|
|
520
|
+
"Classification": x.get("classification"),
|
|
521
|
+
"Title": x.get("title"),
|
|
522
|
+
"Target": x.get("package_name") or x.get("file_path") or "",
|
|
523
|
+
"Remediation": x.get("remediation_text") or "",
|
|
524
|
+
}
|
|
525
|
+
for x in sc_anom
|
|
526
|
+
] + [
|
|
527
|
+
{
|
|
528
|
+
"Layer": "SAST / Taint",
|
|
529
|
+
"Rule": x.get("rule_id"),
|
|
530
|
+
"Severity": x.get("severity"),
|
|
531
|
+
"Confidence": x.get("confidence"),
|
|
532
|
+
"Classification": x.get("classification"),
|
|
533
|
+
"Title": x.get("title"),
|
|
534
|
+
"Target": f"{x.get('file_path', '')}:{x.get('line', '')}".strip(":"),
|
|
535
|
+
"Remediation": x.get("remediation_text") or "",
|
|
536
|
+
}
|
|
537
|
+
for x in sast_f
|
|
538
|
+
] + [
|
|
539
|
+
{
|
|
540
|
+
"Layer": "IaC (K8s/TF)",
|
|
541
|
+
"Rule": x.get("rule_id"),
|
|
542
|
+
"Severity": x.get("severity"),
|
|
543
|
+
"Confidence": x.get("confidence"),
|
|
544
|
+
"Classification": x.get("classification"),
|
|
545
|
+
"Title": x.get("title"),
|
|
546
|
+
"Target": f"{x.get('file_path', '')}:{x.get('line', '')}".strip(":"),
|
|
547
|
+
"Remediation": x.get("remediation_text") or "",
|
|
548
|
+
}
|
|
549
|
+
for x in iac_f
|
|
550
|
+
]
|
|
551
|
+
df(combined, height=320)
|