-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix security.get_api_key and security.query_api_keys APIs #3146
Conversation
pquentin
commented
Nov 19, 2024
- Added missing fields invalidation, access and type.
- Added ApiKeyRead using the OverloadOf behavior as some fields are optional with the Authenticate API but always defined when reading API keys.
This comment was marked as outdated.
This comment was marked as outdated.
* @availability stack since=8.12.0 | ||
* @availability serverless | ||
*/ | ||
invalidation?: EpochTime<UnitMillis> |
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.
invalidation
on the server side is an Instant, like creation
and expiration
. should we keep them all long
s?
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.
They are serialized using toEpochMillis
though: https://github.com/elastic/elasticsearch/blob/ea90fbc10d3371e5e3b9921a81a4936c2e39d5f4/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/ApiKey.java#L281-L288
I'm happy to use long for consistency and not breaking typed clients, but as far as I can tell EpochTime<UnitMillis>
is the correct type?
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.
we can set them all as EpochTime<UnitMillis>
then, for java it's the same. how about @flobernd ?
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.
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.
@Anaethelion also validated offline that this was fine for the Go client.
I just realized that it's not Read vs. Write: Edit: done in |
This allows remove a number of optional fields from APIKey itself.
This comment was marked as outdated.
This comment was marked as outdated.
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
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
* Fix security.get_api_key API * Use specific APIKey type for authenticate API This allows remove a number of optional fields from APIKey itself. * Use more EpochTime<UnitMillis> (cherry picked from commit 986d9db)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.16 8.16
# Navigate to the new working tree
cd .worktrees/backport-8.16
# Create a new branch
git switch --create backport-3146-to-8.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 986d9dba35768389938eb9801846668682138734
# Push it to GitHub
git push --set-upstream origin backport-3146-to-8.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.16 Then, create a pull request where the |
* Fix security.get_api_key API * Use specific APIKey type for authenticate API This allows remove a number of optional fields from APIKey itself. * Use more EpochTime<UnitMillis> (cherry picked from commit 986d9db)
* Fix security.get_api_key API * Use specific APIKey type for authenticate API This allows remove a number of optional fields from APIKey itself. * Use more EpochTime<UnitMillis> (cherry picked from commit 986d9db)