From 20ea791f28338e46bf15fd7510c68b4bea790a93 Mon Sep 17 00:00:00 2001 From: Jok <67024248+jokreliable@users.noreply.github.com> Date: Tue, 15 Nov 2022 18:51:19 -0800 Subject: wrap pipeline commands for submoduleForeach in quotes (#964) * wrap pipeline commands for submoduleForeach in quotes * Update src/git-auth-helper.ts drop extraneous space. Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * Followed CONTRIBUTING.md instructions, updating dist/index.js * fixed package-lock.json * updating the pipeline so it runs from sh Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- src/git-auth-helper.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index 3c6db8e..6e3ad28 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -157,7 +157,8 @@ class GitAuthHelper { // by process creation audit events, which are commonly logged. For more information, // refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing const output = await this.git.submoduleForeach( - `git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`, + // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline + `sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`, this.settings.nestedSubmodules ) @@ -365,7 +366,8 @@ class GitAuthHelper { const pattern = regexpHelper.escape(configKey) await this.git.submoduleForeach( - `git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`, + // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline + `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true ) } -- cgit v1.2.3