Skip to content

fix: detect git push via subprocess wrappers (perl, python, node, ruby)#9

Closed
royosherove wants to merge 1 commit into
mainfrom
fix/subprocess-push-guard
Closed

fix: detect git push via subprocess wrappers (perl, python, node, ruby)#9
royosherove wants to merge 1 commit into
mainfrom
fix/subprocess-push-guard

Conversation

@royosherove
Copy link
Copy Markdown
Member

Closes the perl workaround bypass by detecting subprocess wrappers in the push-guard.

Changes:

  • Add containsGitPushInSubprocessWrapper() detector for perl -e, python -c, node -e, ruby -e
  • Require BOTH git and push keywords present (eliminates false positives on unrelated commands)
  • Exclude git stash push (not a remote push)
  • Support multi-space separators in language flags

Result: Commands like perl -e 'system("git", "push", "origin", "main")' are now blocked.

Review iterations: 3 cycles, all findings addressed:

  • Removed overly-broad keyword alternatives (os.system, subprocess, child_process, exec)
  • Fixed regex ordering (git.*push only, not push.*git)
  • Added stash exclusion to wrapper path
  • Fixed flag spacing pattern

Code reviewed and ready to merge.

@royosherove royosherove force-pushed the fix/subprocess-push-guard branch from 97ced82 to 6b6d128 Compare May 14, 2026 20:21
@royosherove royosherove deleted the fix/subprocess-push-guard branch May 14, 2026 20:21
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.

1 participant