[KEYCLOAK-18723] - Configurable constraints for request object encryption#8261
Conversation
|
@tnorimat Could you check if it makes sense for you? |
|
@pedroigor Yes, it follows the item 1 of https://openbanking-brasil.github.io/specs-seguranca/open-banking-brasil-financial-api-1_ID1.html#section-5.2.2 . |
tnorimat
left a comment
There was a problem hiding this comment.
@pedroigor I have a few comments.
-
Request object encryption's "alg" and "enc"
Unlike ID token encryption, It seems that only "alg" can be specified by client's setting(request_object_encryption_alg). How about supporting "enc" setting(request_object_encryption_enc)? -
Server Metadata
It might be better to add server metadata "request_object_encryption_alg_values_supported". As mentioned just above, if "enc" setting(request_object_encryption_enc) is supported, it might be better to add also "request_object_encryption_enc_values_supported".
Makes sense. I can update this.
Both are already supported as per #8243. See . |
|
@pedroigor Yes, I forgot it. |
mposolda
left a comment
There was a problem hiding this comment.
+1 for the Takashi's concern about alg and enc .
Also I've added one inline comment.
Finally, There is this condition in both FAPI and OpenBanking Brasil FAPI about the restrictions for the used alg and enc :
https://openid.net/specs/openid-financial-api-part-2-1_0.html#encryption-algorithm-considerations
https://openbanking-brasil.github.io/specs-seguranca/open-banking-brasil-financial-api-1_ID1.html#section-6.1.1
I think that it will be nice to have executor (similar to SecureSigningAlgorithmExecutor), which will enforce this for new clients and check the algorithms for the existing clients. But that is probably something to consider in separate PR?
| } | ||
|
|
||
| Boolean encryptionRequired = Optional.ofNullable(configuration.isEncryptionRequired()).orElse(Boolean.FALSE); | ||
| if (encryptionRequired && session.getAttribute(AuthzEndpointRequestParser.AUTHZ_REQUEST_OBJECT_ENCRYPTED) == null) { |
There was a problem hiding this comment.
@pedroigor It seems to me that with this flag encryptionRequired set to true, all clients in the realm (which will pass the client policy conditions) will be required to use encrypted request objects. Which I am not sure if it is desired behaviour.
IMO it will be good to stick with the same like for request object signatures. Which means that it would be enforced per the client if request object is encrypted just in case that request.object.encryption.alg is used for particular client. And this is already done in this PR (in AuthzEndpointRequestObjectParser).
In shortcut, my vote is to remove flag encryptionRequired from SecureRequestObjectExecutor. WDYT?
There was a problem hiding this comment.
As you mentioned, clients that match the policy conditions.
I've opened a discussion on keycloak-dev about this topic in order to understand whether a setting should be at the client or at the client policy.
I agree with @tnorimat that moving configuration to policies is the best to do. And whether encryption is required looks like a good example.
As per signature, I guess it was done before client policies support. Right?
I'm not sure, for me either way works. Let me know if the above makes sense if not I can change to do the same as signature.
There was a problem hiding this comment.
Yes, we discussed this already some time ago during work on client policies and during designing client policies. And I also agree that it will be nice to move many of client switches and keep them at the client policy level. This will allow some flexibility (EG. enforce secure ID Token signature algorithm just in case that scope=fapi is requested, which is possible due the fact that client policy condition will be evaluated just with the scope=fapi and the particular executor for enforce algorithm will be also called just at that time etc).
However one thing is, that some configurations are enforced by OIDC specification itself at the client level (like the request_object_encryption_alg and request_object_encryption_enc) and hence for those switches we need to stick them at the client level exactly as you did in this PR.
I am personally still not sure if the particular switch encryptionRequired is needed on the executor as we don't have similar thing for the signature, but I don't see this as a blocker in this PR as it is false by default anyway. so I am approving this. Thanks for the updates!
89c9587 to
1734c8a
Compare
|
@tnorimat Added support for content encryption settings. |
There was a problem hiding this comment.
According to https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata, it might be better to be
public static final String REQUEST_OBJECT_ENCRYPTION_ENC = "request.object.encryption.enc";
WDYT?
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be getRequestObjectEncryptionEnc .
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be setRequestObjectEncryptionEnc .
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be 'request.object.encryption.enc.alg' .
There was a problem hiding this comment.
Also to be requestObjectEncryptionEnc
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be changeRequestObjectEncryptionEnc .
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be 'request.object.encryption.enc' .
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be
<label class="col-md-2 control-label" for="requestObjectEncryptionEnc">{{:: 'request-object-encryption-enc' | translate}}</label>
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be
<select class="form-control" id="requestObjectEncryptionEnc"
ng-change="changeRequestObjectEncryptionEnc()"
ng-model="requestObjectEncryptionEnc">
There was a problem hiding this comment.
If https://github.com/keycloak/keycloak/pull/8261/files#r672633565 is agreed, it might be better to be 'request-object-encryption-enc.tooltip'
1734c8a to
86be626
Compare
|
@tnorimat The name works for me too. Changed. |
tnorimat
left a comment
There was a problem hiding this comment.
@pedroigor I've confirmed your changes. Thank you.
No description provided.