Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change aligning Admin API credential-label clearing with the Account API.
No open issues 🎉
What changed in this PR
Aligns the Admin API with the Account API’s acceptance of empty credential labels, addressing #51440 while preserving duplicate-label validation for named credentials.
Changes:
- Treats empty or blank Admin API labels as requests to clear the label, storing
null. - Replaces the rejection test with coverage that clears two OTP credential labels without a duplicate-label conflict.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/admin/user/UserCredentialTest.java |
Verifies empty and whitespace-only labels clear two OTP credential labels to null. |
services/src/main/java/org/keycloak/services/resources/admin/UserResource.java |
Normalizes empty or blank labels to null and documents the clearing behavior. |
Review effort: Balanced
|
thanks @vaceksimon for your review, looking forward to get it merged. I see at the moment merging shows blocked as it requires a code owners review. |
|
@shuseng8, we have discussed this within the team and decided that the second option is more optimal: reject empty credential labels in the user API. Sorry for the trouble. Would you still be up for providing a fix? Here is my suggestion: The validation should be included in AccountCredentialResource, but not only there, because of #53544. The credential label is also set during credential setup as a required action in OTP:
Passkeys:
@shuseng8 wdyt? |
|
Hi @vaceksimon, no trouble at all, and thanks for coming back after the team discussion. I'm happy to take on the new approach and reject empty credential labels in the Account API and the setup flows. My plan:
Would you prefer that I rework this PR (rebase, update the title and description) or open a fresh one? |
|
@shuseng8 I agree with the plan; you can carry on in this PR. One thing I forgot: add a section about this to changes-27_0_0.adoc at the end of Notable changes. |
91093ed to
f1b1223
Compare
f1b1223 to
79ba50a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new server-side WebAuthn label rejection lacks regression coverage for missing, empty, and whitespace-only labels in regular and passwordless registration, including the expected error, no credential storage, and challenge reuse after correction.
1 open issue
2 resolved since last review
Review effort: Balanced
79ba50a to
1a3d0cb
Compare
|
Hi @vaceksimon, thanks for the review and suggestions! The changes have been addressed as per your plan. Empty/blank labels are now rejected in the Account API, the OTP setup (count check dropped) and Passkey registration (re-prompt + server-side check), and the note is added at the end of Notable changes in |
1a3d0cb to
d968b4d
Compare
|
Hi @vaceksimon, I've rebased this onto the latest main and resolved the merge conflicts. Keycloak moved the login pages to PatternFly 6, so I updated the TOTP template to use the new field helper with the label always required, and kept the upgrade note last under Notable changes. The full build passes, and so do all the affected tests (new framework, WebAuthn, TOTP, broker and LDAP). Whenever you or another maintainer has time, a review and approval for the CI runs would be much appreciated. Thank you! |
|
Hi @ahus1, @vaceksimon approved this earlier. Since then I've addressed the remaining review feedback and rebased it onto the latest main, and there are no conflicts. Could you take a look and merge it if it looks good to you? The workflow runs also need a maintainer's approval before CI can start. Thanks! |
d968b4d to
ee43213
Compare
ee43213 to
5164a15
Compare
|
Np, @vaceksimon :) please let me know, if this changes in PR looks good and is eligible to merge 🚀 post the opinion from @rmartinc or @mabartos |
Closes keycloak#51440 Signed-off-by: Shubham <87247136+shuseng8@users.noreply.github.com>
5164a15 to
239ca53
Compare
| Empty or blank credential labels are now rejected in the Account REST API and in the OTP and Passkey setup flows. | ||
| The first OTP device, like every later device, requires a device name. | ||
| Clients that previously omitted a label when creating or renaming a credential must supply a non-empty value. | ||
| The Admin REST API already rejected empty labels and is unchanged. |


Closes #51440
This reworks #54849 after the team discussion in #54849 (comment).
Instead of allowing empty credential labels in the Admin API, empty or blank labels are now rejected in the Account REST API and in the OTP and Passkey setup flows. The Admin API already rejected empty labels and is unchanged.
Changes:
PUT /credentials/{id}/labelreturns 400missingCredentialLabelfor null, empty, or whitespace-only labels.changes-27_0_0.adoc.AI assistance: An AI agent was used to help implement this change from a written plan. I reviewed the code and tests and take responsibility for the contribution.