Skip to content

Avoid logging SPNEGO credentials in log - #53395

Merged
ahus1 merged 2 commits into
keycloak:mainfrom
ahus1:is-52680-prevent-logging-sensitive-data
Oct 1, 2026
Merged

ahus1 merged 2 commits into
keycloak:mainfrom
ahus1:is-52680-prevent-logging-sensitive-data

Conversation

@ahus1

@ahus1 ahus1 commented Oct 1, 2026

Copy link
Copy Markdown
Member

Closes #52680

Closes keycloak#52680

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1 ahus1 self-assigned this Oct 1, 2026
@ahus1
ahus1 requested a balanced review from Copilot October 1, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new token-length logging introduces a null dereference before existing exception handling.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Prevents SPNEGO credential material from being exposed in Kerberos logs.

Changes:

  • Logs token lengths instead of token values.
  • Removes delegation credential values from logging.
File Description
SPNEGOAuthenticator.java Redacts SPNEGO and delegation credentials from logs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
@ahus1
ahus1 requested a balanced review from Copilot October 1, 2026 10:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changed log statements retain useful metadata without exposing credential material.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@msdaly200 msdaly200 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ahus1
ahus1 marked this pull request as ready for review October 1, 2026 11:57
@ahus1
ahus1 requested a review from a team as a code owner October 1, 2026 11:57
@ahus1
ahus1 enabled auto-merge (squash) October 1, 2026 11:57
public void authenticate() {
if (log.isTraceEnabled()) {
log.trace("SPNEGO Login with token: " + spnegoToken);
log.trace("SPNEGO Login with token length: " + (spnegoToken != null ? spnegoToken.length() : 0));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the length useful information at all? Seems like that can just be removed?

@ahus1
ahus1 merged commit 43dabfe into keycloak:main Oct 1, 2026
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kerberos TRACE logging records complete SPNEGO credentials

4 participants