Skip to content

Commit

Permalink
Allow for shorter PublicIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyogburn committed Jun 21, 2024
1 parent 2d43646 commit d1ea2fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/modules/elastic/elasticdetectionstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 3 additions & 0 deletions server/modules/elastic/elasticdetectionstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d1ea2fb

Please sign in to comment.