mirror of
https://github.com/f/git-rewrite-commits.git
synced 2026-04-27 06:35:49 +03:00
[GH-ISSUE #5] RCE, Data Exfiltration, and Supply Chain Risks #6
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/git-rewrite-commits#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @geeknik on GitHub (Nov 11, 2025).
Original GitHub issue: https://github.com/f/git-rewrite-commits/issues/5
Originally assigned to: @Copilot on GitHub.
Good morning.
hooks/prepare-commit-msg:20-57concatenates user-controlledgit-configvalues intoCMD="npx git-rewrite-commits …"and executes it witheval. Any repo or developer shell can inject shell metacharacters and gain arbitrary code execution as soon as the hook runs. Replace theevalcall with a safely quoted exec path (e.g., directnpxinvocation with explicit arguments, orprintf '%s\0' + xargs -0).src/index.ts:223-265unconditionally streams the entire file list and up to ~8 KB of rawgit diffto the selected provider (OpenAI by default). There is no masking, allow-list, or opt-in confirmation, so secrets, credentials, and regulated data leave the workstation every time the CLI runs. This is a major privacy/compliance violation for any sensitive repository.Installing the provided hooks causes constant exfiltration and unattended history rewrites. The post-commit hook (
hooks/post-commit:15-38) invokesnpx git-rewrite-commits --max-commits 1 --skip-backupafter every commit, and the pre-push hook (hooks/pre-push:14-50) reruns the tool for every unpushed commit on each push. Following the documented “install hooks” flow silently leaks staged/unpushed code to OpenAI and can corrupt repositories because rewrite operations occur automatically with backups disabled.All three hooks rely on
npx git-rewrite-commits(hooks/prepare-commit-msg:40-56,hooks/post-commit:31-38,hooks/pre-push:40-50) without pinning a version or verifying integrity. A compromised or typo-squatted npm release immediately executes attacker-controlled code during every commit/push. Ship a vendored binary/CLI or pin + checksum-verify the exact package before executing it.These issues collectively provide trivial RCE vectors, leak confidential source code to third parties, and risk repository corruption.
Remediation steps:
@f commented on GitHub (Nov 11, 2025):
Can you review @Copilot Agent's PR: https://github.com/f/git-rewrite-commits/pull/6/files