fix: prevent heredoc injection in ralph loop setup script#52418
Open
sakal-s wants to merge 1 commit intoanthropics:mainfrom
Open
fix: prevent heredoc injection in ralph loop setup script#52418sakal-s wants to merge 1 commit intoanthropics:mainfrom
sakal-s wants to merge 1 commit intoanthropics:mainfrom
Conversation
The prompt text was inserted into an unquoted heredoc (<<EOF), which caused two issues: 1. If the prompt contained 'EOF' on its own line, the heredoc would terminate early, producing a truncated state file. 2. Shell variables ($VAR) and command substitutions ($(cmd)) in the prompt would be expanded rather than written literally. Write the file in two steps: a heredoc for the frontmatter (where variable expansion is intentional) and printf for the prompt (where the text should be written verbatim). Fixes anthropics#52408 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 24, 2026
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.
Summary
printffor the prompt (where text should be written verbatim)EOFon its own line$VARor$(cmd)in the prompt textTest plan
$HOME— should be written literally, not expandedEOFon its own line — file should not be truncatedFixes #52408
🤖 Generated with Claude Code