-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Expose API key metadata for ingest processors #71024
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
Comments
Pinging @elastic/es-security (Team:Security) |
EDIT: updated to incorporate Tim's comment @elastic/es-security As discussed in team meeting, here is my proposal on how to expose the API key metadata information in ingest processor. Current StateThe set security user processor is where authentication information is attached to the incoming document. It is therefore the right choice for exposing the API key metadata information. Today, it already has a {
...,
"_source": {
...,
"user": {
"api_key": {
"name": "k1",
"id": "0UB86HgB96240ypp1EqC"
},
"realm": {
"name": "file1",
"type": "file"
},
"authentication_type": "API_KEY",
"username": "elastic-admin"
}
}
} RecommendationsThree options are considered for adding the extra metadata information:
"set_security_user": {
"field": "user",
"properties": ["api_key"]
} And the output is as the follows: "api_key": {
"name": "k1",
"id": "0UB86HgB96240ypp1EqC",
"metadata": {
"foo": "bar",
"value": "42"
}
} For minimal user visiable impact, the
"set_security_user": {
"field": "user",
"properties": ["api_key", "api_key_metadata"]
} And the output is: "api_key": {
"name": "k1",
"id": "0UB86HgB96240ypp1EqC"
},
"api_key_metadata": {
"foo": "bar",
"value": "42"
} For minimal user visiable impact, the
(We could think of more options, but I feel they would be too complex to be worthwhile.) I propose we go with Option 1. AnalysisThere are pros and cons for all three approaches, but overall Option 1 is simpler and more effective. Option 1Pros
Cons
Option 2The Pros and Cons of Option 2 is basically the opposite to those of Option 1 plus:
Option 3Pros
Cons
Overall, the cons of Option 2 or 3 weigh more than those of Option 1. Also some more reasonings are:
|
Thanks @ywangd, I'd prefer option 1 that looks clearer and simpler from a user perspective. |
Your proposal seems to conflate 2 different design questions:
Your examples describe question (2), but some of your pro/cons are about question (1). a. Use the existing I think option (b) has no redeeming qualities, but I do think you should consider (c) as a potential option. I think I prefer (a), over (c) or (d). However, I don't think (d) is naturally better than (c), so I think it's worth being clear about which of the pros/cons of Option 2 are actually about (c) or (d). TL;DR: I like your option 1, but I think there's 2 different ways you could do option 2, and that might change your (or other people's) analysis/recommendation. |
+1 for option 1 (or option a 😄 ). I can see a case for Tim's option c but I think we need to see how metadata is used, if metadata becomes large it might be an option to go with but I could equally see users wanting to filter the metadata and we might need to think about whether thats best done in this processor or in a subsequent filtering processor (I'm currently leaning to the latter) |
@tvernum You are right that a viable option is missed out. The existing fields got me to assume that every property should correspond to a top level field. Apparently, this does not have to be the case. Though it does mean deviation from existing pattern, it is at least worth for discussion. I updated my original post to reflect your comment (a new Option 3 is added, i.e. your option (c)). I hope it is easier for people to consume when everything is in a single post. Please note that my recommendation remains the same. Thanks! |
Thanks for the thorough analysis Yang and for laying this out nicely for consideration. I'll add my +1 to 1/a as I dont like 2(because I think it makes sense for metadata to be a property of the api key and not a high level one ) and I dont see the need for the granularity c offers ,especially in the presence of other filtering solutions that are available |
Thanks all for the feedback. The consensus is that overall we prefer Option 1, the simplest approach. I will raise a PR for it. |
API keys can now be created with metadata since #70292. This information can be retrieved with the GetApiKey request, but otherwise is not available anywhere else. It is desirable that the metadata is exposed in the ingest processors, specifically the SetSecurityUser processor. The processor already has a
api_key
property that exposes the API key name and ID. One option is to expand the existing property and add the metadata field.The text was updated successfully, but these errors were encountered: