keycloak-ui icon indicating copy to clipboard operation
keycloak-ui copied to clipboard

Empty user attributes break UI

Open jruhe-adesso opened this issue 2 years ago • 9 comments

Describe the bug

Adding an empty user attribute breaks UI

image image

Version

19.0.2 Quarkus

Expected behavior

  1. Open user's page
  2. Select attributes
  3. Empty attribute (key only) is displayed

Actual behavior

  1. Open user's page
  2. Select attributes
  3. Page crashes with "Cannot read properties of null (reading 'trim')"

How to Reproduce?

  1. Add empty attribute to user (key only)
  2. Save
  3. Change page
  4. Enter user's page again
  5. Select attributes

Anything else?

No response

jruhe-adesso avatar Oct 17 '22 08:10 jruhe-adesso

I couldn't reproduce the issue. What do you exactly mean by 'change page'?

Vividious avatar Oct 17 '22 13:10 Vividious

Ok, this also works:

  1. Create new User
  2. Open attributes tab
  3. add an empty attribute (key only!)
  4. Press save
  5. Reload page => Crash

EDIT: DB is Oracle 19

jruhe-adesso avatar Oct 17 '22 15:10 jruhe-adesso

@jruhe-adesso I was also unable to recreate your issue. I tried both sets of instructions.

Can you try the latest nightly build and let us know if it works? https://github.com/keycloak/keycloak/releases/tag/nightly

ssilvert avatar Oct 18 '22 00:10 ssilvert

@ssilvert we are going to perform some experiments. Let you know about results. This is a critical production issue for us.

jruhe-adesso avatar Oct 18 '22 07:10 jruhe-adesso

We use the version 19.0.2. The problem occurs, if you use oracle as a DB-Vendor. We tried it with the nightly docker image and had the same problem.

We assume, that the problem is caused by Oracle's interpretation, that empty strings are null.

aaron-kunde avatar Oct 18 '22 09:10 aaron-kunde

As an addition to Aaron's comment (a colleague of mine), we recently switched from 18.0.2-legacy to 19.0.2 Quarkus and that was the point, where the issue appeared. Might be an UI-Problem only, but as we create and read users programatically by using the keycloak client as well, there might be other side effects caused by this issues. We are further investigating this.

EDIT I just found a running 18.0.2-legacy in our infrastructure. Payload of a user with empty attribute is this: image 19.0.2 Quarkus image

So, payload is identical, which strongly indicates, that the new React UI cannot handle arrays with a single "null" entry (instead of "").

jruhe-adesso avatar Oct 18 '22 09:10 jruhe-adesso

@jruhe-adesso could you file that as a separate issue? I'd like to avoid cluttering the discussion.

jonkoops avatar Oct 18 '22 10:10 jonkoops

The old admin console does not allow you to submit empty attributes at all.

While the REST API should be the foremost enforcer of these rules, we should fix this in the new UI and then transfer this issue over to the server team for final resolution.

ssilvert avatar Oct 18 '22 11:10 ssilvert

The old admin console does not allow you to submit empty attributes at all.

Adding a non whitespace character and then deleting it enables the save button.

jruhe-adesso avatar Oct 18 '22 12:10 jruhe-adesso