T09 · Insecure Skill Coding Practices
- Location
scripts/validate.py:171- Finding
Untrusted LaTeX Compilation Permits Execution of Lua Primitives
- Content
View full analysis
dict: """Compile a .tex file and return the compilation result.""" result = { "success": False, "engine": engine, "tex_path": tex_path, "pdf_path": "", "stdout": "", "stderr": "", "returncode": -1, "log_file": "", "errors": [], "warnings": [], "suggestions": [] } engine_path = find_engine(engine) if not engine_path: result["errors"].append(f"Could not find the {engine} executable") return result work_dir = str(Path(tex_path).parent) tex_filename = Path(tex_path).name try: proc = subprocess.run( [engine_path, "-interaction=nonstopmode", "-halt-on-error", tex_filename], cwd=work_dir, capture_output=True, text=True, timeout=timeout ) result["stdout"] = proc.stdout result["stderr"] = proc.stderr result["returncode"] = proc.returncode pdf_path = Path(tex_path).with_suffix(".pdf") if pdf_path.exists() and pdf_path.stat().st_size > 0: result["success"] = True result["pdf_path"] = str(pdf_path) log_path = Path(tex_path).with_suffix(".log") if log_path.exists(): result["log_file"] = str(log_path) with open(log_path, "r", encoding="utf-8", ...[truncated 3146 chars]- Remediation
View remediation
