Skip to content

Commit f3dacd3

Browse files
committed
Censor githubApp token in logs
Signed-off-by: Mmadu Manasseh <mmadumanasseh@gmail.com>
1 parent d860ba7 commit f3dacd3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/vcs/github_client/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ func CreateGithubClient(ctx context.Context, cfg config.ServerConfig) (*Client,
116116
}
117117

118118
vcsToken = response.Token
119+
// this is so that we can censor the token in the logs
120+
cfg.VcsToken = vcsToken
119121

120122
expirationDuration := time.Until(response.ExpiresAt)
121123
interval := expirationDuration / 2
@@ -180,6 +182,8 @@ func (c *Client) refreshToken(ctx context.Context, cfg config.ServerConfig, inte
180182
return errors.Wrap(err, "failed to refresh github app token")
181183
}
182184

185+
// this is so that we can censor the token in the logs
186+
cfg.VcsToken = response.Token
183187
if err = c.setCredentials(ctx, cfg, appUsername, response.Token); err != nil {
184188
logger.Warn().Err(err).Msg("failed to set git credentials")
185189
return errors.Wrap(err, "failed to set git credentials")

0 commit comments

Comments
 (0)