mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
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:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user