MCPcopy Index your code
hub / github.com/shareAI-lab/learn-claude-code / safe_path

Function safe_path

agents/s_full.py:74–78  ·  view source on GitHub ↗
(p: str)

Source from the content-addressed store, hash-verified

72
73# === SECTION: base_tools ===
74def safe_path(p: str) -> Path:
75 path = (WORKDIR / p).resolve()
76 if not path.is_relative_to(WORKDIR):
77 raise ValueError(f"Path escapes workspace: {p}")
78 return path
79
80def run_bash(command: str) -> str:
81 dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"]

Callers 3

run_readFunction · 0.70
run_writeFunction · 0.70
run_editFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected