T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/run.py:69- Finding
Workspace-Controlled Pipeline Lock Allows Reads Outside the Bundled Pipelines Directory
- Content
View full analysis
str: lock_path = workspace / "PIPELINE.lock.md" if not lock_path.exists(): return "" for raw in lock_path.read_text(encoding="utf-8", errors="ignore").splitlines(): line = raw.strip() if line.startswith("pipeline:"): return line.split(":", 1)[1].strip() return "" ``` ```python pipeline_rel = _read_pipeline_path(workspace) pipeline_path = (repo_root / pipeline_rel).resolve() if pipeline_rel else None target_artifacts: list[tuple[str, bool]] = [] pipeline_load_error = "" if pipeline_path and pipeline_path.exists(): try: from tooling.pipeline_spec import PipelineSpec spec = PipelineSpec.load(pipeline_path) ``` The resulting path is opened by the pipeline parser: ```python @staticmethod def load(path: Path) -> "PipelineSpec": resolved = path.resolve() raw_frontmatter, frontmatter = _load_variant_aware_frontmatter(resolved) ``` ```python def _load_variant_aware_frontmatter( path: Path, seen: set[Path] | None = None, ) -> tuple[dict[str, Any], dict[str, Any]]: resolved = path.resolve() active = set(seen or set()) if resolved in active: chain = " -> ".join(str(p) for p in [*active, resolved]) raise ValueError(f"Cyclic `variant_of` chain detected: {chain}") active.add(resolved) text = resolved.read_text(encoding="utf-8") raw = _parse_frontmatter(text) ``` ### Technical Analysis The `pipeline:` value is read from `PIPELINE.lock.md` inside a caller-supplied workspace. The value is joined to `repo_root` and resolved, but the resolved path is never checked to ensure that it remains beneath the expected `pipelines/` directory. `pathlib` ...[truncated 2206 chars]- Remediation
View remediation
