The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(packages): shell command built from environment values (#12386)
Zeroday BYTE4aae6bae1ccf
diff --git a/packages/twenty-server/src/engine/core-modules/serverless/commands/add-packages.command.ts b/packages/twenty-server/src/engine/core-modules/serverless/commands/add-packages.command.tsindex 22760294423..c57bc8a4849 100644--- a/packages/twenty-server/src/engine/core-modules/serverless/commands/add-packages.command.ts+++ b/packages/twenty-server/src/engine/core-modules/serverless/commands/add-packages.command.ts@@ -1,13 +1,13 @@import { Logger } from '@nestjs/common';+import { execFile } from 'child_process';import * as fs from 'fs/promises';import { resolve } from 'path';import { promisify } from 'util';-import { exec } from 'child_process';import { Command, CommandRunner, Option } from 'nest-commander';-const execPromise = promisify(exec);+const execFilePromise = promisify(execFile);@Command({name: 'serverless:add-packages',@@ -40,7 +40,6 @@ export class AddPackagesCommand extends CommandRunner {);const currentVersion = await this.getLastLayerVersion();-const newVersion = currentVersion + 1;const currentVersionFolder = `${layersFolder}/${currentVersion}`;@@ -71,12 +70,11 @@ export class AddPackagesCommand extends CommandRunner {private getAbsoluteFilePath(path: string) {const rootPath = process.cwd();-return resolve(rootPath, path);}private async addToGit(folderPath: string) {- await execPromise(`git add ${folderPath}`);+ await execFilePromise('git', ['add', folderPath]);}private async cleanPackageInstallation(folderPath: string) {@@ -95,7 +93,7 @@ export class AddPackagesCommand extends CommandRunner {for (const packageName of packages) {this.logger.log(`- adding '${packageName}'...`);try {- await execPromise(`yarn add ${packageName}`, {+ await execFilePromise('yarn', ['add', packageName], {cwd: folderPath,});} catch (error) {