rename password to passphrase (#796)
General user friendliness renaming. Will cause a breaking change in any local environment for developers and Ark.
This commit is contained in:
parent
432f984e61
commit
110e874e5b
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
|||||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||||
CORSO_CI_TESTS: true
|
CORSO_CI_TESTS: true
|
||||||
CORSO_M356_TEST_USER_ID: ${{ secrets.CORSO_M356_TEST_USER_ID }}
|
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 }}
|
TENANT_ID: ${{ secrets.TENANT_ID }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|||||||
@ -237,7 +237,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() {
|
|||||||
|
|
||||||
common, err := st.CommonConfig()
|
common, err := st.CommonConfig()
|
||||||
require.NoError(t, err, "reading common config from storage")
|
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()
|
readM365, err := ac.M365Config()
|
||||||
require.NoError(t, err, "reading m365 config from account")
|
require.NoError(t, err, "reading m365 config from account")
|
||||||
@ -285,7 +285,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount_noFileOnlyOverride
|
|||||||
|
|
||||||
common, err := st.CommonConfig()
|
common, err := st.CommonConfig()
|
||||||
require.NoError(t, err, "reading common config from storage")
|
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()
|
readM365, err := ac.M365Config()
|
||||||
require.NoError(t, err, "reading m365 config from account")
|
require.NoError(t, err, "reading m365 config from account")
|
||||||
|
|||||||
@ -93,7 +93,7 @@ func configureStorage(
|
|||||||
// ensure required properties are present
|
// ensure required properties are present
|
||||||
if err := utils.RequireProps(map[string]string{
|
if err := utils.RequireProps(map[string]string{
|
||||||
storage.Bucket: s3Cfg.Bucket,
|
storage.Bucket: s3Cfg.Bucket,
|
||||||
credentials.CorsoPassword: corso.CorsoPassword,
|
credentials.CorsoPassphrase: corso.CorsoPassphrase,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return storage.Storage{}, err
|
return storage.Storage{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
corsoEVs = []envVar{
|
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."},
|
"It is impossible to use the repository or recover any backups without this key."},
|
||||||
}
|
}
|
||||||
azureEVs = []envVar{
|
azureEVs = []envVar{
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
"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/path"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
@ -526,7 +527,7 @@ func (suite *ExchangeServiceSuite) TestGetRestoreContainer() {
|
|||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
suite.T().Run(test.name, func(t *testing.T) {
|
suite.T().Run(test.name, func(t *testing.T) {
|
||||||
containerID, err := GetRestoreContainer(suite.es, userID, test.option)
|
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 {
|
if test.cleanupFunc != nil {
|
||||||
err = test.cleanupFunc(suite.es, userID, containerID)
|
err = test.cleanupFunc(suite.es, userID, containerID)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func (w *conn) Initialize(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo - issue #75: nil here should be a storage.NewRepoOptions()
|
// 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) {
|
if errors.Is(err, repo.ErrAlreadyInitialized) {
|
||||||
return RepoAlreadyExistsError(err)
|
return RepoAlreadyExistsError(err)
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (w *conn) Initialize(ctx context.Context) error {
|
|||||||
ctx,
|
ctx,
|
||||||
cfg.KopiaCfgDir,
|
cfg.KopiaCfgDir,
|
||||||
bst,
|
bst,
|
||||||
cfg.CorsoPassword,
|
cfg.CorsoPassphrase,
|
||||||
defaultCompressor,
|
defaultCompressor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ func (w *conn) Connect(ctx context.Context) error {
|
|||||||
ctx,
|
ctx,
|
||||||
cfg.KopiaCfgDir,
|
cfg.KopiaCfgDir,
|
||||||
bst,
|
bst,
|
||||||
cfg.CorsoPassword,
|
cfg.CorsoPassphrase,
|
||||||
defaultCompressor,
|
defaultCompressor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,28 +8,28 @@ import (
|
|||||||
|
|
||||||
// envvar consts
|
// envvar consts
|
||||||
const (
|
const (
|
||||||
CorsoPassword = "CORSO_PASSWORD"
|
CorsoPassphrase = "CORSO_PASSPHRASE"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Corso aggregates corso credentials from flag and env_var values.
|
// Corso aggregates corso credentials from flag and env_var values.
|
||||||
type Corso struct {
|
type Corso struct {
|
||||||
CorsoPassword string // required
|
CorsoPassphrase string // required
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCorso is a helper for aggregating Corso secrets and credentials.
|
// GetCorso is a helper for aggregating Corso secrets and credentials.
|
||||||
func GetCorso() Corso {
|
func GetCorso() Corso {
|
||||||
// todo (rkeeprs): read from either corso config file or env vars.
|
// todo (rkeeprs): read from either corso config file or env vars.
|
||||||
// https://github.com/alcionai/corso/issues/120
|
// https://github.com/alcionai/corso/issues/120
|
||||||
corsoPasswd := os.Getenv(CorsoPassword)
|
corsoPassph := os.Getenv(CorsoPassphrase)
|
||||||
|
|
||||||
return Corso{
|
return Corso{
|
||||||
CorsoPassword: corsoPasswd,
|
CorsoPassphrase: corsoPassph,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Corso) Validate() error {
|
func (c Corso) Validate() error {
|
||||||
check := map[string]string{
|
check := map[string]string{
|
||||||
CorsoPassword: c.CorsoPassword,
|
CorsoPassphrase: c.CorsoPassphrase,
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range check {
|
for k, v := range check {
|
||||||
|
|||||||
@ -7,14 +7,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CommonConfig struct {
|
type CommonConfig struct {
|
||||||
credentials.Corso // requires: CorsoPassword
|
credentials.Corso // requires: CorsoPassphrase
|
||||||
|
|
||||||
KopiaCfgDir string
|
KopiaCfgDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
// config key consts
|
// config key consts
|
||||||
const (
|
const (
|
||||||
keyCommonCorsoPassword = "common_corsoPassword"
|
keyCommonCorsoPassphrase = "common_corsoPassphrase"
|
||||||
keyCommonKopiaCfgDir = "common_kopiaCfgDir"
|
keyCommonKopiaCfgDir = "common_kopiaCfgDir"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ const (
|
|||||||
// serialize into the map are expected to be strings.
|
// serialize into the map are expected to be strings.
|
||||||
func (c CommonConfig) StringConfig() (map[string]string, error) {
|
func (c CommonConfig) StringConfig() (map[string]string, error) {
|
||||||
cfg := map[string]string{
|
cfg := map[string]string{
|
||||||
keyCommonCorsoPassword: c.CorsoPassword,
|
keyCommonCorsoPassphrase: c.CorsoPassphrase,
|
||||||
keyCommonKopiaCfgDir: c.KopiaCfgDir,
|
keyCommonKopiaCfgDir: c.KopiaCfgDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func (s Storage) CommonConfig() (CommonConfig, error) {
|
|||||||
c := CommonConfig{}
|
c := CommonConfig{}
|
||||||
|
|
||||||
if len(s.Config) > 0 {
|
if len(s.Config) > 0 {
|
||||||
c.CorsoPassword = orEmptyString(s.Config[keyCommonCorsoPassword])
|
c.CorsoPassphrase = orEmptyString(s.Config[keyCommonCorsoPassphrase])
|
||||||
c.KopiaCfgDir = orEmptyString(s.Config[keyCommonKopiaCfgDir])
|
c.KopiaCfgDir = orEmptyString(s.Config[keyCommonKopiaCfgDir])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ func (s Storage) CommonConfig() (CommonConfig, error) {
|
|||||||
|
|
||||||
// ensures all required properties are present
|
// ensures all required properties are present
|
||||||
func (c CommonConfig) validate() error {
|
func (c CommonConfig) validate() error {
|
||||||
if len(c.CorsoPassword) == 0 {
|
if len(c.CorsoPassphrase) == 0 {
|
||||||
return errors.Wrap(errMissingRequired, credentials.CorsoPassword)
|
return errors.Wrap(errMissingRequired, credentials.CorsoPassphrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
// kopiaCfgFilePath is not required
|
// kopiaCfgFilePath is not required
|
||||||
|
|||||||
@ -20,7 +20,7 @@ func TestCommonCfgSuite(t *testing.T) {
|
|||||||
|
|
||||||
var goodCommonConfig = storage.CommonConfig{
|
var goodCommonConfig = storage.CommonConfig{
|
||||||
Corso: credentials.Corso{
|
Corso: credentials.Corso{
|
||||||
CorsoPassword: "passwd",
|
CorsoPassphrase: "passph",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ func (suite *CommonCfgSuite) TestCommonConfig_Config() {
|
|||||||
key string
|
key string
|
||||||
expect string
|
expect string
|
||||||
}{
|
}{
|
||||||
{"common_corsoPassword", cfg.CorsoPassword},
|
{"common_corsoPassphrase", cfg.CorsoPassphrase},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.T().Run(test.key, func(t *testing.T) {
|
suite.T().Run(test.key, func(t *testing.T) {
|
||||||
@ -51,7 +51,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig() {
|
|||||||
out, err := s.CommonConfig()
|
out, err := s.CommonConfig()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, in.CorsoPassword, out.CorsoPassword)
|
assert.Equal(t, in.CorsoPassphrase, out.CorsoPassphrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
||||||
@ -60,7 +60,7 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
|||||||
name string
|
name string
|
||||||
cfg storage.CommonConfig
|
cfg storage.CommonConfig
|
||||||
}{
|
}{
|
||||||
{"missing password", storage.CommonConfig{}},
|
{"missing passphrase", storage.CommonConfig{}},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.T().Run(test.name, func(t *testing.T) {
|
suite.T().Run(test.name, func(t *testing.T) {
|
||||||
@ -75,9 +75,9 @@ func (suite *CommonCfgSuite) TestStorage_CommonConfig_InvalidCases() {
|
|||||||
amend func(storage.Storage)
|
amend func(storage.Storage)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"missing password",
|
"missing passphrase",
|
||||||
func(s storage.Storage) {
|
func(s storage.Storage) {
|
||||||
s.Config["common_corsoPassword"] = ""
|
s.Config["common_corsoPassphrase"] = ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user