From c1cd54d1ea980150aa999676dc038210b2530d36 Mon Sep 17 00:00:00 2001 From: Stefan Ayala Date: Tue, 16 May 2023 07:10:33 -0700 Subject: [PATCH] Allow absolute paths if contained in workspace (#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 <64261260+k-boikov@users.noreply.github.com> --- autogpt/workspace/workspace.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autogpt/workspace/workspace.py b/autogpt/workspace/workspace.py index c1050230..1589a5be 100644 --- a/autogpt/workspace/workspace.py +++ b/autogpt/workspace/workspace.py @@ -120,7 +120,8 @@ class Workspace: 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}'." )