From cadf598e1c2a345915a21a44518c5a4d5401e2e3 Mon Sep 17 00:00:00 2001 From: Sehrope Sarkuni Date: Thu, 12 Aug 2021 02:29:13 -0400 Subject: [PATCH] Fix libsodium missing from GitHub Releases (#1062) * Fix release GitHub action to enable libsodium * Exit with failure if keys are detected but not compiled with libsodium support Adds a check for the existence of libsodium keys in non-libsodium builds. If keys are detected then exit with failure as the user likely wanted to encrypt all file activity but it is not possible as the application was not compiled with support for libsodium. Previously, wal-g would continue to operate as if no encryption was requested. * Add option to manually trigger GitHub Action CI --- .github/workflows/release.yml | 1 + .github/workflows/unittests.yml | 1 + internal/configure_crypter.go | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e143005ff..a3c7d67d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: env: GO_VERSION: 1.15 + USE_LIBSODIUM: 1 jobs: release-ubuntu: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 38a715168..6370876c0 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,7 @@ name: Unit tests on: + workflow_dispatch: push: branches: [ master ] pull_request: diff --git a/internal/configure_crypter.go b/internal/configure_crypter.go index 62b9fefee..e25814d08 100644 --- a/internal/configure_crypter.go +++ b/internal/configure_crypter.go @@ -14,9 +14,19 @@ package internal // If there is a tag, we can configure the correct implementation of crypter. import ( + "github.com/spf13/viper" + "github.com/wal-g/tracelog" "github.com/wal-g/wal-g/internal/crypto" ) func configureLibsodiumCrypter() crypto.Crypter { + if viper.IsSet(LibsodiumKeySetting) { + tracelog.ErrorLogger.Fatalf("non-empty WALG_LIBSODIUM_KEY but wal-g was not compiled with libsodium") + } + + if viper.IsSet(LibsodiumKeyPathSetting) { + tracelog.ErrorLogger.Fatalf("non-empty WALG_LIBSODIUM_KEY_PATH but wal-g was not compiled with libsodium") + } + return nil }