From e865c128f2b7a51dce491a02e0fa6376f939245d Mon Sep 17 00:00:00 2001 From: Rui Rocha Date: Tue, 24 Sep 2024 17:08:22 +0100 Subject: [PATCH] replaced execSync with execFileSync to fix codeql issue --- .../nodejs-kafka-client-lib/generate-proto.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/nodejs-kafka-client-lib/generate-proto.ts b/packages/nodejs-kafka-client-lib/generate-proto.ts index 0092edc..8d8fed4 100644 --- a/packages/nodejs-kafka-client-lib/generate-proto.ts +++ b/packages/nodejs-kafka-client-lib/generate-proto.ts @@ -1,17 +1,20 @@ -const { execSync } = require('child_process'); +const { execFileSync } = require('child_process'); const path = require('path'); const protoDir = path.resolve(__dirname, 'src/protobuff'); const protoFile = path.resolve(protoDir, 'messages.proto'); const outDir = path.resolve(protoDir); -const command = `protoc --ts_out=service=true:${outDir} --proto_path=${protoDir} ${protoFile}`; - -console.log('Running command:', command); +const command = 'protoc'; +const args = [ + `--ts_out=service=true:${outDir}`, + `--proto_path=${protoDir}`, + protoFile +]; try { - execSync(command, { stdio: 'inherit' }); + execFileSync(command, args, { stdio: 'inherit' }); } catch (error) { console.error('Error executing command:', error); process.exit(1); -} \ No newline at end of file +}