fix: validate denylisted git args on every token - #784
Conversation
Short-option clusters such as -Sm were treated as consuming the next argument, which let --pathspec-from-file reach git and leak file contents into workflow logs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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 (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthrough
ChangesGit argument validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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
-Sm,-tm, …). That skip disagreed with Git’s cluster parser and let--pathspec-from-file/--pathspec-file-nulreach git, which prints the file into workflow logs.matchGitArgsnow runs the--upload-pack,-F/--file,--pathspec-from-file, andscheme::checks on every token (the same rule--upload-packalready used).commit: -m "-F"or-m "foo::bar"are now rejected; glued-m-Fis still allowed. Themessageinput is unchanged.Test plan
-Sm --pathspec-from-file=/x -Sm --pathspec-file-nuland-tm --pathspec-from-file=/xthrow; same clusters withscheme::throw unlessallowUnsafeGitProtocols.commit: -Sm --pathspec-from-file=<dummy> -Sm --pathspec-file-nulfails withnot allowedand does not print dummy markers or move HEAD.commit: --signoff(or similar extra args) still works.Made with Cursor
Summary by CodeRabbit
Bug Fixes
Tests