Skip to content

feat(help): separate read-only and read-write paths in help#545

Merged
matt-dz merged 1 commit into
mainfrom
matt-dz/improve-allowed-paths-help
Jun 26, 2026
Merged

feat(help): separate read-only and read-write paths in help#545
matt-dz merged 1 commit into
mainfrom
matt-dz/improve-allowed-paths-help

Conversation

@matt-dz

@matt-dz matt-dz commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • expose structured AllowedPaths access metadata from the sandbox
  • render help allowed paths in read-only and read-write groups
  • document the new help output and cover it with unit and scenario tests

Why

The previous help output listed allowed roots without showing whether each root was read-only or read-write, which made the active filesystem access policy hard to understand.

Example

$ ./rshell --allowed-paths /var:ro,/etc,/tmp:rw,.:rw --allow-all-commands --mode remediation -c 'help'
rshell (v0.0.22-0.20260624144033-083a52525f12+dirty) - remediation mode

Features:
commands            Registered commands run inside the interpreter; no unregistered commands without an external handler.
variables           Assignments, expansion, inline env, command substitution; no arrays/arithmetic/advanced params.
control-flow        for/while/until/if/&&/||/!/groups/subshells; no case/select/functions.
pipes-redirections  Pipes, stdin/heredocs, /dev/null redirects, fd dup; no arbitrary file writes.
quoting-expansion   Quotes, globbing, continuations, comments; no extglob/tilde/process substitution.
execution           AllowedCommands, AllowedPaths, timeouts, ProcPath; no background jobs/coprocs/time.
environment         Empty by default, caller Env, IFS/ALLOWED_PATHS; no host env inheritance/export.
bash-divergences    Intentional bash differences captured here. Currently: one shared time reference per Run().

Not supported:
  - Expansions: arithmetic $((...)), arrays, advanced ${...} operations, tilde expansion, process substitution, extended globbing.
  - Control flow: case, select, C-style for ((...)), and shell functions.
  - Execution: external commands by default, background jobs, coprocesses, time, [[...]], ((...)), declare/export/local/readonly/let.
  - I/O and environment: arbitrary output file redirects, |&, herestrings, read-write redirects, input fd duplication, host env inheritance.

Commands:
[          evaluate conditional expression
break      exit from a loop
cat        concatenate and print files
cd         change the working directory
continue   continue a loop iteration
cut        remove sections from each line
df         report file system disk space usage
du         estimate file space usage
echo       write arguments to stdout
exit       exit the shell
false      return unsuccessful exit status
find       search for files in a directory hierarchy
grep       print lines that match patterns
head       output the first part of files
help       display help for features and commands
ip         show network interface and routing information
logrotate  truncate logs by size threshold or force
ls         list directory contents
ping       send ICMP echo requests to a network host
printf     format and print data
ps         report process status
pwd        print working directory
read       read a line from standard input and assign to shell variables
sed        stream editor for filtering and transforming text
sort       sort lines of text files
ss         display socket statistics
strings    print printable character sequences
tail       output the last part of files
test       evaluate conditional expression
tr         translate or delete characters
true       return successful exit status
truncate   shrink or extend file size
uname      print system information
uniq       report or omit repeated lines
wc         print newline, word, and byte counts
xargs      build and execute commands from standard input

Allowed paths:
  Read-only:
    /var
    /etc
  Read-write:
    /tmp
    /Users/matthew.deguzman/go/src/github.com/DataDog/rshell

Run 'help <feature|command>' for more information on a specific topic.

Validation

  • make fmt
  • go test ./allowedpaths ./builtins/tests/help ./tests -run 'Test(PathAccessesIncludeModes|HelpLists|HelpOmits|ShellScenarios)'
  • RSHELL_BASH_TEST=1 go test ./tests/ -run TestShellScenariosAgainstBash -timeout 120s
  • go test ./...
  • git diff --check

@matt-dz matt-dz changed the title [codex] Separate read-only and read-write paths in help feat(help): separate read-only and read-write paths in help Jun 26, 2026

matt-dz commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: acab9c404f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@matt-dz
matt-dz marked this pull request as ready for review June 26, 2026 18:52
@matt-dz
matt-dz enabled auto-merge June 26, 2026 18:52
@matt-dz
matt-dz added this pull request to the merge queue Jun 26, 2026
Merged via the queue into main with commit b12d367 Jun 26, 2026
41 checks passed
@matt-dz
matt-dz deleted the matt-dz/improve-allowed-paths-help branch June 26, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants