fix(security): fix file_tools.py validate_path startswith bypass #7478

ISSUES CLOSED: #7478
This commit is contained in:
2026-05-15 06:05:35 +00:00
committed by Forgejo
parent 59e408c553
commit 152ed7a744
2 changed files with 6 additions and 1 deletions
@@ -514,6 +514,12 @@ class LLMExecuteActor:
)
continue
if rel.startswith(".." + os.sep) or rel == "..":
logger.warning(
"Rejected path traversal in LLM output",
path=path,
resolved=full_path,
)
continue
os.makedirs(os.path.dirname(full_path), exist_ok=True)
try:
with open(full_path, "w") as fh:
-1
View File
@@ -12,7 +12,6 @@ Based on issue #515 — container-aware tool execution and I/O forwarding.
from __future__ import annotations
import os
import posixpath
from dataclasses import dataclass