Skip to content

Commit

Permalink
Merge pull request #565 from Security-Onion-Solutions/cogburn/short-p…
Browse files Browse the repository at this point in the history
…ublicId

Allow for shorter PublicIDs
  • Loading branch information
coreyogburn authored Jun 21, 2024
2 parents 2d43646 + d1ea2fb commit 160f3d6
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 160f3d6

Please sign in to comment.