Explorar el Código

Protect composer home against web access

Jerome Tamarelle hace 13 años
padre
commit
1139b5c306
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      src/Composer/Factory.php

+ 5 - 0
src/Composer/Factory.php

@@ -38,6 +38,11 @@ class Factory
             }
         }
 
+        // Protect directory against web access
+        if (!file_exists($home . '/.htaccess')) {
+            @mkdir($home, 0777, true) && @file_put_contents($home . '/.htaccess', 'deny from all');
+        }
+
         $config = new Config();
 
         $file = new JsonFile($home.'/config.json');