diff --git a/server/modules/elastic/elasticdetectionstore.go b/server/modules/elastic/elasticdetectionstore.go index f13b7951..77fb7c28 100644 --- a/server/modules/elastic/elasticdetectionstore.go +++ b/server/modules/elastic/elasticdetectionstore.go @@ -68,7 +68,7 @@ func (store *ElasticDetectionstore) validateId(id string, label string) error { func (store *ElasticDetectionstore) validatePublicId(id string, label string) error { var err error - isValidId := regexp.MustCompile(`^[A-Za-z0-9-_]{5,128}$`).MatchString + isValidId := regexp.MustCompile(`^[A-Za-z0-9-_]{3,128}$`).MatchString if !isValidId(id) { err = fmt.Errorf("invalid ID for %s", label) } diff --git a/server/modules/elastic/elasticdetectionstore_test.go b/server/modules/elastic/elasticdetectionstore_test.go index 56d9a4cb..506652fd 100644 --- a/server/modules/elastic/elasticdetectionstore_test.go +++ b/server/modules/elastic/elasticdetectionstore_test.go @@ -122,6 +122,9 @@ func TestDetectionValidatePublicIdValid(t *testing.T) { err := store.validatePublicId("12345", "test") assert.NoError(t, err) + err = store.validatePublicId("123", "test") + assert.NoError(t, err) + err = store.validatePublicId("123456", "test") assert.NoError(t, err)