Skip to content

Conversation

@jkakavas
Copy link
Contributor

Ensure that we do not proceed with execution after calling the
listener's onFailure

Ensure that we do not proceed execution after calling the
listerer's onFailure
@jkakavas jkakavas added >bug :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v8.0.0 v7.7.0 v7.6.2 labels Mar 17, 2020
@jkakavas jkakavas requested a review from ywangd March 17, 2020 14:35
@elasticmachine
Copy link
Collaborator

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

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

if (decryptedTokens.length != 2) {
logger.warn("Decrypted tokens string is not correctly formatted");
listener.onFailure(invalidGrantException("could not refresh the requested token"));
} else {
Copy link
Member

Choose a reason for hiding this comment

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

This sure works. An alternative is to "return" immediately after "onFailure", which could be safer for future changes, e.g. a new statement is accidentally added below to this if-else block.

@jkakavas jkakavas merged commit bb89c62 into elastic:master Mar 18, 2020
jkakavas added a commit to jkakavas/elasticsearch that referenced this pull request Mar 18, 2020
Ensure that we do not proceed execution after calling the
listerer's onFailure
jkakavas added a commit to jkakavas/elasticsearch that referenced this pull request Mar 18, 2020
Ensure that we do not proceed execution after calling the
listerer's onFailure
jkakavas added a commit that referenced this pull request Mar 18, 2020
Ensure that we do not proceed execution after calling the
listerer's onFailure
jkakavas added a commit that referenced this pull request Mar 18, 2020
Ensure that we do not proceed execution after calling the
listerer's onFailure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v7.6.2 v7.7.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants