fix(hooks): preserve commands after shell comments#2124
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Tip ✅ Accepted and mergedAccepted by the maintainer gate. Status ✅ Verdict: Summary
ℹ️ · Source Review
ℹ️ · Duplicate and History Review
ℹ️ · Independent reviews (dual-AI)
Automation notes
Thanks for using HeyClaude to keep Claude and AI workflow submissions source-backed and useful. If this gate helped, consider starring or forking JSONbored/awesome-claude. ❤️ Share |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Motivation
strip_shell_comments) incontent/hooks/package-download-checksum-guard-hook.mdxusedbreakwhen encountering an unquoted#at a shell word boundary, which truncated multi-line commands and allowed downloads after a comment to bypass verification checks.Description
breakinsidestrip_shell_commentswith logic that advances to the next newline andcontinues so the parser skips the comment only through the current line and then resumes scanning the remainder of the command text.installCommand-generated hook and thescriptBodycopy.#characters and keepscommand_without_commentssemantics while preventing multi-line bypasses.Testing
bash -n /tmp/package-download-checksum-guard.shto validate hook syntax, which succeeded.curl -LO https://example.com/pkg.zipis blocked without verification,# setup note\ncurl -LO https://example.com/pkg.zipis now blocked (no bypass),echo ok # setup note\ncurl -LO https://example.com/pkg.zipis blocked, quoted#strings are preserved, and a download followed by a realsha256sum -cverification is allowed.pnpm validate:content:strictwhich passed for content validation.Codex Task