-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Allow null name when deserialising API key document #59485
Conversation
Pinging @elastic/es-security (:Security/Authentication) |
int version, | ||
@Nullable BytesReference roleDescriptorsBytes, | ||
BytesReference roleDescriptorsBytes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed Nullable
and replaced optionalConstructorArg()
with constructorArg()
for hash
and roleDescriptorsBytes
fields for clarity:
- The parser does not allow them to be null without something like
builder.declareStringOrNull(...)
. Therefore theNullable
etc does not have any effects anyway. In another word, the overall code logic is not impacted. - Based on the logic in
ApiKeyService#newDocument
, these two fields can never be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
API keys can be created without names using grant API key action. This is considered as a bug (elastic#59484). Since the feature has already been released, we need to accomodate existing keys that are created with null names. This PR relaxes the parser logic so that a null name is accepted.
API keys can be created without names using grant API key action. This is considered as a bug (#59484). Since the feature has already been released, we need to accomodate existing keys that are created with null names. This PR relaxes the parser logic so that a null name is accepted.
Auditing also doesn't expect API keys with |
Good catch! |
API keys can be created without names using grant API key action. This is considered as a bug (#59484). Since the feature has already been released, we need to accomodate existing keys that are created with null names. This PR relaxes the parser logic so that a
null
name is accepted.Resolves: #59481