-
Notifications
You must be signed in to change notification settings - Fork 1
feat(interp): expose ALLOWED_PATHS environment variable #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9fb2e1f
feat(interp): expose ALLOWED_PATHS environment variable
matt-dz dd468bb
refactor(interp): build Env from stored pairs instead of rebuilding
matt-dz 2f1bcfa
refactor(interp): set ALLOWED_PATHS via setVarString in Reset
matt-dz 76fecad
fix(interp): always set ALLOWED_PATHS when sandbox exists
matt-dz 1667c84
docs: document ALLOWED_PATHS environment variable in SHELL_FEATURES.md
matt-dz 7fcf231
style: remove style comment
matt-dz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/scenarios/shell/allowed_paths/allowed_paths_env_var.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| description: ALLOWED_PATHS environment variable lists resolved allowed directories | ||
| # skip: ALLOWED_PATHS env var is an rshell-specific feature | ||
| skip_assert_against_bash: true | ||
| setup: | ||
| files: | ||
| - path: dir1/file.txt | ||
| content: "a\n" | ||
| - path: dir2/file.txt | ||
| content: "b\n" | ||
| input: | ||
| allowed_paths: ["dir1", "dir2"] | ||
| script: |+ | ||
| echo $ALLOWED_PATHS | ||
| expect: | ||
| stdout_contains: | ||
| - "dir1" | ||
| - "dir2" | ||
| exit_code: 0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually what we want? I think for lists in shell scripting you usually space-separate them, this I think is for constructing known variables like
PATHthat have a specific formatThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it's a clean separation between filepaths. i avoided spaces because i'm worried about file paths/directories with spaces in them. but if that's the case then i can change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, I guess what we really want here is an "array" type like in Bash, but not sure whether we can support that in our interp. Is it going to be able to iterate over them if they're colon-separated though? It might need to use
trto do that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was imagining the agent doing something like
echo $ALLOWED_PATHSand inferring the result from there. I believe even if it does something like splitting the result withtrand printing each directory on a line, the result from PAR gets sent back with a\neffectively acting as the same delimiter. so/path/a:/path/b:path/c->/path/a\n/path/b\n/path/b.Alternatively, it could just not do string manipulation and return the result but then whether it is a
:or a space delimiting the list, I believe the LLM should be able to infer the result (we can probably edit the skill to let it know that it will be delimited by a special character).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was imagining it doing something like "loop over the paths and call
lson each one" as a single pass. Agree if the value makes it back to the LLM it'll be able to figure it out, just wanted to cut out that roundtrip if possible.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i see. i think we can just merge and if we see the LLM having trouble we can rethink?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be a pain to change later so it's probably worth at least seeing how the LLMs are likely to try to use this list to determine whether there are any gaps in our coverage. Here's some anecdata, does rshell support either of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, both work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Word, send it