T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/worker.py:32- Finding
Workers Have Unrestricted Filesystem and Shell Access Without Enforced Role-Based Permissions
- Content
View full analysis
str: """Read a file""" self.tool_uses += 1 try: file_path = Path(path) if not file_path.exists(): return f"Error: File not found: {path}" content = file_path.read_text(encoding="utf-8") lines = content.split("\n") if len(lines) > limit: content = "\n".join(lines[:limit]) + f"\n... ({len(lines) - limit} more lines)" self.results.append({"tool": "read", "path": path, "status": "success"}) return content except Exception as e: return f"Error reading {path}: {e}" ``` ```python def write(self, path: str, content: str) -> str: """Write a file""" self.tool_uses += 1 try: file_path = Path(path) file_path.parent.mkdir(parents=True, exist_ok=True) file_path.write_text(content, encoding="utf-8") self.results.append({"tool": "write", "path": path, "status": "success"}) return f"Written: {path}" except Exception as e: return f"Error writing {path}: {e}" ``` ```python def edit(self, path: str, old: str, new: str) -> str: """Edit a file (find and replace)""" self.tool_uses += 1 try: file_path = Path(path) if not file_path.exists(): return f"Error: File not found: ...[truncated 4078 chars]- Remediation
View remediation
