Repository navigation
Security: replace Bash LLM tool with read-only, shell-free tools - #5
Merged
Merged
Conversation
The review input is untrusted PR content while the container holds live VCS + LLM credentials, so `bash -lc` was arbitrary command execution one prompt injection away. The LLM tool set is now Read (with start_line/lines paging), Grep, Ls, Glob, Tail — structured args, never a shell; Grep spawns the grep binary with an argv array so model input stays inert data. Decision recorded in ADR-0014; ARCHITECTURE.md pattern 4.11 carries the invariant for future tools. Also: - `pnpm build` now wipes dist/ before compiling, so deleted sources can't leave stale artifacts (flushes the orphaned dist bash.js / shared.js) - import shared docs contributed by the harness repo: ADR-0000 (ADR scope gate), conventions i18n / react / constants-and-identifiers, and the CLAUDE.md working procedure - ignore .claude/ local config Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bilikaz
commented
Jun 10, 2026
bilikaz
left a comment
Owner
Author
There was a problem hiding this comment.
5 informational finding(s) (nits / suggestions, not blocking — listed here as summary, not tracked as individual threads):
src/llm/tools/grep.ts— Good use of-eto treat pattern as data rather than a flag. This correctly handles patterns starting with-. The argv array approach prevents shell injection.src/llm/tools/read.ts— The start_line validation correctly handles past-end-of-file cases. The error message is clear and actionable.src/llm/tools/index.ts— The tool registry correctly lists all five read-only tools. The comment explaining why Bash was removed is valuable for future maintainers.package.json— The build script now wipes dist/ before compiling, preventing stale artifacts from deleted sources. Consider extracting this to a separate clean script if the build command grows further.docs/adr/0014-llm-tools-read-only-no-shell.md— ADR-0014 clearly documents the security rationale and the three options considered. The consequences section honestly notes what's lost (git log/blame/show) and the path forward if needed.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The review input is untrusted PR content while the container holds live VCS + LLM credentials, so
bash -lcwas arbitrary command execution one prompt injection away. The LLM tool set is now Read (with start_line/lines paging), Grep, Ls, Glob, Tail — structured args, never a shell; Grep spawns the grep binary with an argv array so model input stays inert data. Decision recorded in ADR-0014; ARCHITECTURE.md pattern 4.11 carries the invariant for future tools.Also:
pnpm buildnow wipes dist/ before compiling, so deleted sources can't leave stale artifacts (flushes the orphaned dist bash.js / shared.js)