fix: reject remote-helper overrides skipped by -u - #770
Conversation
matchGitArgs treated -u as always consuming the next token, so fetch/push args like -u --upl=CMD bypassed the denylist. Validate remote-helper options on every token and stop treating -u as a value option.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough
ChangesRemote-helper validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change tightens remote-helper argument rejection while preserving supported tag and message behavior; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
matchGitArgs()treated-uas always consuming the next argv token. That is only true forgit tag -u <key-id>. Forgit fetch(--update-head-ok) andgit push(--set-upstream) it is a flag, so a following--upl=/--upload-packtoken was never denylisted. simple-git’s own guard is a literal/--(upload|receive)-pack/match and does not catch that abbreviation.This change:
--upload-pack,--receive-pack,--exec, and unique abbreviations) on every token, including values after-m/--message-uas a global value option, so it cannot skip the next token on fetch/push-m "-F"/--message "-F"as allowed message valuesgit tag-u <key-id>(separate tokens) workingTests
-u --upl=evil,-u --upload-pack=evil,-m --upl=evil, and--message --exec=evilthrow;v1.0.0 -u ABCDEFstill parsesfetch: '-u --upl=evil'fails the action withnot allowedand does not commitnpm test(unit + integration + lint) passed on the pre-commit hook after rebuildinglib/Summary by CodeRabbit
Bug Fixes
-u,-m, and--message.-uarguments without allowing unsafe options to be hidden as values.Documentation