Hi!

This seems like an interesting module.

I encourage you to create a dev release several days/weeks before a stable (and to create a "1.0-beta1" before a 1.0). Once you create the dev, please comment on this issue so that people following this issue can take a look at the code/purpose and perhaps give some feedback.

My interest: The purpose of the module from the project page seems useful to me in certain situations, but I can also see that there are risks to the implementation (anytime you call exec there are risks). Hence wanting to get a quick look at the code.

This issue is not a demand or requirement, just a friendly suggestion of what I've seen work well in the past.

Comments

greggles created an issue. See original summary.

c-logemann’s picture

Hello @greggles,
it's my own interest to get this module as secure as I can. So any reviews especially by the security team are helpful. I'm fine your suggested version strategy and announcements in this issue and I will follow this way.

Greetings,
Carsten

  • C_Logemann committed ee87bba on 7.x-1.x
    Issue #2572163 by C_Logemann: first release of code
    
c-logemann’s picture

Assigned: Unassigned » c-logemann
Status: Active » Needs review

I have a concrete question about security. Currently I check the path with "file_exists". Is this enough or should I do more checking of path-infomration before using it in exec()?

Hereis the example code. But it's part of the code I committed today and you can start to review.

 if (file_exists($path)) {
    $command = "find " . $path . " -user " . $system_user . " -exec chmod g+w {} +";
    exec($command);
}

On the next step I will create an interface to drush via menu_router. The access to this I want to protect with the same token which is used for "cron.php".

c-logemann’s picture

Just committed a feature to use this module like cron.php with cron_key in url. There is also a new global setting setting page to enable this feature. The execution form is moved to a new url and defined as MENU_LOCAL_TASK. Now the cron implementation is prepared.

  • C_Logemann committed 8306afc on 7.x-1.x
    Issue #2572163 by C_Logemann: added drush command "chmod-curl"
    
c-logemann’s picture

Version: » 7.x-1.x-dev
Assigned: c-logemann » Unassigned

I created a dev release today.

greggles’s picture

I reviewed the code and didn't see any immediately obvious ways to exploit it. Any reason you aren't using escapeshellarg?

c-logemann’s picture

Assigned: Unassigned » c-logemann

Thanx @greggles for reviewing.
When I think about a SQL Injection by another vulnerability I think somebody can change the private files path for example and so get a string to the exec() command. So hardening the exec()-situation was still a task for me and "escapeshellarg" I need to test. When there is a problem then I report here if not I will use and commit this.

c-logemann’s picture

Status: Needs review » Needs work

  • C_Logemann committed e95cc65 on 7.x-1.x
    Issue #2572163 by C_Logemann: Added escapeshellarg($path) to secure exec...
c-logemann’s picture

Assigned: c-logemann » Unassigned
Status: Needs work » Needs review

  • C_Logemann committed ee87bba on 8.x-1.x
    Issue #2572163 by C_Logemann: first release of code
    
  • C_Logemann committed 8306afc on 8.x-1.x
    Issue #2572163 by C_Logemann: added drush command "chmod-curl"
    
  • C_Logemann committed e95cc65 on 8.x-1.x
    Issue #2572163 by C_Logemann: Added escapeshellarg($path) to secure exec...
greggles’s picture

Any reason to use the ! placeholder instead of % in the t calls? I think it's safer to do % unless you know you absolutely need to use !.

  • C_Logemann committed 6a28e47 on 7.x-1.x
    Issue #2572163 by C_Logemann: Changed t() placeholder to "%".
    
c-logemann’s picture

Any reason to use the ! placeholder instead of % in the t calls? I think it's safer to do % unless you know you absolutely need to use !.

I have changed this. I think I can make a release now.

c-logemann’s picture

Status: Needs review » Fixed

Because there was no other comment on review I created a first stable release.

Status: Fixed » Closed (fixed)

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