Open
Description
Question
I’m pretty new to gptscript and have a question about safely executing commands with sys.exec
(or similar features). Is there a built-in way to:
-
Whitelist Commands:
- Allow only specific commands to be executed, either by binary name (e.g.,
ls
) or absolute path (e.g.,/bin/ls
)? - Raise an error or ignore commands that are not explicitly allowed?
- Allow only specific commands to be executed, either by binary name (e.g.,
-
Filter Unsafe Input:
- Prevent execution of inputs containing special shell symbols like
\``,
|,
$,
;, or
&&`, which could spawn additional processes? - For example, how would the library handle inputs like
ls -al $(pwd)
orecho $(rm -rf /)
or ls -al `pwd` etc.? - Can users provide a custom validation or sanitization function for input arguments to enforce stricter security?
- Prevent execution of inputs containing special shell symbols like
-
Safety Guarantees:
- Are there existing mechanisms in the library to ensure these concerns are handled safely, or would these need to be implemented by the user?
Context
I want to ensure that commands executed through the library are secure and controlled, particularly in scenarios where user-provided input is involved.
Running commands through firejail or something like that could also make sense to have a completely controlled environment (at least on linux).
Any guidance on how to approach this would be greatly appreciated. Thanks for creating such an awesome tool!
Metadata
Metadata
Assignees
Labels
No labels