Skip to content
Open
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
5 changes: 4 additions & 1 deletion pkg/cmd/openshift-tests/run-upgrade/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func (o *RunUpgradeSuiteOptions) UpgradeTestPreSuite() error {
if err := clusterdiscovery.InitializeTestFramework(exutil.TestContext, config, o.GinkgoRunSuiteOptions.DryRun); err != nil {
return err
}
klog.V(4).Infof("Loaded test configuration: %#v", exutil.TestContext)
// Redact the bearer token exposure
testContextString := fmt.Sprintf("%#v", exutil.TestContext)
redactedTestContext := exutil.RedactBearerToken(testContextString)
klog.V(4).Infof("Loaded test configuration: %s", redactedTestContext)

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion test/extended/util/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,11 @@ func (c *CLI) start(stdOutBuff, stdErrBuff *bytes.Buffer) (*exec.Cmd, error) {

func RedactBearerToken(args string) string {
if strings.Contains(args, "Authorization: Bearer") {
// redact bearer token
re := regexp.MustCompile(`Authorization:\s+Bearer.*\s+`)
args = re.ReplaceAllString(args, "Authorization: Bearer <redacted> ")
} else if strings.Contains(args, "BearerToken") {
re := regexp.MustCompile(`BearerToken:\s*\"[^\"]+\"`)
args = re.ReplaceAllString(args, "BearerToken: <redacted> ")
}
return args
}
Expand Down