Skip to content

Commit

Permalink
Allow absolute paths if contained in workspace (Significant-Gravitas#…
Browse files Browse the repository at this point in the history
…3932)

Maybe I'm missing something but I don't see the harm of accessing an absolute path if it's contained in the workspace

Co-authored-by: k-boikov <[email protected]>
  • Loading branch information
BaseInfinity and k-boikov authored May 16, 2023
1 parent 0839a16 commit c1cd54d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autogpt/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def _sanitize_path(

logger.debug(f"Resolved root as '{root}'")

if relative_path.is_absolute():
# Allow exception for absolute paths if they are contained in your workspace directory.
if relative_path.is_absolute() and not relative_path.is_relative_to(root):
raise ValueError(
f"Attempted to access absolute path '{relative_path}' in workspace '{root}'."
)
Expand Down

0 comments on commit c1cd54d

Please sign in to comment.