gptscript icon indicating copy to clipboard operation
gptscript copied to clipboard

Fix: exclude bad env variable when invoking command

Open StrongMonkey opened this issue 1 year ago • 1 comments

We shouldn't allow system level environmental variable to be overridden from tool input, as this will break existing shell functionality. For example, @tylerslaton had this example:

tools: mkdir

Call mkdir with "foo"

---
name: mkdir
tools: sys.write
args: path: Path to write to

#!/bin/bash

mkdir $path

This will overriden PATH to the shell because path is defined as an input. However, this will break existing shell functionality since PATH is overridden and it won't be able to find the executable from PATH env variable.

StrongMonkey avatar Mar 05 '24 07:03 StrongMonkey

@tylerslaton Hmm, I feel like this might be ok. When user provides path as input we just don't add PATH into env variables and they should also not expect to use PATH because that's a system-level env variable.

StrongMonkey avatar Mar 05 '24 17:03 StrongMonkey

Darren already addressed it in a different PR.

StrongMonkey avatar Mar 14 '24 16:03 StrongMonkey