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

Function safe_path

agents/s07_task_system.py:125–129  ·  view source on GitHub ↗
(p: str)

Source from the content-addressed store, hash-verified

123
124# -- Base tool implementations --
125def safe_path(p: str) -> Path:
126 path = (WORKDIR / p).resolve()
127 if not path.is_relative_to(WORKDIR):
128 raise ValueError(f"Path escapes workspace: {p}")
129 return path
130
131def run_bash(command: str) -> str:
132 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