mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 07:11:28 +02:00
global_threads was multiplied by the scan context's thread multiplier and then discarded; every stage carries its own threads field with its own default, so the engine-level number had nothing to apply to. global_http_crawl was stored, exported, imported and never read at all. Both reached the engine form, the YAML, the launch preview and the run comparison, where "Crawl responses" was a material facet: two runs that differed on it were reported as able to find different things. Gone from the table, the three schemas, ResolvedScanConfig, AdHocEngine, the preview, both Compare facets and every frontend site, with a migration to drop the columns. An engine exported before this still imports: _RETIRED_KEYS accepts the two keys and ignores them, while an unknown key is refused as before. _MAX_ENGINE_THREADS goes with the validator that used it. It was declared twice in the same file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X5roHYDYzSPRNaTkn8hSkJ
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping
|
|
from dataclasses import dataclass, field
|
|
|
|
from shared.definitions.launch import (
|
|
DEFAULT_LAUNCH_INTENSITY,
|
|
MAX_LABEL_STAGES,
|
|
QUICK_SCAN_LABEL,
|
|
)
|
|
from shared.services.scan_resolve import ResolvedScanConfig
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class AdHocEngine:
|
|
"""Engine-shaped defaults for a launch that names no saved engine."""
|
|
|
|
name: str = QUICK_SCAN_LABEL
|
|
intensity: str = DEFAULT_LAUNCH_INTENSITY
|
|
global_headers: tuple[str, ...] = ()
|
|
stages: Mapping[str, dict] = field(default_factory=dict)
|
|
tool_options: Mapping[str, str] = field(default_factory=dict)
|
|
id: None = None
|
|
|
|
|
|
def plan_label(resolved: ResolvedScanConfig) -> str:
|
|
"""Name an ad hoc run after the capabilities it runs."""
|
|
from shared.enums.scan import StageRole # noqa: PLC0415
|
|
from stages.registry import stages # noqa: PLC0415
|
|
|
|
running = [
|
|
spec
|
|
for spec in stages()
|
|
if resolved.target_type in spec.applies_to
|
|
and resolved.stage(spec.name).get("enabled")
|
|
]
|
|
picked = [s for s in running if s.role == StageRole.CAPABILITY.value]
|
|
titles = [spec.title for spec in (picked or running)]
|
|
if not titles:
|
|
return QUICK_SCAN_LABEL
|
|
if len(titles) == 1:
|
|
return titles[0]
|
|
if len(titles) <= MAX_LABEL_STAGES:
|
|
return f"{', '.join(titles[:-1])} and {titles[-1]}"
|
|
return f"{QUICK_SCAN_LABEL} · {len(titles)} stages"
|