From 9e9e0fd6af8eb312f399e9e215a008c6760f6b41 Mon Sep 17 00:00:00 2001 From: Davlatjon Shavkatov Date: Thu, 22 Feb 2024 02:51:47 +0500 Subject: [PATCH] fix(plugins/git): disallow modify of local GPG conf on non-CI env --- plugins/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git.sh b/plugins/git.sh index cb37f29..078bfa0 100644 --- a/plugins/git.sh +++ b/plugins/git.sh @@ -20,7 +20,7 @@ prepare() { git config --local gpg.program gpg log_verbose "Git GPG sign and key ID [$GPG_KEY_ID] are set" fi - if [[ -n "$GPG_PASSPHRASE" ]]; then + if [[ -n "$CI" && -n "$GPG_PASSPHRASE" ]]; then echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf gpg-connect-agent reloadagent /bye @@ -43,7 +43,7 @@ cleanup() { git config --local --unset gpg.program log_verbose "Git GPG sign unset" fi - if [[ -n "$GPG_PASSPHRASE" ]]; then + if [[ -n "$CI" && -n "$GPG_PASSPHRASE" ]]; then rm -rf ~/.gnupg/gpg-agent.conf rm -rf ~/.gnupg/gpg.conf log_verbose "Git GPG config cleanup"