Skip to content

Fix NPE for incomplete deprecated password credentials - #46840

Closed
LouisLau-art wants to merge 2 commits into
keycloak:mainfrom
LouisLau-art:fix/issue-41640-deprecated-credential-npe-dco
Closed

LouisLau-art wants to merge 2 commits into
keycloak:mainfrom
LouisLau-art:fix/issue-41640-deprecated-credential-npe-dco

Conversation

@LouisLau-art

Copy link
Copy Markdown

Summary

  • prevent NullPointerException when converting deprecated password credentials that are missing required legacy fields
  • throw ModelException with a clear validation message instead, so user creation returns a controlled bad request path
  • add unit tests covering:
    • rejection of incomplete deprecated password credential payloads
    • successful conversion for complete deprecated password credential payloads

Why

RepresentationToModel.convertDeprecatedCredentialsFormat unboxed hashIterations from a nullable Integer in legacy credential payloads. For payloads like { "type": "password" } this caused an NPE and surfaced as an uncaught server error.

Verification

  • ./mvnw -pl server-spi-private -am -Dtest=RepresentationToModelTest test -DskipTests=false

Fixes #41640

Supersedes #46767 (same patch with DCO signed commits)

Louis Shawn added 2 commits March 4, 2026 12:09
Signed-off-by: Louis Shawn <louis.shawn@qq.com>
Signed-off-by: Louis Shawn <louis.shawn@qq.com>
@stianst

stianst commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Due to the amount of PRs sent in a short period of time we have had to ban this user and are closing all PRs. If you feel this is not the correction action please get in touch with our code of conduct committee.

@stianst stianst closed this Mar 4, 2026
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.

NullPointerException after after 26.3.2 migration

2 participants