Skip to content

fix(login): remove unconditional logging of OAuth2 access and refresh tokens#405

Open
Harishrs2006 wants to merge 1 commit into
microcks:masterfrom
Harishrs2006:fix/oauth-token-leak-login-log
Open

fix(login): remove unconditional logging of OAuth2 access and refresh tokens#405
Harishrs2006 wants to merge 1 commit into
microcks:masterfrom
Harishrs2006:fix/oauth-token-leak-login-log

Conversation

@Harishrs2006
Copy link
Copy Markdown

@Harishrs2006 Harishrs2006 commented May 17, 2026

Summary
Removes two log.Printf calls in cmd/login.go that unconditionally printed the OAuth2 access token and refresh token to stderr on every SSO login — regardless of whether --verbose was set.

Problem

// Before — leaks credentials to stderr unconditionally
log.Printf("Token: %s\n", tokenString)
log.Printf("Refresh Token: %s\n", refreshToken)

Any CI/CD pipeline or log aggregation system capturing stderr silently records long-lived credentials in plaintext. Refresh tokens are especially dangerous — they allow obtaining new access tokens without user interaction.

All other sensitive output in this codebase is gated behind config.Verbose / config.DumpRequestIfRequired. These two lines were the only exception — leftover debug statements.

Changes:
cmd/login.go: removed 2 lines — the unconditional token log statements
The fmt.Printf("Authentication successful\n") immediately above already confirms success without exposing any credential
Testing
go build ./... # clean
go test ./... # all pass
go vet ./... # clean
Manual: SSO login flow no longer prints token values to stderr. Behavior otherwise unchanged.

Fixes : #345

… tokens

OAuth2 access token and refresh token were unconditionally printed to
stderr via log.Printf on every SSO login, regardless of --verbose flag.
Any CI/CD pipeline or log aggregation system capturing stderr would
silently record long-lived credentials in plaintext.

All other sensitive data in the codebase (request bodies, headers) is
already gated behind config.Verbose / config.DumpRequestIfRequired.
The 'Authentication successful' message printed immediately before is
sufficient confirmation; the token values add no diagnostic value.

Signed-off-by: Harish R S <harishrs21082006@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(login): OAuth2 access and refresh tokens unconditionally leaked to stderr on SSO login

1 participant