Skip to content

Commit

Permalink
Fix regex quoting
Browse files Browse the repository at this point in the history
Signed-off-by: Shawn Wang <[email protected]>
  • Loading branch information
wsquan171 committed Oct 18, 2023
1 parent 8e5feb8 commit 604d78d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,8 @@ func (processor logRequestProcessor) Process(req *http.Request) error {
}

// Replace sensitive information in HTTP headers
authHeaderRegexp := regexp.MustCompile("(?i)Authorization:.*")
cspHeaderRegexp := regexp.MustCompile("(?i)Csp-Auth-Token:.*")
authHeaderRegexp := regexp.MustCompile(`(?i)Authorization:.*`)
cspHeaderRegexp := regexp.MustCompile(`(?i)Csp-Auth-Token:.*`)
replaced := authHeaderRegexp.ReplaceAllString(string(reqDump), "<Omitted Authorization header>")
replaced = cspHeaderRegexp.ReplaceAllString(replaced, "<Omitted Csp-Auth-Token header>")

Expand Down
2 changes: 1 addition & 1 deletion nsxt/resource_nsxt_node_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func validateUsername() schema.SchemaValidateFunc {
return
}

r := regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9@-_.\\-]*$")
r := regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9@-_.\-]*$`)
if ok := r.MatchString(v); !ok {
es = append(es, fmt.Errorf("username %s is invalid", v))
return
Expand Down
2 changes: 1 addition & 1 deletion nsxt/resource_nsxt_policy_role_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func resourceNsxtPolicyUserManagementRoleBinding() *schema.Resource {
Required: true,
ValidateFunc: validation.StringMatch(
regexp.MustCompile(
"^[_a-z0-9-]+$"),
`^[_a-z0-9-]+$`),
"Must be a valid role identifier matching: ^[_a-z0-9-]+$"),
},
"role_display_name": {
Expand Down

0 comments on commit 604d78d

Please sign in to comment.