AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Option to disable working directory restrictions

Open Josh-XT opened this issue 2 years ago • 4 comments
trafficstars

Background

It is constantly unable to access files due to workspace working directory restrictions. An option is needed to remove the restriction on the working directory.

Changes

  • Added new environment variable WORKING_DIRECTORY_RESTRICTED that is set to True by default, setting to False will remove the restriction.
  • Modfied execute_code.py to use safe_join from file_operations.py instead so that the environment variable can be referenced once in file_operations.py only.

Documentation

Above.

Test Plan

Tested by making sure it was able to access files outside of the working directory with it set to false.

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

Josh-XT avatar Apr 16 '23 12:04 Josh-XT

Fixes #1862, #23

Pwuts avatar Apr 16 '23 14:04 Pwuts

Seems dangerous if not properly sandboxed, so maybe give it a big fat warning label in the docs.

Pwuts avatar Apr 16 '23 14:04 Pwuts

@Josh-XT There are conflicts now

nponeccop avatar Apr 17 '23 15:04 nponeccop

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 17 '23 15:04 github-actions[bot]

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 18 '23 22:04 github-actions[bot]

I have pulled the latest master but I can't see the WORKING_DIRECTORY_RESTRICTED variable in .env?

I am a noob... happy to buy you a coffee...

Philomath88 avatar Apr 19 '23 03:04 Philomath88

@Philomath88 pulling updates .env.template, not .env. Also, the config variable is called RESTRICT_TO_WORKSPACE.

Pwuts avatar Apr 19 '23 09:04 Pwuts

Not sure how to buy you a coffee - there's no PayPal or equivalent in the docs:

If you can spare a coffee, you can help to cover the costs of developing Auto-GPT and help push the boundaries of fully autonomous AI! Your support is greatly appreciated Development of this free, open-source project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here.

Philomath88 avatar Apr 19 '23 11:04 Philomath88

On which branch should I work to use the new variable RESTRICT_TO_WORKSPACE?

I'm working on the stable branch as instructed in the README.md and I can't find the variable in the .env.template so I guess that the change is not yet merged to the stable branch.

davidraviv avatar Apr 19 '23 11:04 davidraviv

You are correct, as you can see this PR was merged into master.

Pwuts avatar Apr 19 '23 11:04 Pwuts