jdecool/scaleway-runtimepublic Fork
⑂ 38787d3
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

fix: build the deployment zip in a private temp directoryUnverified

The build copy holds the application's .env files, which were readable by
other local users, and an existing path at the build location was reused.
Jérémy DECOOL committed 2026-11-13T22:30:49+01:00 Browse files
38787d3 parent: 01e3678
modified src/Packager.php +4 -1
@@ -48,6 +48,10 @@ final readonly class Packager
4848 }
4949
5050 $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+ }
5155 try {
5256 $this->log('Copying the application to '.$buildDir);
5357 $this->copy($buildDir, $this->relativeToApp($zipFile));
@@ -137,7 +141,6 @@ final readonly class Packager
137141 \RecursiveIteratorIterator::SELF_FIRST,
138142 );
139143
140- $this->mkdir($buildDir);
141144 foreach ($files as $file) {
142145 \assert($file instanceof \SplFileInfo);
143146 $target = $buildDir.'/'.substr($file->getPathname(), \strlen($this->appDir) + 1);
@@ -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);