From 565da5f354758903445db6cbee3bdba9ec697b9e Mon Sep 17 00:00:00 2001 From: Nick Merwin Date: Mon, 28 Jun 2021 17:56:13 -0700 Subject: swap exec for execFile in fetchGitData Credit: Adar Zandberg from the CxSCA AppSec team at Checkmarx. * devDependency updates from Dependabot alerts * bump version --- lib/fetchGitData.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/fetchGitData.js b/lib/fetchGitData.js index ee69246..7674222 100644 --- a/lib/fetchGitData.js +++ b/lib/fetchGitData.js @@ -1,6 +1,6 @@ 'use strict'; -const { exec } = require('child_process'); +const { execFile } = require('child_process'); require('./logger')(); function fetchGitData(git, cb) { @@ -40,7 +40,7 @@ function fetchGitData(git, cb) { } //-- Use git? - exec(`git rev-parse --verify ${git.head.id}`, err => { + execFile('git', ['rev-parse', '--verify', git.head.id], err => { if (err) { // git is not available... git.head.author_name = git.head.author_name || 'Unknown Author'; @@ -56,7 +56,7 @@ function fetchGitData(git, cb) { } function fetchBranch(git, cb) { - exec('git branch', (err, branches) => { + execFile('git', ['branch'], (err, branches) => { if (err) { return cb(err); } @@ -69,7 +69,7 @@ function fetchBranch(git, cb) { const REGEX_COMMIT_DETAILS = /\nauthor (.+?) <([^>]*)>.+\ncommitter (.+?) <([^>]*)>.+[\S\s]*?\n\n(.*)/m; function fetchHeadDetails(git, cb) { - exec(`git cat-file -p ${git.head.id}`, (err, response) => { + execFile('git', ['cat-file', '-p', git.head.id], (err, response) => { if (err) { return cb(err); } @@ -89,7 +89,7 @@ function fetchHeadDetails(git, cb) { } function fetchRemotes(git, cb) { - exec('git remote -v', (err, remotes) => { + execFile('git', ['remote', '-v'], (err, remotes) => { if (err) { return cb(err); } -- cgit v1.2.3