Skip to content

fix: reject -F/--file git args that can exfiltrate runner files - #759

Merged
EndBug merged 4 commits into
mainfrom
cursor/2af064bb
Aug 8, 2026
Merged

fix: reject -F/--file git args that can exfiltrate runner files#759
EndBug merged 4 commits into
mainfrom
cursor/2af064bb

Conversation

@EndBug

@EndBug EndBug commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reject -F/--file (and Git abbreviations / short-option clusters containing F) in matchGitArgs, closing tag/commit message file-read argument injection that can push runner filesystem contents into repo history.
  • Keep free-form tag args such as v1.0.0 --force; document the restriction in the README and action.yml.

Test plan

  • Unit tests cover PoC form (1.0.0 -F ../secrets), --fi/--fil, -aF/-Fa, and safe cases (v1.0.0 --force, -f)
  • Pre-commit Jest + lint + rebuild passed
  • Confirm a workflow with tag: 'v1.0.0 --force' still tags successfully
  • Confirm tag: '1.0.0 -F /path' fails the action before git tag runs

Made with Cursor

Summary by CodeRabbit

  • Security
    • Blocked Git message-from-file options, including --file, abbreviations, -F, and short-option clusters.
    • Added protection against filesystem-content exposure through unsafe Git arguments.
  • Documentation
    • Updated Git argument guidance and input descriptions to prohibit unsafe options and discourage untrusted data interpolation.
  • Bug Fixes
    • Improved unsafe-argument detection while preserving valid message values, version options, and supported short-option formats.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cf19f47e-054b-4e0d-8f0f-aff2589d6607

📥 Commits

Reviewing files that changed from the base of the PR and between 8988122 and b17e986.

📒 Files selected for processing (3)
  • lib/index.js
  • src/util.ts
  • test/util.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/util.ts
  • test/util.test.ts

📝 Walkthrough

Walkthrough

The change extends matchGitArgs to reject Git message-file options, including abbreviations and short-option clusters. It adds parser tests and updates action descriptions, README warnings, and documentation examples.

Changes

Git argument validation

Layer / File(s) Summary
Message-file option detection and rejection
src/util.ts, test/util.test.ts
matchGitArgs tracks consumed option values and rejects --file forms, -F forms, attached values, and short-option clusters. Tests cover valid message values and blocked options.
Input and README documentation
action.yml, README.md, src/util.ts
The action descriptions and README document blocked message-file options and sanitization requirements. The parser documentation updates its examples and rejection behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting dangerous Git -F and --file arguments that can exfiltrate runner files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/2af064bb

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EndBug
EndBug marked this pull request as ready for review August 8, 2026 21:16
@EndBug
EndBug requested a lite review from Copilot August 8, 2026 21:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 containing F (e.g. -aF).
  • Add unit tests covering PoC injection forms, abbreviations, clusters, and safe cases like v1.0.0 --force and -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.

Comment thread action.yml Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c38a33b and 201d277.

📒 Files selected for processing (5)
  • README.md
  • action.yml
  • lib/index.js
  • src/util.ts
  • test/util.test.ts

Comment thread src/util.ts
EndBug and others added 2 commits August 8, 2026 23:25
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@EndBug
EndBug merged commit d07c930 into main Aug 8, 2026
11 checks passed
@EndBug
EndBug deleted the cursor/2af064bb branch August 8, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants