Skip to content

Commit

Permalink
Use CurlRedact when Curl contains credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
vitreuz authored and Chris Dutra committed Jan 31, 2019
1 parent ebd981c commit badc83f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend_compatibility/backend_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = BackendCompatibilityDescribe("Backend Compatibility", func() {
token := v3_helpers.GetAuthToken()
uploadUrl := fmt.Sprintf("%s%s/v2/apps/%s/droplet/upload", Config.Protocol(), Config.GetApiEndpoint(), appGuid)
bits := fmt.Sprintf(`droplet=@%s`, dropletPath)
curl := helpers.Curl(Config, "-v", uploadUrl, "-X", "PUT", "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
curl := helpers.CurlRedact(token, Config, uploadUrl, "-X", "PUT", "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
Expect(curl).To(Exit(0), string(curl.Err.Contents()))

var job struct {
Expand Down
1 change: 0 additions & 1 deletion cats_suite_helpers/cats_suite_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func LoggingIsolationSegmentsDescribe(description string, callback func()) bool
})
}


func ZipkinDescribe(description string, callback func()) bool {
return Describe("[routing]", func() {
BeforeEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion helpers/app_helpers/app_droplet.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (droplet *AppDroplet) UploadFrom(uploadPath string) {
token := v3_helpers.GetAuthToken()
uploadURL := fmt.Sprintf("%s%s/v2/apps/%s/droplet/upload", droplet.config.Protocol(), droplet.config.GetApiEndpoint(), droplet.appGuid)
bits := fmt.Sprintf(`droplet=@%s`, uploadPath)
curl := helpers.Curl(droplet.config, "-v", uploadURL, "-X", "PUT", "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
curl := helpers.CurlRedact(token, droplet.config, uploadURL, "-X", "PUT", "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
Expect(curl).To(Exit(0))

var job struct {
Expand Down
2 changes: 1 addition & 1 deletion helpers/services/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func AuthenticateUser(authorizationEndpoint string, username string, password st
sessionId := jsessionRegEx.FindString(apiResponse)
vcapId := vcapidRegEx.FindString(apiResponse)
cookie = fmt.Sprintf("%v;%v", sessionId, vcapId)
return
return cookie
}

func RequestScopes(cookie string, config OAuthConfig) (authCode string, httpCode string) {
Expand Down
6 changes: 3 additions & 3 deletions helpers/v3_helpers/v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ func EntitleOrgToIsolationSegment(orgGuid, isoSegGuid string) {
func FetchRecentLogs(appGuid, oauthToken string, config config.CatsConfig) *Session {
loggregatorEndpoint := getHttpLoggregatorEndpoint()
logUrl := fmt.Sprintf("%s/apps/%s/recentlogs", loggregatorEndpoint, appGuid)
session := helpers.Curl(Config, logUrl, "-H", fmt.Sprintf("Authorization: %s", oauthToken))
session := helpers.CurlRedact(oauthToken, Config, logUrl, "-H", fmt.Sprintf("Authorization: %s", oauthToken))
Expect(session.Wait()).To(Exit(0))
return session
}

func GetAuthToken() string {
session := cf.Cf("oauth-token")
session := cf.CfSilent("oauth-token")
bytes := session.Wait().Out.Contents()
return strings.TrimSpace(string(bytes))
}
Expand Down Expand Up @@ -465,7 +465,7 @@ func UnsetDefaultIsolationSegment(orgGuid string) {

func UploadPackage(uploadUrl, packageZipPath, token string) {
bits := fmt.Sprintf(`bits=@%s`, packageZipPath)
curl := helpers.Curl(Config, "-v", "-s", uploadUrl, "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
curl := helpers.CurlRedact(token, Config, "-s", uploadUrl, "-F", bits, "-H", fmt.Sprintf("Authorization: %s", token)).Wait()
Expect(curl).To(Exit(0))
}

Expand Down

0 comments on commit badc83f

Please sign in to comment.