From da2faa19a17dccba660d1ec5dae4b0e9ab8518ad Mon Sep 17 00:00:00 2001 From: "A. Elleuch" Date: Fri, 2 Feb 2018 04:43:30 +0100 Subject: [PATCH] Reduce Minio access key minimum length to 3 (#5478) This is a generic minimum value. The current reason is to support Azure blob storage accounts name whose length is less than 5. 3 is the minimum length for Azure. --- cmd/jwt_test.go | 4 ++-- cmd/server-main.go | 2 +- cmd/signature-v4-parser_test.go | 4 ++-- docs/config/README.md | 2 +- pkg/auth/credentials.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/jwt_test.go b/cmd/jwt_test.go index a54e18a3c..b3eb5d5b2 100644 --- a/cmd/jwt_test.go +++ b/cmd/jwt_test.go @@ -39,8 +39,8 @@ func testAuthenticate(authType string, t *testing.T) { secretKey string expectedErr error }{ - // Access key (less than 5 chrs) too small. - {"user", cred.SecretKey, auth.ErrInvalidAccessKeyLength}, + // Access key (less than 3 chrs) too small. + {"u1", cred.SecretKey, auth.ErrInvalidAccessKeyLength}, // Secret key (less than 8 chrs) too small. {cred.AccessKey, "pass", auth.ErrInvalidSecretKeyLength}, // Authentication error. diff --git a/cmd/server-main.go b/cmd/server-main.go index 31dbaaaf6..12388e8a9 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -53,7 +53,7 @@ FLAGS: {{end}}{{end}} ENVIRONMENT VARIABLES: ACCESS: - MINIO_ACCESS_KEY: Custom username or access key of minimum 5 characters in length. + MINIO_ACCESS_KEY: Custom username or access key of minimum 3 characters in length. MINIO_SECRET_KEY: Custom password or secret key of minimum 8 characters in length. BROWSER: diff --git a/cmd/signature-v4-parser_test.go b/cmd/signature-v4-parser_test.go index 594e7f8b7..574589359 100644 --- a/cmd/signature-v4-parser_test.go +++ b/cmd/signature-v4-parser_test.go @@ -116,10 +116,10 @@ func TestParseCredentialHeader(t *testing.T) { expectedErrCode: ErrCredMalformed, }, // Test Case - 4. - // Test case with AccessKey of length 4. + // Test case with AccessKey of length 2. { inputCredentialStr: generateCredentialStr( - "^#@.", + "^#", UTCNow().Format(yyyymmdd), "ABCD", "ABCD", diff --git a/docs/config/README.md b/docs/config/README.md index 2081bf167..448a8f286 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -34,7 +34,7 @@ $ tree ~/.minio |Field|Type|Description| |:---|:---|:---| |``credential``| | Auth credential for object storage and web access.| -|``credential.accessKey`` | _string_ | Access key of minimum 5 characters in length. You may override this field with `MINIO_ACCESS_KEY` environment variable.| +|``credential.accessKey`` | _string_ | Access key of minimum 3 characters in length. You may override this field with `MINIO_ACCESS_KEY` environment variable.| |``credential.secretKey`` | _string_ | Secret key of minimum 8 characters in length. You may override this field with `MINIO_SECRET_KEY` environment variable.| Example: diff --git a/pkg/auth/credentials.go b/pkg/auth/credentials.go index 57e2d2e7f..e99137e98 100644 --- a/pkg/auth/credentials.go +++ b/pkg/auth/credentials.go @@ -25,7 +25,7 @@ import ( const ( // Minimum length for Minio access key. - accessKeyMinLen = 5 + accessKeyMinLen = 3 // Maximum length for Minio access key. // There is no max length enforcement for access keys