Skip to content

Update oidc related dependencies #71521

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

Merged
merged 2 commits into from
Apr 12, 2021
Merged

Conversation

jkakavas
Copy link
Member

@jkakavas jkakavas commented Apr 9, 2021

Update:

Non-issue, no notable changes.

  • json-smart from 2.3 to 2.4.2
  • accessors-smart from 1.2 to 2.4.2
  • asm from 7.1 to 8.0.1
  • nimbus-jose-jwt from 8.6 to 9.8.1
  • oauth2-oidc-sdk from 7.0.2 to 9.3.1

Update:
- json-smart to 2.4.2
- accessors-smart to 2.4.2
- asm to 8.0.1
- nimbus-jose-jwt to 9.8.1
- oauth2-oidc-sdk to 9.3.1
@jkakavas jkakavas added >non-issue :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v8.0.0 v7.13.0 labels Apr 9, 2021
@jkakavas jkakavas requested a review from ywangd April 9, 2021 06:22
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Apr 9, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

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

LGTM with some questions for which I'd appreciated for clarifications.

Also I feel it could be useful (for future readers) to have a bit more details in the PR's description to include:

  • General purpose of this upgrade. Is it just on a regular schedule or is it related to some requirements?
  • from version in addtion to the to version
  • Any noticable changes each dependency's upgrade or it can just be "non-issue" if nothing significant.

@@ -234,9 +233,9 @@ private void getUserClaims(@Nullable AccessToken accessToken, JWT idToken, Nonce
LOGGER.trace("Received and validated the Id Token for the user: [{}]", verifiedIdTokenClaims);
}
// Add the Id Token string as a synthetic claim
final JSONObject verifiedIdTokenClaimsObject = verifiedIdTokenClaims.toJSONObject();
final Map<String, Object> verifiedIdTokenClaimsObject = verifiedIdTokenClaims.toJSONObject();
final JWTClaimsSet idTokenClaim = new JWTClaimsSet.Builder().claim("id_token_hint", idToken.serialize()).build();
Copy link
Member

Choose a reason for hiding this comment

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

Also a question of learning: Why do we add the id token string itself as part of the claim?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to pass the id_token_hint parameter that has the serialized ID Token as value, when/if we eventually need to generate a Logout request for the OP, so we need to store this in the elasticsearch AuthenticationToken metadata for it to be available. The easiest way to do this here was to add this as a synthetic claim, as we add all claims from the ID token to the metadata in OpenIdConnectRealm

Comment on lines +956 to +957
// This is necessary as if nonce claim is of type Nonce, the library won't take it into consideration when serializing the JWT
idTokenMap.put("nonce", idTokenMap.get("nonce").toString());
Copy link
Member

Choose a reason for hiding this comment

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

Could you please explain a bit more about this? Is it not needed before the version upgrade? Since it is necessary now, do we need somehow reflect this in production code?

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you please explain a bit more about this?

It looks like some internal change ( I assume the change from using json-smart's JSONObjects to Map<String, Object> in oauth2-oidc-sdk, means that ID token signature generation can only handle certain types.

Is it not needed before the version upgrade?

No

Since it is necessary now, do we need somehow reflect this in production code?

No. We are an RP and thus we don't need to generate signed ID Tokens, so this behavior change doesn't affect us.

@jkakavas
Copy link
Member Author

@elasticmachine update branch

@jkakavas jkakavas merged commit f944078 into elastic:master Apr 12, 2021
jkakavas added a commit to jkakavas/elasticsearch that referenced this pull request Apr 12, 2021
Update:

Non-issue, no notable changes.

- json-smart from 2.3 to 2.4.2
- accessors-smart from 1.2 to 2.4.2
- asm from 7.1 to 8.0.1
- nimbus-jose-jwt from 8.6 to 9.8.1
- oauth2-oidc-sdk from 7.0.2 to 9.3.1
# Conflicts:
#	x-pack/plugin/security/build.gradle
jkakavas added a commit that referenced this pull request Apr 12, 2021
Update:

Non-issue, no notable changes.

- json-smart from 2.3 to 2.4.2
- accessors-smart from 1.2 to 2.4.2
- asm from 7.1 to 8.0.1
- nimbus-jose-jwt from 8.6 to 9.8.1
- oauth2-oidc-sdk from 7.0.2 to 9.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants