fix: reject -F/--file git args that can exfiltrate runner files - #759
Conversation
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 (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe change extends ChangesGit argument validation
Estimated code review effort: 3 (Moderate) | ~20 minutes 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 |
There was a problem hiding this comment.
Pull request overview
This PR hardens matchGitArgs to prevent Git argument injection that can read a commit/tag message from a runner filesystem path (via -F / --file) and persist that content into repository history.
Changes:
- Block message-from-file options for git tag/commit messages by rejecting
-F,--file, accepted long-option abbreviations (e.g.--fi), and short-option clusters containingF(e.g.-aF). - Add unit tests covering PoC injection forms, abbreviations, clusters, and safe cases like
v1.0.0 --forceand-f. - Document the restriction in README and partially in
action.yml.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/util.ts |
Adds detection/blocking for message-from-file options and refactors long-option matching helper. |
test/util.test.ts |
Adds regression tests for blocked -F/--file forms and ensures safe args still parse. |
README.md |
Documents newly blocked message-from-file flags and expands “don’t interpolate untrusted data” guidance. |
action.yml |
Notes the new -F/--file restriction for the tag input (needs a small doc follow-up for completeness). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/util.ts`:
- Around line 133-142: Update matchGitArgs and its option validation to track
Git options that consume the following argument, including -m, so a subsequent
value beginning with -F or --file is preserved as message text rather than
classified by isDangerousMessageFileShortOption or matchesDangerousLongOption.
Keep genuine -F and --file message-file options rejected, and add regressions
for -m "-F" and -m "--file=/tmp/value".
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c58431c-3f69-4c44-85b2-95ff8656d019
📒 Files selected for processing (5)
README.mdaction.ymllib/index.jssrc/util.tstest/util.test.ts
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Bumps EndBug/add-and-commit from 10 to 11. Release notes Sourced from EndBug/add-and-commit's releases. v11.0.0 What's Changed chore(deps): bump picomatch by @dependabot[bot] in EndBug/add-and-commit#724 chore(deps-dev): bump handlebars from 4.7.8 to 4.7.9 by @dependabot[bot] in EndBug/add-and-commit#725 chore(deps): bump lodash from 4.17.23 to 4.18.1 by @dependabot[bot] in EndBug/add-and-commit#728 chore(deps-dev): bump ts-jest from 29.4.6 to 29.4.9 by @dependabot[bot] in EndBug/add-and-commit#727 chore(deps): bump @actions/github from 9.0.0 to 9.1.0 by @dependabot[bot] in EndBug/add-and-commit#729 chore(deps): bump @actions/github from 9.1.0 to 9.1.1 by @dependabot[bot] in EndBug/add-and-commit#732 chore(deps): bump @actions/core from 3.0.0 to 3.0.1 by @dependabot[bot] in EndBug/add-and-commit#733 ci(deps): bump actions/dependency-review-action from 4 to 5 by @dependabot[bot] in EndBug/add-and-commit#734 chore(deps-dev): bump ts-jest from 29.4.9 to 29.4.11 by @dependabot[bot] in EndBug/add-and-commit#736 chore(deps-dev): bump jest from 30.3.0 to 30.4.2 by @dependabot[bot] in EndBug/add-and-commit#735 chore(deps-dev): bump eslint-plugin-prettier from 5.5.5 to 5.5.6 by @dependabot[bot] in EndBug/add-and-commit#738 chore(deps): bump js-yaml from 4.1.1 to 4.2.0 by @dependabot[bot] in EndBug/add-and-commit#739 ci(deps): bump actions/checkout from 6 to 7 by @dependabot[bot] in EndBug/add-and-commit#741 chore(deps): bump undici from 6.24.1 to 6.27.0 by @dependabot[bot] in EndBug/add-and-commit#744 ci(deps): bump actions/setup-node from 6 to 7 by @dependabot[bot] in EndBug/add-and-commit#749 chore(deps-dev): bump @vercel/ncc from 0.38.4 to 0.44.1 by @dependabot[bot] in EndBug/add-and-commit#746 chore(deps): bump js-yaml from 4.2.0 to 5.2.1 by @dependabot[bot] in EndBug/add-and-commit#747 chore(deps-dev): bump ts-jest from 29.4.11 to 29.4.12 by @dependabot[bot] in EndBug/add-and-commit#750 chore(deps): bump js-yaml from 5.2.1 to 5.2.2 by @dependabot[bot] in EndBug/add-and-commit#751 chore(deps): bump undici from 6.27.0 to 6.28.0 by @dependabot[bot] in EndBug/add-and-commit#753 fix: reject remote-helper git flags that enable RCE by @EndBug in EndBug/add-and-commit#754 fix: prevent git option injection via new_branch by @EndBug in EndBug/add-and-commit#755 fix: verify committed lib/ matches source in CI by @EndBug in EndBug/add-and-commit#756 fix: stop logging full git config (credential leak) by @EndBug in EndBug/add-and-commit#758 fix: reject -F/--file git args that can exfiltrate runner files by @EndBug in EndBug/add-and-commit#759 fix: reject unmatched quotes in matchGitArgs to prevent flag injection by @EndBug in EndBug/add-and-commit#760 fix: refuse unexpected gitlinks staged by git add by @EndBug in EndBug/add-and-commit#761 fix: do not report committed=true for empty commit SHA by @EndBug in EndBug/add-and-commit#757 ci: pin actions-tagger and restrict release workflow permissions by @EndBug in EndBug/add-and-commit#762 fix: neutralize bidi and control chars in action logs by @EndBug in EndBug/add-and-commit#763 Full Changelog: EndBug/add-and-commit@v10.0.0...v11.0.0 Commits 645ecc0 11.0.0 06e788f fix: neutralize bidi and control chars in action logs (#763) 68ec86a ci: pin actions-tagger and restrict release workflow permissions (#762) f1bb0cc fix: do not report committed=true for empty commit SHA (#757) ebc24bf fix: refuse unexpected gitlinks staged by git add (#761) 75038f8 fix: reject unmatched quotes in matchGitArgs to prevent flag injection (#760) d07c930 fix: reject -F/--file git args that can exfiltrate runner files (#759) 0971289 fix: stop logging full git config (credential leak) (#758) c38a33b fix: verify committed lib/ matches source in CI (#756) b4a0134 fix: prevent git option injection via new_branch (#755) Additional commits viewable in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Summary
-F/--file(and Git abbreviations / short-option clusters containingF) inmatchGitArgs, closing tag/commit message file-read argument injection that can push runner filesystem contents into repo history.v1.0.0 --force; document the restriction in the README andaction.yml.Test plan
1.0.0 -F ../secrets),--fi/--fil,-aF/-Fa, and safe cases (v1.0.0 --force,-f)tag: 'v1.0.0 --force'still tags successfullytag: '1.0.0 -F /path'fails the action beforegit tagrunsMade with Cursor
Summary by CodeRabbit
--file, abbreviations,-F, and short-option clusters.