From bbf72a5755a4507e0559ecbedbe43bb980621a28 Mon Sep 17 00:00:00 2001 From: "xiaowei.wang" Date: Mon, 18 Dec 2017 11:03:27 +0100 Subject: [PATCH] fix length validation to 20,000 for cognito email message --- aws/validators.go | 4 ++-- aws/validators_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aws/validators.go b/aws/validators.go index 9c5ecb4da85..8aa8b89aefc 100644 --- a/aws/validators.go +++ b/aws/validators.go @@ -1465,8 +1465,8 @@ func validateCognitoUserPoolEmailVerificationMessage(v interface{}, k string) (w es = append(es, fmt.Errorf("%q cannot be less than 6 characters", k)) } - if len(value) > 2000 { - es = append(es, fmt.Errorf("%q cannot be longer than 2000 characters", k)) + if len(value) > 20000 { + es = append(es, fmt.Errorf("%q cannot be longer than 20000 characters", k)) } if !regexp.MustCompile(`[\p{L}\p{M}\p{S}\p{N}\p{P}\s*]*\{####\}[\p{L}\p{M}\p{S}\p{N}\p{P}\s*]*`).MatchString(value) { diff --git a/aws/validators_test.go b/aws/validators_test.go index cf9ec0234bc..b3af78abe15 100644 --- a/aws/validators_test.go +++ b/aws/validators_test.go @@ -2327,7 +2327,7 @@ func TestValidateCognitoUserPoolEmailVerificationMessage(t *testing.T) { "Foo {####}", "{####} Bar", "AZERTYUIOPQSDFGHJKLMWXCVBN?./+%£*¨°0987654321&é\"'(§è!çà)-@^'{####},=ù`$|´”’[å»ÛÁØ]–Ô¥#‰±•", - "{####}" + strings.Repeat("W", 1994), // = 2000 + "{####}" + strings.Repeat("W", 19994), // = 20000 } for _, s := range validValues { @@ -2340,7 +2340,7 @@ func TestValidateCognitoUserPoolEmailVerificationMessage(t *testing.T) { invalidValues := []string{ "Foo", "{###}", - "{####}" + strings.Repeat("W", 1995), // > 2000 + "{####}" + strings.Repeat("W", 19995), // > 20000 } for _, s := range invalidValues {