-
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
Support invalidating multiple API keys by their ID #47609
Comments
Is it expected that this API would be called in bulk (i.e., with more than a few)? If not, what's the overhead of sending multiple requests, or sending multiple requests in parallel? We aim to keep our APIs and the surface areas of our APIs small, otherwise we bloat how much that we have to maintain. If we were to enhance this API to allow deleting multiple at once, I wouldn't be in favor using a comma to separate values. We should be explicit that multiple keys are being deleted, something like:
This makes it so much clearer and easier to work with, for clients and us internally. |
Pinging @elastic/es-security (:Security/Security) |
Pinging @elastic/es-ui (:ES-UI) |
Hi Security team, the Ingest Management team has a need for bulk invalidate API keys. We expose a UI for taking bulk actions on agents, including bulk unenroll and bulk force unenroll. During force unenrollment, we invalidate two API keys per agent. The user can potentially unenroll up to 10,000 agents at a time using this UI, resulting in the need to invalidate 20,000 keys. As you can probably imagine, sending 20,000 invalidate requests in parallel doesn't work too well today :) Can the team consider re-prioritizing this feature request with this use case in mind? In the meantime I will experiment with batching the requests as our workaround. |
Thanks for raising your use case for this feature. Pinging @elastic/es-security to get more feedback on the technical side of the proposal. |
We discussed with the team, and we have a few questions about the end to end flow that you expect to see in Fleet. Given the designs in elastic/kibana#72712, I guess that you expect users to request any possible bulk combination, not just related on policy, or creator. So, existing selectors for bulk invalidate in the invalidate API don't solve the problem. Another question is how you get the list of IDs for the selected agents. Is it something that is attached to the agent information? Do you need to fetch them from Elasticsearch? It could be useful to check if there is some optimization for the end to end flow rather than just the invalidate action. |
@bytebilly I think it could be possible in some cases to optimize the unenrollment, let's say we want to revoke all Agent linked to a specific configuration, maybe we could attach that information as metadata and have the possibility to delete by query, or we could use the "realm_name" for that. We have to assume that in theory, we could do partial unenroll of Agent from a configuration. I will let @jen-huang comment on how we get the list of IDs. |
Hi, you can look at this code branch for the flow: forceUnenrollAgents() A few key points:
Since I last commented, I was able to improve the performance here by batching invalidate requests by ID to 500 keys at a time. This worked well in my local testing and was sufficient for our upper limit of 10,000 agents/20,000 keys. |
Could you please share what your improvements are? How did you implement batching for invalidate by ID? Are you still doing individual invalidate requests for each key, or do you access the security index directly? Thanks! |
The improvements still do individual requests for each key through @elastic/kibana-security's |
I'd like to have agreement on a small design for this issue here. The payload of current API has a field
I prefer option 1 because:
With above said, option 1 also has its own overhead:
Some common overhead for changing request/response entities:
|
@ywangd I also prefer option 1. and deprecate Should we do the same for the |
After team discussion, we agreed to overload the existing |
I'm concerned with the suggestion here, because what we're ending up with is a field that can take on two different forms. That's additional mental overhead, and it complicates the specification and high-level clients. It's also confusing that |
Thanks for chime in @jasontedor. I did share the same concerns for reusing the exising I like the idea of iterative approach. To me it means we can have this new field to fleet to use without having to pay bwc immediately. We will have to pay the price, but it is amortized (before version 8). |
@jen-huang A new |
Is there a way to support invalidating multiple API keys via their IDs with a single request? For example, perhaps we could support comma-separated IDs?
CC @bizybot
The text was updated successfully, but these errors were encountered: