Skip to content

Make validation of service accounts less strict #2277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
2 changes: 1 addition & 1 deletion build/terraform-mapper
14 changes: 9 additions & 5 deletions third_party/terraform/utils/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (

ServiceAccountLinkRegexPrefix = "projects/" + ProjectRegexWildCard + "/serviceAccounts/"
PossibleServiceAccountNames = []string{
AppEngineServiceAccountNameRegex,
ServiceDefaultAccountNameRegex,
ComputeServiceAccountNameRegex,
CreatedServiceAccountNameRegex,
}
Expand All @@ -51,12 +51,16 @@ var (

// Format of service accounts created through the API
CreatedServiceAccountNameRegex = fmt.Sprintf(RFC1035NameTemplate, 4, 28) + "@" + ProjectNameInDNSFormRegex + "\\.iam\\.gserviceaccount\\.com$"
ProjectNameInDNSFormRegex = "[-a-z0-9\\.]{1,63}"

// Format of default App Engine service accounts created by Google
AppEngineServiceAccountNameRegex = ProjectRegex + "@appspot.gserviceaccount.com"
// Format of service-created service account
// examples are:
// [email protected]
// [email protected]
// [email protected]
ServiceDefaultAccountNameRegex = ProjectRegex + "@[a-z]+.gserviceaccount.com$"

ProjectNameRegex = "^[A-Za-z0-9-'\"\\s!]{4,30}$"
ProjectNameInDNSFormRegex = "[-a-z0-9\\.]{1,63}"
ProjectNameRegex = "^[A-Za-z0-9-'\"\\s!]{4,30}$"
)

var rfc1918Networks = []string{
Expand Down