Skip to content

Commit

Permalink
fix: disable passord length checks so influxdb validates passwords (#534
Browse files Browse the repository at this point in the history
) (#538)

Disable password length checks and let influxd
do all password strength checks.

closes #533

(cherry picked from commit df2e687)

closes #535
  • Loading branch information
davidby-influx committed Apr 4, 2024
1 parent a5a99cc commit 3ca7925
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
31 changes: 0 additions & 31 deletions clients/setup/setup_test.go
Expand Up @@ -231,37 +231,6 @@ func Test_SetupSuccessInteractive(t *testing.T) {
}, strings.Split(bytesWritten.String(), "\n"))
}

func Test_SetupPasswordParamTooShort(t *testing.T) {
t.Parallel()

retentionSecs := int64(duration.Week.Seconds())
params := setup.Params{
Username: "user",
Password: "2short",
AuthToken: "mytoken",
Org: "org",
Bucket: "bucket",
Retention: fmt.Sprintf("%ds", retentionSecs),
Force: false,
}

ctrl := gomock.NewController(t)
client := mock.NewMockSetupApi(ctrl)
client.EXPECT().GetSetup(gomock.Any()).Return(api.ApiGetSetupRequest{ApiService: client})
client.EXPECT().GetSetupExecute(gomock.Any()).Return(api.InlineResponse200{Allowed: api.PtrBool(true)}, nil)

configSvc := mock.NewMockConfigService(ctrl)
configSvc.EXPECT().ListConfigs().Return(nil, nil)

stdio := mock.NewMockStdIO(ctrl)
cli := setup.Client{
CLI: clients.CLI{ConfigService: configSvc, ActiveConfig: config.Config{}, StdIO: stdio},
SetupApi: client,
}
err := cli.Setup(context.Background(), &params)
require.Equal(t, clients.ErrPasswordIsTooShort, err)
}

func Test_SetupCancelAtConfirmation(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 2 additions & 1 deletion pkg/stdio/stdio.go
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/mattn/go-isatty"
)

const MinPasswordLen = 8
// Disable password length checking to let influxdb handle it
const MinPasswordLen = 0

type StdIO interface {
// Write prints some bytes to stdout.
Expand Down

0 comments on commit 3ca7925

Please sign in to comment.