feat: add opt-in RTK shell output filtering - #41
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
| # not populate BASH_SOURCE for command strings. Keep the original file | ||
| # execution path for scripts that inspect BASH_SOURCE so filtering cannot | ||
| # change source-relative imports or helper lookups. | ||
| if ! grep -q 'BASH_SOURCE' -- "$1" 2>/dev/null; then |
There was a problem hiding this comment.
🟡 Medium docker/bash-run.sh:11
grep -q 'BASH_SOURCE' matches any literal occurrence of the string, including comments, quoted strings, or commands like printf 'BASH_SOURCE'. A script that merely mentions the text but never actually inspects the variable bypasses RTK rewriting entirely and runs raw, silently defeating the rtk output filter the user opted into. Consider checking for actual parameter expansion syntax (e.g. BASH_SOURCE[ or $BASH_SOURCE) instead of a plain substring search.
| if ! grep -q 'BASH_SOURCE' -- "$1" 2>/dev/null; then | |
| if ! grep -qE 'BASH_SOURCE\[' -- "$1" 2>/dev/null; then |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @docker/bash-run.sh around line 11:
`grep -q 'BASH_SOURCE'` matches any literal occurrence of the string, including comments, quoted strings, or commands like `printf 'BASH_SOURCE'`. A script that merely mentions the text but never actually inspects the variable bypasses RTK rewriting entirely and runs raw, silently defeating the `rtk` output filter the user opted into. Consider checking for actual parameter expansion syntax (e.g. `BASH_SOURCE[` or `$BASH_SOURCE`) instead of a plain substring search.
Summary
I added request-scoped RTK output filtering for Bash executions while preserving raw execution as the default and keeping all command rewriting inside the sandbox boundary.
shell_output_filter: "raw" | "rtk"to the public and internal execution contracts with Bash-only validation at both trust boundaries.Change Type
Testing
cd api && bun run build.cd service && bun run build; the existing Rollup export/circular-dependency warnings remain unchanged.cd api && bun test src/bash-run.test.ts src/job-helpers.test.ts(69 passed).cd service && bun test src/config.spec.ts(17 passed).bash -n docker/bash-run.sh docker/package-init.sh.rtk-buildertarget from both Dockerfiles on linux/arm64 and verifiedrtk 0.45.0.git status && git difftortk git status && rtk git diff, honors the ephemeral RTK environment, and creates no files under sandbox HOME.AWS_CA_BUNDLEtrips existing hardened-startup fixtures. No focused RTK test failed.Test Configuration:
Checklist