This commit is contained in:
Frostebite
2025-12-04 22:22:38 +00:00
parent 38b7286a0d
commit abb275c9fd
4 changed files with 12 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import { ProviderInterface } from '../provider-interface';
import CloudRunnerSecret from '../../options/cloud-runner-secret';
import { ProviderResource } from '../provider-resource';
import { ProviderWorkflow } from '../provider-workflow';
import { quote } from 'shell-quote';
class LocalCloudRunner implements ProviderInterface {
listResources(): Promise<ProviderResource[]> {
@@ -69,12 +70,12 @@ class LocalCloudRunner implements ProviderInterface {
// On Windows, many built-in hooks use POSIX shell syntax. Execute via bash if available.
if (process.platform === 'win32') {
const inline = commands
.replace(/"/g, '\\"')
.replace(/\r/g, '')
.split('\n')
.filter((x) => x.trim().length > 0)
.join(' ; ');
const bashWrapped = `bash -lc "${inline}"`;
// Use shell-quote to properly escape the command string, preventing command injection
const bashWrapped = `bash -lc ${quote([inline])}`;
return await CloudRunnerSystem.Run(bashWrapped);
}