Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the Realm ID and saving causes the realm to be vanished from the list of the realms #17449

Closed
2 tasks done
Nefcanto opened this issue Mar 4, 2023 · 9 comments · Fixed by #25836
Closed
2 tasks done
Labels

Comments

@Nefcanto
Copy link

Nefcanto commented Mar 4, 2023

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

admin/ui

Describe the bug

Create a relam.
Then select it.
Then go to its general settings.
Remove the field content for the Realm ID field.
Then save.
The form is saved (which should not, because Realm ID is a required field), and the relam gets vanished from the realm list.

I don't know if it's removed from the database or not.

Version

20.0.2

Expected behavior

These are expected:

  • Required field should become red as soon as it gets invalid
  • Form should not submit while it has an invalid field
  • Or if it submits, backend code should not accept that form
  • A realm that has no id should be shown in the realms list, with an Undefined ID tag for example

Actual behavior

  • Required field does not show any UI/UX feedback when it becomes invalid (when it's empty and dirty)
  • Form submits even when it has invalid fields
  • Backend code does not check the validity of the form
  • A realm without ID would be not shown in the relams list

How to Reproduce?

  • Create a relam.
  • Then select it.
  • Then go to its general settings.
  • Remove the field content for the Realm ID field.
  • Then save.
  • The form is saved (which should not, because Realm ID is a required field), and the relam gets vanished from the realm list.

Anything else?

No response

@Nefcanto Nefcanto added kind/bug Categorizes a PR related to a bug status/triage labels Mar 4, 2023
@antikalk
Copy link
Contributor

antikalk commented Mar 8, 2023

It is also possible to create a realm without realm id via the API:
image

image

This also shouldn't be possible. In the UI the realm-id is required. Once the realm without realm-id is created you can neither select nor remove it anymore. It seems like the realm-id is not checked/validated on Backend side.

@ssilvert
Copy link
Contributor

I'm not seeing this behavior in the UI. When I remove the Realm ID field and try to save, it properly reports an error as Required field.

You could try this on the latest nightly build and see what happens.

I am going to move this over to the core team to verify that the API is rejecting a realm settings update with an empty realm id.

@antikalk
Copy link
Contributor

@ssilvert Just tested it with the nightly:
image
The UI now validates that the Realm ID is not empty.

Via the API the creation of a realm with an empty realm id is still possible:
image

And so is the update:
image

@ssilvert
Copy link
Contributor

Thanks for the extra info @antikalk. Definitely an API issue.

@mposolda
Copy link
Contributor

Adding to Backlog with label Help wanted as this is a corner case, which affects just with direct use of API (no issue when used with admin console). Keycloak team won't have time to look at this in the near future. But community contribution is welcome to look at it and eventually fix it. See the "Contributors" section under https://www.keycloak.org/community .

@mposolda mposolda added this to the Backlog milestone Mar 23, 2023
@vplemyannik
Copy link
Contributor

I would like to fix this issue

vplemyannik added a commit to vplemyannik/keycloak that referenced this issue Apr 12, 2023
ahus1 pushed a commit to vplemyannik/keycloak that referenced this issue Jul 6, 2023
vplemyannik added a commit to vplemyannik/keycloak that referenced this issue Jul 13, 2023
vplemyannik added a commit to vplemyannik/keycloak that referenced this issue Jul 13, 2023
vplemyannik added a commit to vplemyannik/keycloak that referenced this issue Jul 13, 2023
vplemyannik pushed a commit to vplemyannik/keycloak that referenced this issue Jul 13, 2023
vplemyannik added a commit to vplemyannik/keycloak that referenced this issue Jul 13, 2023
@ahus1
Copy link
Contributor

ahus1 commented Sep 13, 2023

Marking this as "help wanted" again as the original PR got stale.

@SamvWinsen
Copy link

By mistake I did made a realm without an name through the API, we are using keycloak version 22.0.1. It's not accessible through the UI. I did investigate to delete that specific realm, but I'm terrified I delete other realms because everything through the API is based on the name of the realm.
Is there a work a round to delete the realm?

@antikalk
Copy link
Contributor

By mistake I did made a realm without an name through the API, we are using keycloak version 22.0.1. It's not accessible through the UI. I did investigate to delete that specific realm, but I'm terrified I delete other realms because everything through the API is based on the name of the realm. Is there a work a round to delete the realm?

If I remember correctly I had to manually delete that realm from the database directly. Deleting the realm with the API won't work in the case of a realm with an empty Realm ID.

atharvakshi added a commit to atharvakshi/keycloak that referenced this issue Jan 1, 2024
Added a check to ignore renaming if it is an empty string.

Closes keycloak#17449
atharvakshi added a commit to atharvakshi/keycloak that referenced this issue Jan 1, 2024
Added a check to ignore renaming if it is an empty string.

Closes keycloak#17449

Signed-off-by: atharvakshi <atharva4894@gmail.com>
atharvakshi added a commit to atharvakshi/keycloak that referenced this issue Jan 1, 2024
Added a check to ignore renaming if it is an empty string.

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
atharvakshi added a commit to atharvakshi/keycloak that referenced this issue Jan 1, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
atharvakshi added a commit to atharvakshi/keycloak that referenced this issue Jan 1, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
ahus1 added a commit to atharvakshi/keycloak that referenced this issue Jan 2, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
ahus1 added a commit to atharvakshi/keycloak that referenced this issue Jan 2, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
ahus1 added a commit that referenced this issue Jan 5, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes #17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
pedroigor pushed a commit to alice-wondered/keycloak that referenced this issue Jan 12, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
wistefan pushed a commit to wistefan/keycloak that referenced this issue Jan 17, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
kamontat pushed a commit to kamontat/keycloak that referenced this issue Jan 20, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
Signed-off-by: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com>
ShefeeqPM pushed a commit to ShefeeqPM/keycloak that referenced this issue Jan 27, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
@ahus1 ahus1 removed this from the Backlog milestone Mar 6, 2024
ahus1 added a commit to ahus1/keycloak that referenced this issue Mar 22, 2024
Throw ModelException if name is empty when creating/updating a realm

Closes keycloak#17449

Signed-off-by: atharva kshirsagar <atharva4894@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
8 participants