| @@ -48,6 +48,10 @@ final readonly class Packager |
| 48 | } | 48 | } |
| 49 | | 49 | |
| 50 | $buildDir = sys_get_temp_dir().'/scaleway-package-'.bin2hex(random_bytes(4)); | 50 | $buildDir = sys_get_temp_dir().'/scaleway-package-'.bin2hex(random_bytes(4)); |
| | 51 | + // Private, as it holds the .env files; failing on an existing path keeps a planted directory or symlink out. |
| | 52 | + if (!@mkdir($buildDir, 0o700)) { |
| | 53 | + throw new \RuntimeException(\sprintf('Cannot create "%s".', $buildDir)); |
| | 54 | + } |
| 51 | try { | 55 | try { |
| 52 | $this->log('Copying the application to '.$buildDir); | 56 | $this->log('Copying the application to '.$buildDir); |
| 53 | $this->copy($buildDir, $this->relativeToApp($zipFile)); | 57 | $this->copy($buildDir, $this->relativeToApp($zipFile)); |
| @@ -137,7 +141,6 @@ final readonly class Packager |
| 137 | \RecursiveIteratorIterator::SELF_FIRST, | 141 | \RecursiveIteratorIterator::SELF_FIRST, |
| 138 | ); | 142 | ); |
| 139 | | 143 | |
| 140 | - $this->mkdir($buildDir); | | |
| 141 | foreach ($files as $file) { | 144 | foreach ($files as $file) { |
| 142 | \assert($file instanceof \SplFileInfo); | 145 | \assert($file instanceof \SplFileInfo); |
| 143 | $target = $buildDir.'/'.substr($file->getPathname(), \strlen($this->appDir) + 1); | 146 | $target = $buildDir.'/'.substr($file->getPathname(), \strlen($this->appDir) + 1); |