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.
Files changed (212) hide show
  1. stackparity/__init__.py +17 -0
  2. stackparity/_engine/agents/investigator.py +294 -0
  3. stackparity/_engine/agents/memory_agent.py +37 -0
  4. stackparity/_engine/agents/pipeline_agent.py +152 -0
  5. stackparity/_engine/agents/remediation_agent.py +248 -0
  6. stackparity/_engine/agents/runtime.py +177 -0
  7. stackparity/_engine/agents/specialists.py +709 -0
  8. stackparity/_engine/agents/suspicious_change_agent.py +1275 -0
  9. stackparity/_engine/cli/__init__.py +2 -0
  10. stackparity/_engine/cli/main.py +1252 -0
  11. stackparity/_engine/cli/remediate.py +461 -0
  12. stackparity/_engine/cli/term.py +44 -0
  13. stackparity/_engine/config/__init__.py +0 -0
  14. stackparity/_engine/config/constants.py +88 -0
  15. stackparity/_engine/config/loader.py +155 -0
  16. stackparity/_engine/config/settings.py +108 -0
  17. stackparity/_engine/containers/__init__.py +12 -0
  18. stackparity/_engine/containers/discovery.py +143 -0
  19. stackparity/_engine/containers/models.py +72 -0
  20. stackparity/_engine/containers/trivy_image_scanner.py +165 -0
  21. stackparity/_engine/core/__init__.py +0 -0
  22. stackparity/_engine/core/capabilities.py +107 -0
  23. stackparity/_engine/core/finding_schema.py +305 -0
  24. stackparity/_engine/core/git_manager.py +206 -0
  25. stackparity/_engine/core/http.py +64 -0
  26. stackparity/_engine/core/models.py +109 -0
  27. stackparity/_engine/core/netpolicy.py +242 -0
  28. stackparity/_engine/core/plugins.py +43 -0
  29. stackparity/_engine/core/repository_inspector.py +243 -0
  30. stackparity/_engine/core/safe_env.py +48 -0
  31. stackparity/_engine/core/scan_orchestrator.py +289 -0
  32. stackparity/_engine/core/scan_state.py +58 -0
  33. stackparity/_engine/core/url_validator.py +135 -0
  34. stackparity/_engine/ecosystems/__init__.py +1 -0
  35. stackparity/_engine/ecosystems/registry.py +138 -0
  36. stackparity/_engine/evidence/__init__.py +1 -0
  37. stackparity/_engine/evidence/store.py +65 -0
  38. stackparity/_engine/explainability/__init__.py +0 -0
  39. stackparity/_engine/explainability/evidence_formatter.py +30 -0
  40. stackparity/_engine/explainability/explanation_engine.py +132 -0
  41. stackparity/_engine/explainability/explanation_validator.py +54 -0
  42. stackparity/_engine/explainability/prompt_templates.py +18 -0
  43. stackparity/_engine/graph/__init__.py +0 -0
  44. stackparity/_engine/graph/dependency_tracer.py +86 -0
  45. stackparity/_engine/graph/graph_builder.py +165 -0
  46. stackparity/_engine/graph/graph_diff.py +57 -0
  47. stackparity/_engine/graph/graph_exporter.py +194 -0
  48. stackparity/_engine/graph/graph_validator.py +46 -0
  49. stackparity/_engine/graph/impact_analyzer.py +23 -0
  50. stackparity/_engine/graph/tree_view.py +185 -0
  51. stackparity/_engine/intel/__init__.py +0 -0
  52. stackparity/_engine/intel/epss.py +53 -0
  53. stackparity/_engine/llm/__init__.py +1 -0
  54. stackparity/_engine/llm/client.py +138 -0
  55. stackparity/_engine/monitor/__init__.py +0 -0
  56. stackparity/_engine/monitor/watch.py +171 -0
  57. stackparity/_engine/non_cve/__init__.py +7 -0
  58. stackparity/_engine/non_cve/base.py +62 -0
  59. stackparity/_engine/non_cve/iac.py +144 -0
  60. stackparity/_engine/non_cve/sast.py +272 -0
  61. stackparity/_engine/non_cve/supply_chain.py +147 -0
  62. stackparity/_engine/orchestration/__init__.py +1 -0
  63. stackparity/_engine/orchestration/pipeline.py +279 -0
  64. stackparity/_engine/orchestration/supervisor.py +167 -0
  65. stackparity/_engine/pipeline_analysis/__init__.py +0 -0
  66. stackparity/_engine/pipeline_analysis/analyzer.py +90 -0
  67. stackparity/_engine/pipeline_analysis/ci.py +189 -0
  68. stackparity/_engine/pipeline_analysis/ci_adapters/__init__.py +24 -0
  69. stackparity/_engine/pipeline_analysis/ci_adapters/azure_pipelines.py +221 -0
  70. stackparity/_engine/pipeline_analysis/ci_adapters/base.py +239 -0
  71. stackparity/_engine/pipeline_analysis/ci_adapters/circleci.py +176 -0
  72. stackparity/_engine/pipeline_analysis/ci_adapters/github_actions.py +356 -0
  73. stackparity/_engine/pipeline_analysis/ci_adapters/gitlab_ci.py +268 -0
  74. stackparity/_engine/pipeline_analysis/ci_adapters/jenkins.py +180 -0
  75. stackparity/_engine/pipeline_analysis/ci_adapters/registry.py +80 -0
  76. stackparity/_engine/pipeline_analysis/ci_models.py +72 -0
  77. stackparity/_engine/pipeline_analysis/dockerfile.py +235 -0
  78. stackparity/_engine/pipeline_analysis/eol.py +62 -0
  79. stackparity/_engine/pipeline_analysis/models.py +37 -0
  80. stackparity/_engine/policy/__init__.py +0 -0
  81. stackparity/_engine/policy/engine.py +216 -0
  82. stackparity/_engine/policy/resources/default.yaml +56 -0
  83. stackparity/_engine/policy/resources/strict.yaml +35 -0
  84. stackparity/_engine/reachability/__init__.py +0 -0
  85. stackparity/_engine/reachability/app_reachability.py +186 -0
  86. stackparity/_engine/reachability/scanners.py +215 -0
  87. stackparity/_engine/remediation/__init__.py +0 -0
  88. stackparity/_engine/remediation/adapters.py +198 -0
  89. stackparity/_engine/remediation/apply_local.py +309 -0
  90. stackparity/_engine/remediation/code_fixes.py +383 -0
  91. stackparity/_engine/remediation/compat.py +156 -0
  92. stackparity/_engine/remediation/container_plan.py +127 -0
  93. stackparity/_engine/remediation/delivery.py +31 -0
  94. stackparity/_engine/remediation/export.py +44 -0
  95. stackparity/_engine/remediation/lifecycle.py +623 -0
  96. stackparity/_engine/remediation/local_trial.py +358 -0
  97. stackparity/_engine/remediation/patchers.py +215 -0
  98. stackparity/_engine/remediation/planner.py +285 -0
  99. stackparity/_engine/remediation/pr_template_engine.py +234 -0
  100. stackparity/_engine/remediation/reachability_impact.py +147 -0
  101. stackparity/_engine/remediation/versions.py +92 -0
  102. stackparity/_engine/remediation/whatif.py +64 -0
  103. stackparity/_engine/remediation/worktree_pr.py +434 -0
  104. stackparity/_engine/reporting/__init__.py +0 -0
  105. stackparity/_engine/reporting/counts.py +63 -0
  106. stackparity/_engine/reporting/fix_pdf.py +343 -0
  107. stackparity/_engine/reporting/fix_report.py +135 -0
  108. stackparity/_engine/reporting/json_exporter.py +61 -0
  109. stackparity/_engine/reporting/report_generator.py +200 -0
  110. stackparity/_engine/reporting/sarif.py +71 -0
  111. stackparity/_engine/reporting/vex.py +57 -0
  112. stackparity/_engine/reporting/view.py +166 -0
  113. stackparity/_engine/risk_analysis/__init__.py +0 -0
  114. stackparity/_engine/risk_analysis/contextual_scorer.py +253 -0
  115. stackparity/_engine/risk_analysis/evidence_collector.py +62 -0
  116. stackparity/_engine/risk_analysis/evidence_normalizer.py +37 -0
  117. stackparity/_engine/risk_analysis/finding_correlator.py +90 -0
  118. stackparity/_engine/risk_analysis/function_impact.py +184 -0
  119. stackparity/_engine/risk_analysis/production_context.py +252 -0
  120. stackparity/_engine/risk_analysis/risk_rules.py +81 -0
  121. stackparity/_engine/risk_analysis/risk_scorer.py +390 -0
  122. stackparity/_engine/sandbox/__init__.py +0 -0
  123. stackparity/_engine/sandbox/runner.py +142 -0
  124. stackparity/_engine/sbom/__init__.py +0 -0
  125. stackparity/_engine/sbom/adapters/__init__.py +19 -0
  126. stackparity/_engine/sbom/adapters/builtin.py +29 -0
  127. stackparity/_engine/sbom/adapters/syft.py +26 -0
  128. stackparity/_engine/sbom/adapters/trivy.py +76 -0
  129. stackparity/_engine/sbom/builtin_generator.py +227 -0
  130. stackparity/_engine/sbom/cyclonedx_validator.py +166 -0
  131. stackparity/_engine/sbom/exporters.py +153 -0
  132. stackparity/_engine/sbom/fusion/__init__.py +5 -0
  133. stackparity/_engine/sbom/fusion/engine.py +315 -0
  134. stackparity/_engine/sbom/fusion/hashes.py +47 -0
  135. stackparity/_engine/sbom/fusion/ledger.py +96 -0
  136. stackparity/_engine/sbom/fusion/registries.py +271 -0
  137. stackparity/_engine/sbom/fusion/resolver.py +143 -0
  138. stackparity/_engine/sbom/fusion/writer.py +114 -0
  139. stackparity/_engine/sbom/lockfile_analyzer.py +114 -0
  140. stackparity/_engine/sbom/merge.py +71 -0
  141. stackparity/_engine/sbom/package_extractors/common.py +104 -0
  142. stackparity/_engine/sbom/package_extractors/manifests.py +101 -0
  143. stackparity/_engine/sbom/package_extractors/npm.py +206 -0
  144. stackparity/_engine/sbom/package_extractors/others.py +267 -0
  145. stackparity/_engine/sbom/package_extractors/python.py +143 -0
  146. stackparity/_engine/sbom/quality_analyzer.py +191 -0
  147. stackparity/_engine/sbom/scanner_engine.py +98 -0
  148. stackparity/_engine/sbom/syft_runner.py +100 -0
  149. stackparity/_engine/sbom/tool_locator.py +69 -0
  150. stackparity/_engine/sbom/trivy_runner.py +82 -0
  151. stackparity/_engine/storage/__init__.py +0 -0
  152. stackparity/_engine/storage/cache.py +56 -0
  153. stackparity/_engine/storage/database.py +295 -0
  154. stackparity/_engine/storage/memory.py +146 -0
  155. stackparity/_engine/suspicious_changes/__init__.py +12 -0
  156. stackparity/_engine/suspicious_changes/analyzer.py +1022 -0
  157. stackparity/_engine/suspicious_changes/change_correlation.py +861 -0
  158. stackparity/_engine/suspicious_changes/lifecycle_script_detector.py +263 -0
  159. stackparity/_engine/suspicious_changes/lockfile_change_detector.py +316 -0
  160. stackparity/_engine/suspicious_changes/manifest_diff_detector.py +251 -0
  161. stackparity/_engine/suspicious_changes/package_risk.py +78 -0
  162. stackparity/_engine/suspicious_changes/popular_packages.py +94 -0
  163. stackparity/_engine/suspicious_changes/registry_detector.py +354 -0
  164. stackparity/_engine/suspicious_changes/suspicious_models.py +57 -0
  165. stackparity/_engine/suspicious_changes/typosquatting_detector.py +298 -0
  166. stackparity/_engine/tools/__init__.py +1 -0
  167. stackparity/_engine/tools/builtin.py +93 -0
  168. stackparity/_engine/tools/registry.py +66 -0
  169. stackparity/_engine/ui/__init__.py +0 -0
  170. stackparity/_engine/ui/components/__init__.py +0 -0
  171. stackparity/_engine/ui/components/common.py +238 -0
  172. stackparity/_engine/ui/components/live_progress.py +157 -0
  173. stackparity/_engine/ui/components/memory_panel.py +82 -0
  174. stackparity/_engine/ui/pages/__init__.py +0 -0
  175. stackparity/_engine/ui/pages/agents_page.py +76 -0
  176. stackparity/_engine/ui/pages/architecture_page.py +44 -0
  177. stackparity/_engine/ui/pages/fixes_page.py +98 -0
  178. stackparity/_engine/ui/pages/graph_page.py +203 -0
  179. stackparity/_engine/ui/pages/health_page.py +117 -0
  180. stackparity/_engine/ui/pages/monitor_page.py +67 -0
  181. stackparity/_engine/ui/pages/pipeline_page.py +219 -0
  182. stackparity/_engine/ui/pages/remediation_page.py +409 -0
  183. stackparity/_engine/ui/pages/reports_page.py +54 -0
  184. stackparity/_engine/ui/pages/sbom_page.py +210 -0
  185. stackparity/_engine/ui/pages/scan_page.py +131 -0
  186. stackparity/_engine/ui/pages/suspicious_page.py +551 -0
  187. stackparity/_engine/ui/pages/vulns_page.py +201 -0
  188. stackparity/_engine/ui/state.py +116 -0
  189. stackparity/_engine/ui/theme.py +201 -0
  190. stackparity/_engine/ui/visualizations/__init__.py +0 -0
  191. stackparity/_engine/ui/visualizations/graphs.py +373 -0
  192. stackparity/_engine/vulnerability/__init__.py +0 -0
  193. stackparity/_engine/vulnerability/cvss.py +58 -0
  194. stackparity/_engine/vulnerability/kev_client.py +47 -0
  195. stackparity/_engine/vulnerability/nvd_client.py +74 -0
  196. stackparity/_engine/vulnerability/osv_client.py +139 -0
  197. stackparity/_engine/vulnerability/remediation_engine.py +50 -0
  198. stackparity/_engine/vulnerability/verification.py +94 -0
  199. stackparity/_engine/vulnerability/version_matcher.py +299 -0
  200. stackparity/_engine/vulnerability/vulnerability_correlator.py +303 -0
  201. stackparity/_engine/vulnerability/vulnerability_models.py +64 -0
  202. stackparity/cli.py +30 -0
  203. stackparity/dashboard_app.py +95 -0
  204. stackparity/web_dist/assets/index-DRJYw2Du.css +1 -0
  205. stackparity/web_dist/assets/index-Q6LLpbEi.js +495 -0
  206. stackparity/web_dist/index.html +13 -0
  207. stackparity/web_server.py +533 -0
  208. stackparity-1.0.0.dist-info/METADATA +204 -0
  209. stackparity-1.0.0.dist-info/RECORD +212 -0
  210. stackparity-1.0.0.dist-info/WHEEL +4 -0
  211. stackparity-1.0.0.dist-info/entry_points.txt +2 -0
  212. stackparity-1.0.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,243 @@
1
+ """Static repository inspection: languages, ecosystems, manifests, frameworks, services.
2
+
3
+ Nothing here executes repository code. Symlinks are never followed and every read is confined to the repo root.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ import json
8
+ import os
9
+ import re
10
+ from pathlib import Path
11
+
12
+ from config.constants import (CI_FILE_PATTERNS, EXTENSION_LANGUAGES, FRAMEWORK_CONFIG_FILES, FRAMEWORK_HINTS,
13
+ IGNORED_DIRS, MARKUP_LANGUAGES)
14
+ from config.settings import Settings, get_settings
15
+ from core.models import FrameworkHit, InspectionResult, ManifestFile
16
+
17
+ try:
18
+ import tomllib
19
+ except ImportError: # pragma: no cover
20
+ import tomli as tomllib # type: ignore
21
+
22
+ def safe_read_text(root: Path, rel: str, max_bytes: int = 20 * 1024 * 1024) -> str | None:
23
+ """Read a text file confined to ``root``; returns None for symlinks, escapes, oversize or unreadable files."""
24
+ try:
25
+ root_r = root.resolve()
26
+ p = (root / rel)
27
+ if p.is_symlink():
28
+ return None
29
+ p = p.resolve()
30
+ p.relative_to(root_r) # raises ValueError on traversal
31
+ if not p.is_file() or p.stat().st_size > max_bytes:
32
+ return None
33
+ return p.read_text(encoding="utf-8", errors="replace")
34
+ except (OSError, ValueError):
35
+ return None
36
+
37
+
38
+ def _classify(name: str):
39
+ from ecosystems.registry import classify_manifest
40
+ return classify_manifest(name)
41
+
42
+
43
+ def walk_repo(root: Path, settings: Settings | None = None):
44
+ """Yield (relative_posix_path, size) for regular files, skipping ignored dirs and symlinks."""
45
+ s = settings or get_settings()
46
+ count = 0
47
+ for cur, dirs, files in os.walk(root, followlinks=False):
48
+ dirs[:] = [d for d in dirs if d not in IGNORED_DIRS and not os.path.islink(os.path.join(cur, d))]
49
+ for f in files:
50
+ fp = os.path.join(cur, f)
51
+ if os.path.islink(fp):
52
+ continue
53
+ count += 1
54
+ if count > s.max_files_walked:
55
+ return
56
+ try:
57
+ size = os.path.getsize(fp)
58
+ except OSError:
59
+ continue
60
+ yield Path(os.path.relpath(fp, root)).as_posix(), size
61
+
62
+
63
+ def _declared_names(root: Path, mf: ManifestFile) -> set[str]:
64
+ """Best-effort dependency names declared in a manifest (for framework hints)."""
65
+ text = safe_read_text(root, mf.path)
66
+ names: set[str] = set()
67
+ if text is None:
68
+ return names
69
+ try:
70
+ if mf.name == "package.json":
71
+ d = json.loads(text)
72
+ for k in ("dependencies", "devDependencies", "peerDependencies", "optionalDependencies"):
73
+ names |= set((d.get(k) or {}).keys())
74
+ elif mf.name == "composer.json":
75
+ d = json.loads(text)
76
+ names |= set((d.get("require") or {}).keys()) | set((d.get("require-dev") or {}).keys())
77
+ elif mf.name == "pyproject.toml":
78
+ d = tomllib.loads(text)
79
+ for dep in (d.get("project", {}).get("dependencies") or []):
80
+ names.add(re.split(r"[<>=!~\[; ]", dep, 1)[0].strip().lower())
81
+ for grp in (d.get("project", {}).get("optional-dependencies") or {}).values():
82
+ for dep in grp:
83
+ names.add(re.split(r"[<>=!~\[; ]", dep, 1)[0].strip().lower())
84
+ poetry = d.get("tool", {}).get("poetry", {})
85
+ names |= {n.lower() for n in (poetry.get("dependencies") or {})}
86
+ names |= {n.lower() for n in (poetry.get("dev-dependencies") or {})}
87
+ elif mf.name.startswith("requirements") and mf.name.endswith(".txt"):
88
+ for line in text.splitlines():
89
+ line = line.split("#", 1)[0].strip()
90
+ if line and not line.startswith("-"):
91
+ names.add(re.split(r"[<>=!~\[; ]", line, 1)[0].strip().lower())
92
+ elif mf.name == "Cargo.toml":
93
+ d = tomllib.loads(text)
94
+ names |= set((d.get("dependencies") or {}).keys())
95
+ elif mf.name == "go.mod":
96
+ for m in re.finditer(r"^\s*(?:require\s+)?([\w.\-]+\.[\w.\-]+/[^\s]+)\s+v", text, re.M):
97
+ names.add(m.group(1))
98
+ elif mf.name in ("pom.xml", "build.gradle", "build.gradle.kts") or mf.name.endswith("proj"):
99
+ names |= set(re.findall(r"[\w.\-]+", text)) # token bag; matched by substring below
100
+ except Exception:
101
+ pass
102
+ return names
103
+
104
+
105
+ def inspect_repository(root: Path, settings: Settings | None = None) -> InspectionResult:
106
+ s = settings or get_settings()
107
+ root = Path(root)
108
+ res = InspectionResult()
109
+ lang_files: dict[str, int] = {}
110
+ lang_bytes: dict[str, int] = {}
111
+ dockers, containers, ci, unsupported = [], [], [], set()
112
+ config_hits: list[FrameworkHit] = []
113
+ total = 0
114
+ for rel, size in walk_repo(root, s):
115
+ total += 1
116
+ name = rel.rsplit("/", 1)[-1]
117
+ folder = rel.rsplit("/", 1)[0] if "/" in rel else "."
118
+ ext = os.path.splitext(name)[1].lower()
119
+ if ext in EXTENSION_LANGUAGES:
120
+ lang = EXTENSION_LANGUAGES[ext]
121
+ lang_files[lang] = lang_files.get(lang, 0) + 1
122
+ lang_bytes[lang] = lang_bytes.get(lang, 0) + size
123
+ c = _classify(name)
124
+ if c:
125
+ res.manifests.append(ManifestFile(path=rel, name=name, kind=c[0], ecosystem=c[1], service_dir=folder))
126
+ if name == "Dockerfile" or name.startswith("Dockerfile.") or name.endswith(".dockerfile"):
127
+ dockers.append(rel)
128
+ if name in ("docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml", ".dockerignore"):
129
+ containers.append(rel)
130
+ if any(rel == p or rel.startswith(p) or rel.endswith("/" + p) for p in CI_FILE_PATTERNS):
131
+ ci.append(rel)
132
+ if name in FRAMEWORK_CONFIG_FILES:
133
+ config_hits.append(FrameworkHit(name=FRAMEWORK_CONFIG_FILES[name], ecosystem="", service_dir=folder,
134
+ evidence=f"config file {rel}"))
135
+ res.total_files = total
136
+ res.truncated = total > s.max_files_walked
137
+ res.languages = {l: {"files": lang_files[l], "bytes": lang_bytes[l]}
138
+ for l in sorted(lang_files, key=lambda k: -lang_bytes[k])}
139
+ res.dockerfiles, res.container_files, res.ci_files = sorted(dockers), sorted(containers), sorted(ci)
140
+ res.ecosystems = sorted({m.ecosystem for m in res.manifests})
141
+ from ecosystems.registry import support_level
142
+ for eco in res.ecosystems:
143
+ files = [m for m in res.manifests if m.ecosystem == eco]
144
+ if support_level(sorted({m.name for m in files})) == "detected-but-unsupported":
145
+ unsupported.update(f"{m.name} ({eco}) at {m.path}" for m in files)
146
+ res.unsupported = sorted(unsupported)
147
+
148
+ # Frameworks from dependency declarations (manifest evidence, not extensions)
149
+ seen = set()
150
+ for mf in res.manifests:
151
+ if mf.kind not in ("manifest", "lockfile") or mf.name.endswith(".lock"):
152
+ continue
153
+ declared = _declared_names(root, mf)
154
+ hints = FRAMEWORK_HINTS.get(mf.ecosystem, {})
155
+ low = {d.lower() for d in declared}
156
+ for key, fw in hints.items():
157
+ hit = key.lower() in low if mf.ecosystem not in ("Maven", "NuGet", "Packagist", "Go") else any(key.lower() in d for d in low)
158
+ if hit and (fw, mf.service_dir) not in seen:
159
+ seen.add((fw, mf.service_dir))
160
+ res.frameworks.append(FrameworkHit(name=fw, ecosystem=mf.ecosystem, service_dir=mf.service_dir,
161
+ evidence=f"dependency declared in {mf.path}"))
162
+ for h in config_hits:
163
+ if (h.name, h.service_dir) not in seen:
164
+ seen.add((h.name, h.service_dir))
165
+ res.frameworks.append(h)
166
+
167
+ # Services: every directory holding a manifest/lockfile
168
+ svc: dict[str, dict] = {}
169
+ for mf in res.manifests:
170
+ d = svc.setdefault(mf.service_dir, {"dir": mf.service_dir, "ecosystems": set(), "files": [], "frameworks": []})
171
+ d["ecosystems"].add(mf.ecosystem)
172
+ d["files"].append(mf.path)
173
+ for h in res.frameworks:
174
+ if h.service_dir in svc and h.name not in svc[h.service_dir]["frameworks"]:
175
+ svc[h.service_dir]["frameworks"].append(h.name)
176
+ res.services = [{**v, "ecosystems": sorted(v["ecosystems"])} for _, v in sorted(svc.items())]
177
+
178
+ if not res.manifests:
179
+ res.limitations.append("No dependency manifests or lockfiles were found; SBOM coverage will be limited.")
180
+ if res.truncated:
181
+ res.limitations.append(f"File walk truncated at {s.max_files_walked} files.")
182
+ if res.unsupported:
183
+ res.limitations.append("Detected but not parsed by the built-in engine: " + "; ".join(res.unsupported))
184
+ if res.dockerfiles or res.container_files:
185
+ res.limitations.append("Container definitions are analysed statically. Images are never built; image contents are scanned only when container scanning is enabled and Trivy is installed.")
186
+ return res
187
+
188
+
189
+ def own_package_identities(root: Path, inspection: InspectionResult) -> dict[str, set[tuple[str, str | None]]]:
190
+ """{service_dir: {(name, version)}} for the application's *own* packages, read from its manifests.
191
+
192
+ Syft reports the project itself as a component (e.g. from the lockfile root entry). It is the application, not a
193
+ dependency, so it must not be matched against vulnerability databases or shown as a source package.
194
+ """
195
+ out: dict[str, set[tuple[str, str | None]]] = {}
196
+ for mf in inspection.manifests:
197
+ if mf.kind != "manifest":
198
+ continue
199
+ text = safe_read_text(root, mf.path)
200
+ if text is None:
201
+ continue
202
+ try:
203
+ if mf.name in ("package.json", "composer.json"):
204
+ d = json.loads(text)
205
+ if d.get("name"):
206
+ out.setdefault(mf.service_dir, set()).add((str(d["name"]).lower() if mf.name == "composer.json" else str(d["name"]), d.get("version")))
207
+ elif mf.name == "pyproject.toml":
208
+ d = tomllib.loads(text)
209
+ proj = d.get("project") or d.get("tool", {}).get("poetry") or {}
210
+ if proj.get("name"):
211
+ out.setdefault(mf.service_dir, set()).add((re.sub(r"[-_.]+", "-", proj["name"]).lower(), proj.get("version")))
212
+ elif mf.name == "Cargo.toml":
213
+ pkg = tomllib.loads(text).get("package") or {}
214
+ if pkg.get("name"):
215
+ out.setdefault(mf.service_dir, set()).add((pkg["name"], pkg.get("version") if isinstance(pkg.get("version"), str) else None))
216
+ elif mf.name == "pom.xml":
217
+ import xml.etree.ElementTree as ET
218
+ root_el = ET.fromstring(re.sub(r"<\?xml[^>]*\?>", "", text, count=1))
219
+ loc = lambda e: e.tag.split("}")[-1] # noqa: E731
220
+ vals = {loc(c): (c.text or "").strip() for c in root_el if loc(c) in ("groupId", "artifactId", "version")}
221
+ if vals.get("artifactId"):
222
+ out.setdefault(mf.service_dir, set()).add((f"{vals.get('groupId', '')}:{vals['artifactId']}", vals.get("version")))
223
+ except Exception:
224
+ continue
225
+ return out
226
+
227
+
228
+ def service_for_path(path: str, services: list[str]) -> str:
229
+ """Nearest ancestor service directory for a repo-relative file path ('.' = root)."""
230
+ best, best_len = ".", -1
231
+ for d in services:
232
+ if d == ".":
233
+ if best_len < 0:
234
+ best, best_len = ".", 0
235
+ continue
236
+ if path == d or path.startswith(d.rstrip("/") + "/"):
237
+ if len(d) > best_len:
238
+ best, best_len = d, len(d)
239
+ return best
240
+
241
+
242
+ def headline_languages(res: InspectionResult) -> list[str]:
243
+ return [l for l in res.languages if l not in MARKUP_LANGUAGES]
@@ -0,0 +1,48 @@
1
+ """Minimal environments for subprocesses and a process-wide rate limiter.
2
+
3
+ Git, Syft and Trivy are pointed at untrusted repositories. They never need the scanner's secrets (``ANTHROPIC_API_KEY``,
4
+ ``NVD_API_KEY`` ...), so they get an allow-listed environment instead of ``os.environ``.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ import threading
10
+ import time
11
+
12
+ _ALLOW = {
13
+ "PATH", "PATHEXT", "SYSTEMROOT", "WINDIR", "COMSPEC", "HOME", "USERPROFILE", "HOMEDRIVE", "HOMEPATH", "APPDATA", "LOCALAPPDATA",
14
+ "TEMP", "TMP", "TMPDIR", "LANG", "LC_ALL", "SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE", "GIT_SSL_CAINFO",
15
+ "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy", "PROGRAMDATA", "PROGRAMFILES", "PROGRAMFILES(X86)",
16
+ }
17
+
18
+
19
+ def scrubbed_env(extra: dict[str, str] | None = None, operation: str = "package_manager") -> dict[str, str]:
20
+ """Allow-listed copy of the environment (case-insensitive on Windows) plus ``extra``.
21
+
22
+ Telemetry and self-update checks are always switched off. When the active execution policy does not allow ``operation``,
23
+ every supported package manager's offline switch is set as well (see ``core.netpolicy``)."""
24
+ from core import netpolicy
25
+ allow = {k.upper() for k in _ALLOW}
26
+ env = netpolicy.subprocess_env({k: v for k, v in os.environ.items() if k.upper() in allow}, operation=operation)
27
+ env.update(extra or {})
28
+ return env
29
+
30
+
31
+ class RateLimiter:
32
+ """Process-wide minimum interval per key, shared by every scan/thread (e.g. NVD's public rate limit)."""
33
+
34
+ def __init__(self) -> None:
35
+ self._lock = threading.Lock()
36
+ self._next: dict[str, float] = {}
37
+
38
+ def wait(self, key: str, min_interval: float) -> None:
39
+ with self._lock:
40
+ now = time.monotonic()
41
+ at = max(now, self._next.get(key, 0.0))
42
+ self._next[key] = at + min_interval
43
+ delay = at - now
44
+ if delay > 0:
45
+ time.sleep(delay)
46
+
47
+
48
+ LIMITER = RateLimiter()
@@ -0,0 +1,289 @@
1
+ """Supervisor: runs the multi-agent scan pipeline.
2
+
3
+ The Supervisor validates input, owns the isolated workspace, builds the plan from what Recon discovers, runs the
4
+ specialist agents in order, observes each result and adapts (fallback inventory when Syft fails, OSV retry, NVD
5
+ prioritisation, escalation of correlated detections) and finally cleans up. Every observation and decision is recorded
6
+ in ``result["agent_trace"]`` and streamed to ``on_event`` for the live progress UI.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import calendar
11
+ import hashlib
12
+ import json
13
+ import platform
14
+ import time
15
+ import uuid
16
+ from dataclasses import dataclass, replace
17
+ from pathlib import Path
18
+ from typing import Any, Callable, Optional
19
+
20
+ import networkx as nx
21
+
22
+ from agents.runtime import AGENT_ROLES, AGENTS, STEPS, Runtime
23
+ from agents.specialists import ScanState
24
+ from config.settings import Settings, get_settings
25
+ from core import git_manager as gm
26
+ from core import netpolicy
27
+ from core.http import HttpClient
28
+ from core.models import RepoInfo
29
+ from core.repository_inspector import headline_languages
30
+ from core.url_validator import looks_like_local_path, resolve_local_path, validate_github_url, validate_ref
31
+ from reporting import json_exporter
32
+ from orchestration.supervisor import SCANNER_VERSION, cleanup as _cleanup
33
+ from risk_analysis.risk_rules import RULES_VERSION, load_rules
34
+ from storage.cache import Cache
35
+ from storage.database import Database
36
+
37
+
38
+ OnEvent = Callable[[dict], None]
39
+
40
+
41
+ @dataclass
42
+ class ScanOptions:
43
+ url: str = ""
44
+ ref: Optional[str] = None
45
+ use_nvd: bool = True
46
+ use_kev: bool = True
47
+ registry_checks: bool = True
48
+ lockfile_commits: int = 1
49
+ baseline: Optional[str] = None
50
+ keep_workspace: bool = False
51
+ reuse_cached: bool = True
52
+ use_llm: bool = False
53
+ rules_path: Optional[str] = None
54
+ sbom_scanner: str = "auto" # auto | syft | trivy | builtin
55
+ remediate: bool = True # Remediation + Validator agents
56
+ investigate: bool = True # Investigator Agent: reachability + EPSS + verdicts
57
+ metadata_registry: bool = True # fill missing metadata / verify digests against package registries
58
+ offline: bool = False
59
+ policy: str = "default"
60
+ cancelled: Optional[Callable[[], bool]] = None
61
+
62
+ @classmethod
63
+ def for_profile(cls, url: str, *, deep: bool = False, offline: bool = False, **overrides: Any) -> "ScanOptions":
64
+ """The single definition of a standard and a deep scan, shared by the CLI and the dashboard.
65
+
66
+ Standard: inventory, OSV matching, non-CVE analysis and remediation planning; a stored scan of the same commit is
67
+ reused. Deep adds NVD, CISA KEV and package-registry look-ups and always rescans. Offline disables network use.
68
+ """
69
+ remote = deep and not offline
70
+ base: dict[str, Any] = dict(url=url, offline=offline, use_nvd=remote, use_kev=remote, registry_checks=remote,
71
+ metadata_registry=remote, investigate=True, remediate=True, reuse_cached=not deep)
72
+ base.update(overrides)
73
+ return cls(**base)
74
+
75
+
76
+ _FP_FIELDS = ("offline", "policy", "use_nvd", "use_kev", "investigate", "remediate", "metadata_registry", "registry_checks", "lockfile_commits", "baseline", "use_llm", "rules_path")
77
+
78
+
79
+ def options_fingerprint(o: "ScanOptions") -> str:
80
+ """Hash of every option that changes the analysis result (not of url/ref/keep/reuse/scanner choice)."""
81
+ return hashlib.sha256(json.dumps({k: getattr(o, k) for k in _FP_FIELDS}, sort_keys=True, default=str).encode()).hexdigest()[:16]
82
+
83
+
84
+ def _age_s(ts: str) -> float:
85
+ try:
86
+ return time.time() - calendar.timegm(time.strptime(ts, "%Y-%m-%dT%H:%M:%SZ"))
87
+ except (ValueError, TypeError):
88
+ return float("inf")
89
+
90
+
91
+ def reusable(res: Optional[dict], options: "ScanOptions", s: Settings) -> tuple[bool, str]:
92
+ """A stored scan may be reused only if it is fresh and was produced by the same code, rules and options."""
93
+ if not res:
94
+ return False, "no stored scan"
95
+ if res.get("status") != "completed":
96
+ return False, "stored scan incomplete"
97
+ if res.get("vulnerabilities") and not res.get("risk_assessments"):
98
+ return False, "stored scan is missing risk assessments (incomplete scoring)"
99
+ age = _age_s((res.get("repo") or {}).get("scan_timestamp", ""))
100
+ if age > s.scan_cache_ttl_s:
101
+ return False, f"stored scan is older than {s.scan_cache_ttl_s // 3600}h (new advisories may exist)"
102
+ if (res.get("tool_versions") or {}).get("scanner") != SCANNER_VERSION or res.get("risk_rules_version") != RULES_VERSION:
103
+ return False, "scanner or risk-rule version changed"
104
+ if res.get("options_fp") != options_fingerprint(options):
105
+ return False, "scan options differ"
106
+ tool = res.get("sbom_tool") or {}
107
+ if not (tool.get("used") and res.get("sbom_path") and Path(res["sbom_path"]).exists()):
108
+ return False, "stored scan has no SBOM file"
109
+ if options.sbom_scanner not in ("auto", None) and tool.get("used") != options.sbom_scanner:
110
+ return False, "a different SBOM scanner was used"
111
+ return True, f"{int(age // 60)} min old"
112
+
113
+
114
+ def _now() -> str:
115
+ return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
116
+
117
+
118
+ def _safe_name(s: str) -> str:
119
+ return "".join(ch if ch.isalnum() or ch in "-_." else "-" for ch in s)[:60]
120
+
121
+
122
+ class _Ctx:
123
+ def __init__(self, settings: Settings, db: Database, offline: bool = False):
124
+ self.s, self.db = settings, db
125
+ self.cache = Cache(db)
126
+ self.http = HttpClient(timeout=settings.http_timeout_s, retries=settings.http_retries, offline=offline)
127
+
128
+
129
+ def friendly_clone_error(raw: str, ref: Optional[str]) -> str:
130
+ """Translate raw git failures into actionable messages."""
131
+ low = raw.lower()
132
+ if "timed out" in low:
133
+ return "The clone timed out. The repository is probably too large for the 3-minute clone limit; try a smaller repository or a specific branch."
134
+ if "remote branch" in low and "not found" in low:
135
+ return f"Branch or tag '{ref}' does not exist in this repository. Leave the branch field empty to use the default branch."
136
+ if any(k in low for k in ("not found", "could not read username", "authentication failed", "terminal prompts disabled", "repository access blocked")):
137
+ return "Repository not found, or it is private. Only public GitHub repositories are supported (check the owner/name spelling)."
138
+ if any(k in low for k in ("could not resolve host", "unable to access", "connection", "ssl", "tls")):
139
+ return "GitHub could not be reached (network problem). Check your internet connection or proxy and try again."
140
+ if "size limit" in low:
141
+ return raw
142
+ return "Clone failed: " + raw[:300]
143
+
144
+
145
+ def resolve_remote_sha(url: str, ref: str | None) -> Optional[str]:
146
+ try:
147
+ out = gm.run_git(["ls-remote", "--", url, ref or "HEAD"], timeout=30).stdout.split()
148
+ return out[0] if out else None
149
+ except gm.GitError:
150
+ return None
151
+
152
+
153
+ # ============================================================================================ entry points
154
+ def _legacy_progress(progress: Optional[Callable]) -> Optional[OnEvent]:
155
+ """Adapter so callers written for the old ``progress(stage, fraction, message)`` callback keep working."""
156
+ if progress is None:
157
+ return None
158
+ return lambda e: progress(e["step"], e["progress"], e["message"])
159
+
160
+
161
+ def run_scan(options: ScanOptions, settings: Settings | None = None, db: Database | None = None,
162
+ on_event: Optional[OnEvent] = None, progress: Optional[Callable] = None, **_ignored: Any) -> dict[str, Any]:
163
+ """Scan a public GitHub repository with the agent pipeline (``progress`` is a deprecated alias of ``on_event``)."""
164
+ on_event = on_event or _legacy_progress(progress)
165
+ s = settings or get_settings()
166
+ db = db or Database(s.db_path)
167
+ if options.offline and options.url.replace(chr(92), "/").startswith("//"):
168
+ raise ValueError("Offline scans require a local filesystem")
169
+ if looks_like_local_path(options.url):
170
+ try:
171
+ local = resolve_local_path(options.url)
172
+ except Exception as e:
173
+ Runtime(on_event).fail("validate", str(e))
174
+ raise
175
+ return scan_local_directory(local, options, s, db, on_event=on_event)
176
+ if options.offline:
177
+ raise ValueError("Offline scans require a local directory")
178
+ rt = Runtime(on_event)
179
+ rt.begin("validate", "Validating the repository URL (HTTPS GitHub, no credentials) or a local project folder path")
180
+ try:
181
+ repo_ref = validate_github_url(options.url)
182
+ ref = validate_ref(options.ref) or repo_ref.ref
183
+ except Exception as e:
184
+ rt.fail("validate", str(e))
185
+ raise
186
+ rt.done("validate", f"Accepted {repo_ref.web_url}" + (f" @ {ref}" if ref else ""))
187
+ if options.reuse_cached:
188
+ sha = resolve_remote_sha(repo_ref.clone_url, ref)
189
+ cached = db.find_scan(repo_ref.web_url, sha) if sha else None
190
+ res = db.load_scan(cached) if cached else None
191
+ ok, why = reusable(res, options, s)
192
+ if cached and not ok:
193
+ rt.observe("validate", f"A stored scan of this commit exists but is not reused: {why}")
194
+ if ok:
195
+ rt.decide("validate", f"Reuse the stored scan of commit {sha[:10]} ({why})", reason="Identical commit, same scanner/rules/options and still fresh; untick 'Reuse cached scan' to force a rescan.", agent="Supervisor")
196
+ for step in rt.status:
197
+ if rt.status[step] == "pending":
198
+ rt.skip(step, "reused stored result")
199
+ res["from_cache"] = True
200
+ return res
201
+ from core.plugins import load_plugins
202
+ load_plugins()
203
+ gm.reap_stale_workspaces(s)
204
+ try:
205
+ Cache(db).maintain(s.cache_max_age_days, s.cache_max_rows)
206
+ except Exception:
207
+ pass # cache upkeep must never block a scan
208
+ scan_id, ws = gm.new_workspace(s)
209
+ ctx = _Ctx(s, db)
210
+ result: dict[str, Any] = {}
211
+ try:
212
+ with rt.step("clone", f"git clone --depth {s.clone_depth} (no submodules, no hooks) into {ws}") as b:
213
+ repo_dir = gm.clone_repository(repo_ref, ws, ref, s)
214
+ b["message"] = f"cloned into isolated workspace {repo_dir}"
215
+ if rt.status["clone"] == "error":
216
+ for step in rt.status:
217
+ if rt.status[step] == "pending":
218
+ rt.skip(step, "clone failed")
219
+ gm.cleanup(ws)
220
+ return {"status": "failed", "error": friendly_clone_error(rt.errors[-1]["error"], ref), "agent_trace": rt.trace(),
221
+ "repo": {"scan_id": scan_id, "url": repo_ref.web_url, "name": repo_ref.name, "ref": ref, "commit_sha": "", "scan_timestamp": _now()}}
222
+ info = RepoInfo(scan_id=scan_id, url=repo_ref.web_url, name=repo_ref.name, owner=repo_ref.owner, ref=ref,
223
+ branch=gm.current_branch(repo_dir) or ref, commit_sha=gm.head_sha(repo_dir), scan_timestamp=_now(),
224
+ shallow=gm.is_shallow(repo_dir), source="github")
225
+ info.local_path = str(repo_dir)
226
+ rt.observe("clone", f"Commit {info.commit_sha[:12]} on branch {info.branch}; shallow clone: {info.shallow}; stored at {ws}")
227
+ result = analyze(repo_dir, info, options, ctx, rt, git_history=True, workspace=ws)
228
+ return result
229
+ finally:
230
+ if rt.status["cleanup"] == "pending":
231
+ _cleanup(rt, ws, options.keep_workspace, result)
232
+
233
+
234
+ def scan_local_directory(path: Path, options: ScanOptions | None = None, settings: Settings | None = None, db: Database | None = None,
235
+ on_event: Optional[OnEvent] = None, name: str | None = None, progress: Optional[Callable] = None) -> dict[str, Any]:
236
+ """Analyse an existing local project folder in place (read-only; nothing is cloned or copied)."""
237
+ on_event = on_event or _legacy_progress(progress)
238
+ options = options or ScanOptions()
239
+ s = settings or get_settings()
240
+ db = db or Database(s.db_path)
241
+ rt = Runtime(on_event)
242
+ if options.offline:
243
+ if options.sbom_scanner not in ("auto", "builtin"):
244
+ raise ValueError("Offline scans require the built-in SBOM scanner")
245
+ options = replace(options, sbom_scanner="builtin", use_llm=False, use_nvd=False, use_kev=False,
246
+ metadata_registry=False, registry_checks=False)
247
+ s = replace(s, container_scan_enabled=False, llm_api_key=None)
248
+ path = Path(path).resolve()
249
+ from core.plugins import load_plugins
250
+ load_plugins() # before inspection, so plugin ecosystems are recognised
251
+ try:
252
+ top = gm.run_git(["rev-parse", "--show-toplevel"], cwd=path, check=False).stdout.strip()
253
+ except gm.GitError:
254
+ top = ""
255
+ rt.warn("validate", "Git unavailable; scanning files without revision history.")
256
+ is_top = bool(top) and Path(top).resolve() == path
257
+ sha = gm.run_git(["rev-parse", "HEAD"], cwd=path, check=False).stdout.strip() if top else ""
258
+ info = RepoInfo(scan_id=uuid.uuid4().hex[:12], url=f"local:{path.as_posix()}", name=name or path.name, ref=options.ref,
259
+ branch=gm.current_branch(path) if is_top else None,
260
+ commit_sha=(sha if is_top else (sha + " (enclosing repository HEAD; scanned path is a subdirectory)" if sha else "unversioned")),
261
+ scan_timestamp=_now(), shallow=gm.is_shallow(path) if is_top else False, source="local")
262
+ info.local_path = str(path)
263
+ rt.done("validate", f"Accepted local folder {path}")
264
+ rt.skip("clone", "scanning an existing local directory")
265
+ return analyze(path, info, options, _Ctx(s, db, options.offline), rt, git_history=is_top, workspace=None)
266
+
267
+
268
+ # ============================================================================================ pipeline
269
+
270
+
271
+ def analyze(repo_dir: Path, info: RepoInfo, options: ScanOptions, ctx: _Ctx, rt: Runtime, git_history: bool, workspace: Optional[Path]) -> dict[str, Any]:
272
+ """Run the LangGraph agent pipeline (see ``orchestration/pipeline.py``) on an already-acquired working tree."""
273
+ from orchestration.pipeline import run_pipeline
274
+ st = ScanState(repo_dir=repo_dir, info=info, options=options, ctx=ctx, rules=load_rules(options.rules_path), git_history=git_history)
275
+ st.prefix = f"{info.scan_id}-{_safe_name(info.name)}"
276
+ st.result = {"status": "running", "repo": info.model_dump(), "from_cache": False, "limitations": [], "options_fp": options_fingerprint(options)}
277
+ policy = netpolicy.ExecutionPolicy(mode="offline", origin="scan --offline") if options.offline else netpolicy.ExecutionPolicy(origin="scan")
278
+ # persisted with the result: remediation, validation and publication of this scan inherit it
279
+ st.result["execution_policy"] = policy.to_dict()
280
+ if options.offline:
281
+ st.result["limitations"].append("Offline scan: live advisory matching and remote enrichment were skipped. CVE coverage is incomplete.")
282
+ st.result["source_status"] = {"OSV": {"state": "offline"}}
283
+ from core.plugins import load_plugins
284
+ st.result["plugins"] = load_plugins()
285
+ for plugin in st.result["plugins"]:
286
+ if plugin["status"] == "error":
287
+ st.result["limitations"].append(f"Plugin '{plugin['name']}' failed to load: {plugin['error']}")
288
+ with netpolicy.use(policy):
289
+ return run_pipeline(st, rt, workspace)
@@ -0,0 +1,58 @@
1
+ """Shared scan state passed across LangGraph pipeline nodes."""
2
+ from __future__ import annotations
3
+
4
+ from dataclasses import dataclass, field
5
+ from pathlib import Path
6
+ from typing import Any, Optional
7
+
8
+ import networkx as nx
9
+
10
+ from core.models import Component, InspectionResult, LockDependency, RepoInfo
11
+ from evidence.store import EvidenceStore
12
+ from vulnerability.osv_client import OsvClient
13
+
14
+
15
+ @dataclass
16
+ class ScanState:
17
+ repo_dir: Path
18
+ info: RepoInfo
19
+ options: Any
20
+ ctx: Any # settings, db, cache, http
21
+ rules: dict
22
+ git_history: bool = True
23
+ result: dict = field(default_factory=dict)
24
+ insp: InspectionResult = field(default_factory=InspectionResult)
25
+ service_dirs: list[str] = field(default_factory=lambda: ["."])
26
+ lock_deps: list[LockDependency] = field(default_factory=list)
27
+ lock_errors: list[dict] = field(default_factory=list)
28
+ syft: Any = None
29
+ sbom_tool: dict = field(default_factory=dict)
30
+ fused_path: Optional[str] = None
31
+ fusion: dict = field(default_factory=dict)
32
+ pkgrisk: dict = field(default_factory=lambda: {"findings": [], "provenance": {}})
33
+ pipe: dict = field(default_factory=lambda: {"findings": [], "images": [], "actions": [], "files": [], "summary": {}})
34
+ evidence: EvidenceStore = field(default_factory=EvidenceStore)
35
+ source_index: Any = None
36
+ epss: dict = field(default_factory=dict)
37
+ investigations: dict = field(default_factory=dict)
38
+ remediation: dict = field(default_factory=dict)
39
+ rem_sims: dict = field(default_factory=dict)
40
+ sbom_files: list = field(default_factory=list)
41
+ sbom_doc: dict = field(default_factory=dict)
42
+ sbom_path: Optional[str] = None
43
+ inventory_source: str = "none"
44
+ components: list[Component] = field(default_factory=list)
45
+ quality: dict = field(default_factory=dict)
46
+ graph: nx.DiGraph = field(default_factory=nx.DiGraph)
47
+ rel: dict = field(default_factory=dict)
48
+ osv: Optional[OsvClient] = None
49
+ vres: Optional[dict] = None
50
+ vulns: list[dict] = field(default_factory=list)
51
+ typo: dict = field(default_factory=lambda: {"findings": [], "suppressed": [], "stats": {}})
52
+ lres: dict = field(default_factory=lambda: {"changes": [], "findings": [], "comparisons": [], "summary": {}, "limitations": []})
53
+ suspicious_changes: dict = field(default_factory=dict)
54
+ supply_chain_anomalies: list[dict] = field(default_factory=list)
55
+ sast_findings: list[dict] = field(default_factory=list)
56
+ iac_findings: list[dict] = field(default_factory=list)
57
+ risk: dict = field(default_factory=lambda: {"assessments": [], "correlations": []})
58
+ prefix: str = ""