"""Isolated E72 security target. Not production code, no network listener required."""
from __future__ import annotations
import os
from pathlib import Path

ROOT = Path(__file__).resolve().parent / "files"


def run_report(name: str) -> str:
    # VULNERABLE: user input concatenated into a shell command
    return os.popen("echo report: " + name).read()


def read_file(rel: str) -> str:
    # VULNERABLE: no canonicalisation; ../ escapes the intended root
    return (ROOT / rel).read_text(errors="replace")


def handle(query: dict) -> str:
    if "file" in query:
        return read_file(str(query["file"]))
    return run_report(str(query.get("name", "")))
