Skip to content

KEYCLOAK-18276 consent screen enhancement#8092

Merged
mposolda merged 1 commit intokeycloak:mainfrom
eosc-kc:87-consent-screen
Nov 18, 2021
Merged

KEYCLOAK-18276 consent screen enhancement#8092
mposolda merged 1 commit intokeycloak:mainfrom
eosc-kc:87-consent-screen

Conversation

@cgeorgilakis
Copy link
Copy Markdown
Contributor

This PR is needed in order to being able to configure client attributes. PRs code are independent.

@cgeorgilakis cgeorgilakis changed the title KEYCLOAK-18276 content screen enhancement KEYCLOAK-18276 consent screen enhancement Aug 4, 2021
@cgeorgilakis cgeorgilakis force-pushed the 87-consent-screen branch 3 times, most recently from f9056b8 to 01d476e Compare October 14, 2021 08:01
@cgeorgilakis
Copy link
Copy Markdown
Contributor Author

Keycloak documentation PR : https://github.com/keycloak/keycloak-documentation/pull/1270/files
Merged with related PR into this PR.
You could see previous discussion in the merged PR.

Our goal was to do no database changes. However, for logo_uri some SAML clients use data:image and the logo_uri length is over 4000 characters. Current database length for VALUE field of CLIENT_ATTRIBUTES is insufficient.
We believe that we should create a new field in ClientEntity for logo_uri with text format or make VALUE field clob. What do you believe?

@pedroigor
Copy link
Copy Markdown
Contributor

@cgeorgilakis I don't think we can change the column to a CLOB. I remember @hmlnarik being against that a long time ago.

A separate field sounds too much for me.

Aren't these URLs too big? Any chance you can try to have them shorter and fit the size?

Copy link
Copy Markdown
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

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

@cgeorgilakis In general it is LGTM, mainly the OIDC related changes. We also need some feedback from @ssilvert (new console changes) and @hmlnarik (SAML).

One thing I'm wondering is whether it makes sense to add this for SAML too? Or at least include now the OIDC related changes (which are backed by specs) and deal with SAML in a subsequent PR, if necessary?

Another thing, is there anything else we can do to avoid XSS/CSRF when rendering those URLs? For instance, bad admins should be able to exploit sites vulnerable to CSRF (e.g.: in images). Not sure if we need to worry about that or if there is anything else we can do help to mitigate this.

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.

Does make sense to enforce realm settings for external requests using

public static void checkUrl(SslRequired sslRequired, String url, String name) throws IllegalArgumentException{
?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did not know this method.
However, some SAML clients have value starting with data:image/png ( accepted according to SAML specifications).
It is the same value that have length over 4000 characters.

@pedroigor pedroigor added area/oidc Indicates an issue on OIDC area kind/enhancement Categorizes a PR related to an enhancement area/testsuite Indicates an issue on the Testsuite area missing/tests and removed area/testsuite Indicates an issue on the Testsuite area labels Oct 20, 2021
@pedroigor
Copy link
Copy Markdown
Contributor

@mposolda I think this one is a nice improvement to consent. Are you able to check if anything else is missing?

@cgeorgilakis
Copy link
Copy Markdown
Contributor Author

@cgeorgilakis I don't think we can change the column to a CLOB. I remember @hmlnarik being against that a long time ago.

A separate field sounds too much for me.

Aren't these URLs too big? Any chance you can try to have them shorter and fit the size?

I agree with @hmlnarik, because Keycloak use CLIENT_ATTRIBUTES for many client attributes.

These is configuration in some existing SAML client( in edugain f.e.) . I can not change them.

Examples url can be found in edugain metadata. md:SPSSODescriptor is for SAML clients. For example see SP with entityId = https://ssotest.sifulan.my/shibboleth.

If this is a blocking issue for accepting PR for you, could you accept it without any db change and propose a solution for our case ( maybe other Keycloak users)?

@cgeorgilakis
Copy link
Copy Markdown
Contributor Author

cgeorgilakis commented Oct 21, 2021

@cgeorgilakis In general it is LGTM, mainly the OIDC related changes. We also need some feedback from @ssilvert (new console changes) and @hmlnarik (SAML).

One thing I'm wondering is whether it makes sense to add this for SAML too? Or at least include now the OIDC related changes (which are backed by specs) and deal with SAML in a subsequent PR, if necessary?

Our main use case and goal is OIDC clients. However, SAML clients exist also and changes is strain forward to be added. The only problem is related to SAML logoUri ( see my other comments).

Another thing, is there anything else we can do to avoid XSS/CSRF when rendering those URLs? For instance, bad admins should be able to exploit sites vulnerable to CSRF (e.g.: in images). Not sure if we need to worry about that or if there is anything else we can do help to mitigate this.

I do not know about it. How do you deal with it in other client URIs? I use same check method except from logoUri.

@cgeorgilakis
Copy link
Copy Markdown
Contributor Author

About missing/tests, my problem is that the changes is in consent (ui). How do you test other consent components?

@pedroigor
Copy link
Copy Markdown
Contributor

@cgeorgilakis W.r.t. SAML, not so straightforward if compared to the OIDC code you had to change :) Plus the tests we also need to add to SAML.

Another point I have on this one is that consent is probably more related to OIDC? I mean, that is what our community is most interested about?

W.r.t. to tests, here is an example

.

@cgeorgilakis
Copy link
Copy Markdown
Contributor Author

@cgeorgilakis W.r.t. SAML, not so straightforward if compared to the OIDC code you had to change :) Plus the tests we also need to add to SAML.

Another point I have on this one is that consent is probably more related to OIDC? I mean, that is what our community is most interested about?

Sure. If you ensist, I can seperate two PRs. Keep this one for OIDC and make another for SAML after this has been approved.

I have also added tests for OIDC. Thanks.

Copy link
Copy Markdown
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

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

@cgeorgilakis very minor comments. Other than that, LGTM.

I do think it makes sense to initially add support for OIDC. But I'm not sure what others think.

@hmlnarik @stianst @mposolda

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.

Does it make sense to use the "config wrapper" to fetch those new properties rather than using their names directly (considering you have created constants for them)?

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.

Does it make more sense to use constants from the "config wrapper"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have created constants variables to ClientScopeModel. If we move to only OIDC PR, we could move them to OIDCConfigAttributes. I prefer to keep them in ClientScopeModel for SAML future extension.

Copy link
Copy Markdown
Contributor

@mposolda mposolda left a comment

Choose a reason for hiding this comment

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

@cgeorgilakis Thanks for this PR! And sorry for late review. I've added one minor comment, but in general, it is great work.

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.

I am not sure why these constants are defined on the ClientScopeModel? Existing constants on ClientScopeModel are the configuration options of client scope. However these constants logoUri, policyUri, tosUri are not config options of clientScopeModel. It seems the better place for define them might be ClientModel class or "org.keycloak.models.Constants"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right. I move this constants to ClientModel.

Copy link
Copy Markdown
Contributor

@mposolda mposolda left a comment

Choose a reason for hiding this comment

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

@cgeorgilakis Thanks!

@mposolda mposolda merged commit 63c9845 into keycloak:main Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/oidc Indicates an issue on OIDC area kind/enhancement Categorizes a PR related to an enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants