diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a15602492..8dc8d3844 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} CORSO_CI_TESTS: true CORSO_M356_TEST_USER_ID: ${{ secrets.CORSO_M356_TEST_USER_ID }} - CORSO_PASSWORD: ${{ secrets.INTEGRATION_TEST_CORSO_PASSWORD }} + CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }} TENANT_ID: ${{ secrets.TENANT_ID }} run: | set -euo pipefail diff --git a/src/cli/config/config_test.go b/src/cli/config/config_test.go index 8f86bc768..474645f02 100644 --- a/src/cli/config/config_test.go +++ b/src/cli/config/config_test.go @@ -237,7 +237,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() { common, err := st.CommonConfig() require.NoError(t, err, "reading common config from storage") - assert.Equal(t, common.CorsoPassword, os.Getenv(credentials.CorsoPassword)) + assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase)) readM365, err := ac.M365Config() require.NoError(t, err, "reading m365 config from account") @@ -285,7 +285,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount_noFileOnlyOverride common, err := st.CommonConfig() require.NoError(t, err, "reading common config from storage") - assert.Equal(t, common.CorsoPassword, os.Getenv(credentials.CorsoPassword)) + assert.Equal(t, common.CorsoPassphrase, os.Getenv(credentials.CorsoPassphrase)) readM365, err := ac.M365Config() require.NoError(t, err, "reading m365 config from account") diff --git a/src/cli/config/storage.go b/src/cli/config/storage.go index 3481538c2..abb3640fd 100644 --- a/src/cli/config/storage.go +++ b/src/cli/config/storage.go @@ -92,8 +92,8 @@ func configureStorage( // ensure required properties are present if err := utils.RequireProps(map[string]string{ - storage.Bucket: s3Cfg.Bucket, - credentials.CorsoPassword: corso.CorsoPassword, + storage.Bucket: s3Cfg.Bucket, + credentials.CorsoPassphrase: corso.CorsoPassphrase, }); err != nil { return storage.Storage{}, err } diff --git a/src/cli/help/env.go b/src/cli/help/env.go index b36054c0c..b789ec5c5 100644 --- a/src/cli/help/env.go +++ b/src/cli/help/env.go @@ -63,7 +63,7 @@ const ( var ( corsoEVs = []envVar{ - {corso, "CORSO_PASSWORD", "Passphrase to protect repository encryption material." + + {corso, "CORSO_PASSPHRASE", "Passphrase to protect repository encryption material." + "It is impossible to use the repository or recover any backups without this key."}, } azureEVs = []envVar{ diff --git a/src/internal/connector/exchange/exchange_service_test.go b/src/internal/connector/exchange/exchange_service_test.go index 4a5b07503..9b4ab0140 100644 --- a/src/internal/connector/exchange/exchange_service_test.go +++ b/src/internal/connector/exchange/exchange_service_test.go @@ -12,6 +12,7 @@ import ( "github.com/alcionai/corso/src/internal/common" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/mockconnector" + "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/path" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/account" @@ -526,7 +527,7 @@ func (suite *ExchangeServiceSuite) TestGetRestoreContainer() { for _, test := range tests { suite.T().Run(test.name, func(t *testing.T) { containerID, err := GetRestoreContainer(suite.es, userID, test.option) - require.True(t, test.checkError(t, err)) + require.True(t, test.checkError(t, err, support.ConnectorStackErrorTrace(err))) if test.cleanupFunc != nil { err = test.cleanupFunc(suite.es, userID, containerID) diff --git a/src/internal/kopia/conn.go b/src/internal/kopia/conn.go index d39d0d7ab..ac483d7f3 100644 --- a/src/internal/kopia/conn.go +++ b/src/internal/kopia/conn.go @@ -67,7 +67,7 @@ func (w *conn) Initialize(ctx context.Context) error { } // todo - issue #75: nil here should be a storage.NewRepoOptions() - if err = repo.Initialize(ctx, bst, nil, cfg.CorsoPassword); err != nil { + if err = repo.Initialize(ctx, bst, nil, cfg.CorsoPassphrase); err != nil { if errors.Is(err, repo.ErrAlreadyInitialized) { return RepoAlreadyExistsError(err) } @@ -79,7 +79,7 @@ func (w *conn) Initialize(ctx context.Context) error { ctx, cfg.KopiaCfgDir, bst, - cfg.CorsoPassword, + cfg.CorsoPassphrase, defaultCompressor, ) } @@ -100,7 +100,7 @@ func (w *conn) Connect(ctx context.Context) error { ctx, cfg.KopiaCfgDir, bst, - cfg.CorsoPassword, + cfg.CorsoPassphrase, defaultCompressor, ) } diff --git a/src/pkg/credentials/corso.go b/src/pkg/credentials/corso.go index ad9d6d90f..297f2030a 100644 --- a/src/pkg/credentials/corso.go +++ b/src/pkg/credentials/corso.go @@ -8,28 +8,28 @@ import ( // envvar consts const ( - CorsoPassword = "CORSO_PASSWORD" + CorsoPassphrase = "CORSO_PASSPHRASE" ) // Corso aggregates corso credentials from flag and env_var values. type Corso struct { - CorsoPassword string // required + CorsoPassphrase string // required } // GetCorso is a helper for aggregating Corso secrets and credentials. func GetCorso() Corso { // todo (rkeeprs): read from either corso config file or env vars. // https://github.com/alcionai/corso/issues/120 - corsoPasswd := os.Getenv(CorsoPassword) + corsoPassph := os.Getenv(CorsoPassphrase) return Corso{ - CorsoPassword: corsoPasswd, + CorsoPassphrase: corsoPassph, } } func (c Corso) Validate() error { check := map[string]string{ - CorsoPassword: c.CorsoPassword, + CorsoPassphrase: c.CorsoPassphrase, } for k, v := range check { diff --git a/src/pkg/storage/common.go b/src/pkg/storage/common.go index fdd736a4f..fd5bb24dd 100644 --- a/src/pkg/storage/common.go +++ b/src/pkg/storage/common.go @@ -7,15 +7,15 @@ import ( ) type CommonConfig struct { - credentials.Corso // requires: CorsoPassword + credentials.Corso // requires: CorsoPassphrase KopiaCfgDir string } // config key consts const ( - keyCommonCorsoPassword = "common_corsoPassword" - keyCommonKopiaCfgDir = "common_kopiaCfgDir" + keyCommonCorsoPassphrase = "common_corsoPassphrase" + keyCommonKopiaCfgDir = "common_kopiaCfgDir" ) // StringConfig transforms a commonConfig struct into a plain @@ -23,8 +23,8 @@ const ( // serialize into the map are expected to be strings. func (c CommonConfig) StringConfig() (map[string]string, error) { cfg := map[string]string{ - keyCommonCorsoPassword: c.CorsoPassword, - keyCommonKopiaCfgDir: c.KopiaCfgDir, + keyCommonCorsoPassphrase: c.CorsoPassphrase, + keyCommonKopiaCfgDir: c.KopiaCfgDir, } return cfg, c.validate() @@ -35,7 +35,7 @@ func (s Storage) CommonConfig() (CommonConfig, error) { c := CommonConfig{} if len(s.Config) > 0 { - c.CorsoPassword = orEmptyString(s.Config[keyCommonCorsoPassword]) + c.CorsoPassphrase = orEmptyString(s.Config[keyCommonCorsoPassphrase]) c.KopiaCfgDir = orEmptyString(s.Config[keyCommonKopiaCfgDir]) } @@ -44,8 +44,8 @@ func (s Storage) CommonConfig() (CommonConfig, error) { // ensures all required properties are present func (c CommonConfig) validate() error { - if len(c.CorsoPassword) == 0 { - return errors.Wrap(errMissingRequired, credentials.CorsoPassword) + if len(c.CorsoPassphrase) == 0 { + return errors.Wrap(errMissingRequired, credentials.CorsoPassphrase) } // kopiaCfgFilePath is not required diff --git a/src/pkg/storage/common_test.go b/src/pkg/storage/common_test.go index 5c8261685..da35f942a 100644 --- a/src/pkg/storage/common_test.go +++ b/src/pkg/storage/common_test.go @@ -20,7 +20,7 @@ func TestCommonCfgSuite(t *testing.T) { var goodCommonConfig = storage.CommonConfig{ Corso: credentials.Corso{ - CorsoPassword: "passwd", + CorsoPassphrase: "passph", }, } @@ -33,7 +33,7 @@ func (suite *CommonCfgSuite) TestCommonConfig_Config() { key string expect string }{ - {"common_corsoPassword", cfg.CorsoPassword}, + {"common_corsoPassphrase", cfg.CorsoPassphrase}, } for _, test := range table { suite.T().Run(test.key, func(t *testing.T) { @@ -51,7 +51,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig() { out, err := s.CommonConfig() assert.NoError(t, err) - assert.Equal(t, in.CorsoPassword, out.CorsoPassword) + assert.Equal(t, in.CorsoPassphrase, out.CorsoPassphrase) } func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() { @@ -60,7 +60,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() { name string cfg storage.CommonConfig }{ - {"missing password", storage.CommonConfig{}}, + {"missing passphrase", storage.CommonConfig{}}, } for _, test := range table { suite.T().Run(test.name, func(t *testing.T) { @@ -75,9 +75,9 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() { amend func(storage.Storage) }{ { - "missing password", + "missing passphrase", func(s storage.Storage) { - s.Config["common_corsoPassword"] = "" + s.Config["common_corsoPassphrase"] = "" }, }, }