fix(compose): resolve ../ bind sources in raw compose mode

oldRawParser made the bind directory of a long-syntax source like
../data at {workdir}./data, next to the path that Docker Compose uses.
Resolve the source with replaceLocalSource(), as the compose parsers do,
so Coolify makes the directory that the container mounts. A source that
resolves above / now stops the deployment before remote work.

Closes #4055
This commit is contained in:
Andras Bacsai
2026-10-18 12:09:42 +02:00
parent 6d4551faec
commit 34b3a18307
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -2132,7 +2132,7 @@ class Application extends BaseModel
continue;
}
if ($source->startsWith('.')) {
$source = str($workdir.$source->after('.'));
$source = replaceLocalSource($source, str($workdir));
}
$mkdirCommand = rawComposeBindMkdirCommand($source->value());
if ($mkdirCommand !== null) {
+11
View File
@@ -246,3 +246,14 @@ YAML);
expect($application->docker_compose_raw)->toContain('appdata');
});
it('resolves parent directory segments in long-form bind sources before remote work', function () {
Process::fake();
$application = makeRawComposeApplication(rawComposeBindSource('../../../../../../outside'));
expect(fn () => $application->oldRawParser())
->toThrow(Exception::class, 'resolves to a path above /');
Process::assertNothingRan();
});