Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #217 from secrethub/feature/setup-code-validation
Browse files Browse the repository at this point in the history
Loosen setup code validation
  • Loading branch information
SimonBarendse authored Aug 13, 2020
2 parents 846d80e + ecb3df5 commit 66d0364
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internals/api/patterns.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
whitelistOrgName = regexp.MustCompile(fmt.Sprintf(`(?i)^(%s{%d,%d})$`, patternUniformNameCharacters, uniformNameMinimumLength, uniformNameMaximumLength))
whitelistFullName = regexp.MustCompile(fmt.Sprintf(`(?i)^(%s{1,128})$`, patternFullName))
whitelistDescription = regexp.MustCompile(fmt.Sprintf(`(?i)^(%s)$`, patternDescription))
whitelistSetupCode = regexp.MustCompile("^su-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$")
whitelistSetupCode = regexp.MustCompile("^su-[a-zA-Z0-9-]{8,64}")

whitelistAtLeastOneAlphanumeric = regexp.MustCompile(fmt.Sprintf("%s{1,}", patternAlphanumeric))

Expand Down Expand Up @@ -90,7 +90,7 @@ var (
ErrInvalidGCPServiceAccountEmail = errAPI.Code("invalid_service_account_email").StatusError("not a valid GCP service account email", http.StatusBadRequest)
ErrNotUserManagerGCPServiceAccountEmail = errAPI.Code("require_user_managed_service_account").StatusError("provided GCP service account email is not for a user-manager service account", http.StatusBadRequest)
ErrInvalidGCPKMSResourceID = errAPI.Code("invalid_key_resource_id").StatusError("not a valid resource ID, expected: projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY", http.StatusBadRequest)
ErrInvalidSetupCode = errAPI.Code("invalid_setup_code").StatusError("setup codes consist of the su- prefix followed by 4 groups of lowercase alphanumeric strings separated by dashes", http.StatusBadRequest)
ErrInvalidSetupCode = errAPI.Code("invalid_setup_code").StatusError("setup code starts with su- and is followed by groups of letters and numbers separated by dashes", http.StatusBadRequest)
)

// ValidateNamespace validates a username.
Expand Down

0 comments on commit 66d0364

Please sign in to comment.