Conversation
Add defense-in-depth validation around the path_script execution path so that user-controlled values (branch name, repo name, etc.) cannot smuggle shell metacharacters into a naively written script: - Reject control characters (0x00-0x1f, 0x7f) in any VIBE_* field - Warn on shell metacharacters ($, `, ;, |, &, <, >, \, ", ') in branch and repo fields, with dedup and an actionable double-quote hint - Reject control characters in the script's stdout before trimming - Document the security model in vibe-toml.mdx (en/ja) Closes #415 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Defense-in-depth hardening of the
path_scriptexecution path so that user-controlled values (branch name, repo name, etc.) cannot smuggle shell metacharacters into a naively written script.The
executePathScriptfunction previously passedVIBE_BRANCH_NAME,VIBE_REPO_NAME,VIBE_SANITIZED_BRANCH, andVIBE_REPO_ROOTto a user script without validation. A branch name containing newlines, NULs, or shell metacharacters could be exploited when the script's author forgot to double-quote variables (or usedeval).Three layers added:
VIBE_*fields\x00-\x1f\x7f) with a hex-encoded error$,`,;, `A new
buildPathScriptEnvcollector centralises env construction so adding a futureVIBE_*field automatically routes through validation. Layer 3 explicitly excludes path-traversal semantics (tracked separately in #419).User-facing security guidance is added to
vibe-toml.mdx(en/ja).Fixes #415
Test Plan
packages/core/src/utils/worktree-path-validation.test.tscovering control-char boundaries (\x1f/\x20/\x7e/\x7f), metachar detection, dedup keys, output validation (leading/trailing newline edge cases)packages/core/src/utils/worktree-path.test.tscovering control-char rejection per field, metachar warnings across multiple fields, dedup behaviour, and stdout rejectionpnpm run check:allpasses (451 tests, lint, typecheck, docs, video)Checklist
pnpm run check:allpassesFixes #415