INNER CODE UNIT · Python
_build_scope_enforcer
0xSteph/pentest-ai · cli/main.py:377
def _build_scope_enforcer(
targets,
scope_allow: list[str] | None,
scope_exclude: list[str] | None,
scope_file: str | None,
):
"""Build the engagement ScopeEnforcer from the target(s), --scope-allow /
--scope-exclude flags, an optional --scope-file, and config.scope.
Shared by the single-target, campaign, and authenticated-scan start paths so
every engagement is scope-bounded and persists the same confirmed scope_json.
Previously only the single-target default path built an enforcer; the
campaign and auth-scan early-returns ran unbounded (Bugbot #60)."""
from engine.scope import build_enforcer as _build_enforcer
allow, exclude, cfg = _resolve_scope_inputs(scope_allow, scope_exclude, scope_file)
return _build_enforcer(targets, allowed=allow, excluded=exclude, config_scope=cfg)