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

Loosen setup code validation #217

Merged
merged 1 commit into from
Aug 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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