Attached patch

  1. fixes Windows compatibility
  2. increases security by escaping shell arguments
  3. improves performance from 120+ seconds (fatal max_exec timeout...) to 40 seconds

Every single git command shell execution via PHP exec() takes 120ms on my (Windows) machine. I've tried a range of alternative shell execution methods, but none of them improved the performance in any way. I'm considering to add a filemtime() based (or alternative) cache to git_deploy to remedy that. But that's for another issue.

Comments

halstead’s picture

Thank you for this. I'll merge it into dev for testing soon.

darrell_ulm’s picture

Tested this (3 weeks ago) patch, works well.

That was three weeks ago, I just tried it again, and it finds contrib modules OK, but misreported the Drupal Core version as missing.

The Core .git dir and files are present.

Thank you

hswong3i’s picture

Title: Performance, Security, Windows-compatibility » Increases security by escaping shell arguments
StatusFileSize
new2.09 KB

IMHO let's focus on each issues one by one?

I give a quick cleanup for above patch and just focus on escapeshellarg() issue.

Any idea?

hswong3i’s picture

StatusFileSize
new64 bytes

I fork this issue to github: https://github.com/pantarei/drupal-git_deploy/tree/7.x-2.x-1471178

Just retouch the patch file with format-patch.

hswong3i’s picture

Sorry wrong file, here is the correct one.

sun’s picture

Status: Needs review » Needs work

If you do that, then you need to take over the inline comments I've intentionally added to explain why some things are escaped and some others are not.

I don't see why you'd need a branch to re-create the patch with just the shell argument escaping changes.

hswong3i’s picture

StatusFileSize
new3.21 KB

Sorry for the miss of comment and here is a re-roll.

A branch to re-create patch just for better maintenance; on the other hand, since my team are keep maintenance our own Drupal distribution with git submodule (https://github.com/pantarei/pantarei-drupal), we need a public git reference point which can go live even upstream drupal.org still not yet accept the patch ;-)

darren oh’s picture

Issue summary: View changes
Issue tags: +Needs reroll
darren oh’s picture

Title: Increases security by escaping shell arguments » [D7] Fix insecure handling of shell arguments
Assigned: sun » Unassigned
Issue tags: -Performance, -Windows, -Needs reroll
StatusFileSize
new6.2 KB
darren oh’s picture

Status: Needs work » Needs review
darren oh’s picture

StatusFileSize
new7.63 KB

Reroll.

darren oh’s picture

StatusFileSize
new7.66 KB

Another reroll.

darren oh’s picture

StatusFileSize
new2.1 KB
new7.24 KB
darren oh’s picture

StatusFileSize
new922 bytes
new7.24 KB

  • Darren Oh committed 6ed27ee on 7.x-2.x
    Issue #1471178 by hswong3i, sun, Darren Oh: Fix insecure handling of...
darren oh’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.