Skip to content

Commit c8cc9f2

Browse files
fix: quote sync tool binary before local shell execution
1 parent 6065ce7 commit c8cc9f2

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

deployer/dev/task/dump.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
$dumpLocationOptions = usingPhpSyncTool($dbSyncTool) ? '' : "-kd $dbDumpDir -dn $dbDumpFilename";
2727

2828
$dbSyncToolConfigPath = get('dev_db_sync_tool_config_path');
29-
runLocally("$dbSyncTool -f $dbSyncToolConfigPath/$dbSyncToolSync -y $dumpLocationOptions $additionalOptions", ['real_time_output' => true]);
29+
runLocally(escapeshellarg($dbSyncTool) . " -f $dbSyncToolConfigPath/$dbSyncToolSync -y $dumpLocationOptions $additionalOptions", ['real_time_output' => true]);
3030
})
3131
->desc('Sync database with drush');

deployer/dev/task/import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
$dbSyncTool = requireSyncTool('import');
1212

1313
$dbSyncToolConfigPath = get('dev_db_sync_tool_config_path');
14-
runLocally("$dbSyncTool -f $dbSyncToolConfigPath/$dbSyncToolSync -y -i $dbDumpDir/$dbDumpFilename.sql", ['real_time_output' => true]);
14+
runLocally(escapeshellarg($dbSyncTool) . " -f $dbSyncToolConfigPath/$dbSyncToolSync -y -i $dbDumpDir/$dbDumpFilename.sql", ['real_time_output' => true]);
1515
})
1616
->desc('Sync database with drush');

deployer/dev/task/sync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
$dbSyncTool = requireSyncTool('sync');
5151

5252
$dbSyncToolConfigPath = get('dev_db_sync_tool_config_path');
53-
runLocally("$dbSyncTool -f $dbSyncToolConfigPath/$dbSyncToolSync -y $additionalOptions", ['real_time_output' => true]);
53+
runLocally(escapeshellarg($dbSyncTool) . " -f $dbSyncToolConfigPath/$dbSyncToolSync -y $additionalOptions", ['real_time_output' => true]);
5454
info("💽 Database from $target synced successfully");
5555
})
5656
->desc('Sync database with db-sync-tool');

deployer/feature/task/feature_sync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function resolveDatabaseHostToIp(string $hostname): void
133133
// php-sync-tool has file sync integrated, no separate file_sync_tool call needed
134134
$withFiles = $isPhpSyncTool && false !== get('file_sync_tool') ? '--with-files' : '';
135135
info('Synching database');
136-
runLocally("$dbSyncTool -f {{feature_sync_config}} --target-path {{feature_sync_target_path}} $useRsync $withFiles -y $optionalVerbose");
136+
runLocally(escapeshellarg($dbSyncTool) . " -f {{feature_sync_config}} --target-path {{feature_sync_target_path}} $useRsync $withFiles -y $optionalVerbose");
137137
$synced = true;
138138
} else {
139139
debug("Skipping database sync, command \”$dbSyncTool\” not available");

deployer/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function commandExistLocally(string $command): bool
138138
*/
139139
function isExecutableLocally(string $path): bool
140140
{
141-
return testLocally("[ -x $path ]");
141+
return testLocally('[ -x ' . escapeshellarg($path) . ' ]');
142142
}
143143

144144
/**

deployer/sync/task/database_backup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if (syncToolAvailableLocally($dbSyncTool)) {
1717
$useRsync = usingPhpSyncTool($dbSyncTool) ? '' : '--use-rsync';
1818
info('Generating a database backup');
19-
runLocally("$dbSyncTool -f {{sync_database_backup_config}} $useRsync -y $optionalVerbose");
19+
runLocally(escapeshellarg($dbSyncTool) . " -f {{sync_database_backup_config}} $useRsync -y $optionalVerbose");
2020
} else {
2121
debug("Skipping database backup, $dbSyncTool not available");
2222
}

0 commit comments

Comments
 (0)