[RAC] Fix index names used by RBAC, delete hardcoded map of Kibana features to index names#109567
Conversation
|
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
6b46e84 to
42d995e
Compare
|
Pinging @elastic/uptime (Team:uptime) |
There was a problem hiding this comment.
namespaces can have whitespace chars in them, correct? That could be a reason to use space id over namespace. Not sure we would want whitespace chars in index names or maybe those get hyphenated?
There was a problem hiding this comment.
We had a chat with @dhurley14 on this comment. For visibility I will post a summary here (Devin is on PTO right now).
My point was: namespaces, according to the design document, are supposed to be user-defined. But in Security they will be equal to the space id by default. But still, the user will be able to set a custom namespace for a single rule instance.
- if we include a space id in the index name when reading data, we will omit the alerts generated by this rule instance
- namespaces should not include whitespace characters I guess, but they can contain dashes; basically they can contain any characters a space id can
- when reading from RAC indices, we should omit the namespace part from the queries to ES
Devin's point is:
that all makes sense except for the last bullet point:
when reading from RAC indices, we should omit the namespace part from the queries to ES
We are doing that as part of the authorization filter. This requirement came early on from Brandon I think so that would need to be discussed further.
I'm fine with whichever decision is made going forward (sounds like it'll be namespaces > space ids) but I just want to make sure that change is also reflected in places we use space id for authorization in the alerts as data client.
Im not sure what should be done in this PR regarding that, to be honest. Maybe I just don’t understand why this function (getAuthorizedAlertsIndices) needs to include space id to the index name. I don’t know how the HTTP endpoint that calls this function is actually used in the app. Where the index names from the endpoint's response are being propagated to, etc. Maybe I'm just missing something.
I will remove this TODO comment to avoid confusion (especially if it's misleading) and try to figure out the usage of space id in this function later.
42d995e to
e9014a6
Compare
weltenwort
left a comment
There was a problem hiding this comment.
This looks fine, but I don't know enough about the AlertsClient to speak with confidence about the changes therein.
There was a problem hiding this comment.
This works fine, but it makes me wonder if we shouldn't just keep a Set() of IndexInfos (with added feature ids) and .filter() it when we need to query by some property. 🤔 That would be a much simpler datastructure. Definitely not a high priority for this PR, though.
There was a problem hiding this comment.
This is not obvious to me right away, I'll revisit this comment tomorrow.
There was a problem hiding this comment.
Why do we allow null here? Doesn't this together with the assertion in private ruleDataService! break type safety?
There was a problem hiding this comment.
I'll revisit this comment tomorrow.
There was a problem hiding this comment.
Besides deleting the map itself, this PR actually fixes the names of the indices, particularly .alerts-observability-apm -> .alerts-observability.apm.alerts.
The current rule data client in the master branch writes to .alerts-observability.apm.alerts.
dominiqueclarke
left a comment
There was a problem hiding this comment.
Uptime changes LGTM
e9014a6 to
213d269
Compare
213d269 to
c3e2a8f
Compare
|
Thank you @dhurley14 @weltenwort @dominiqueclarke for your reviews 🙏 |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @banderror |
…atures to index names (elastic#109567) **Ticket:** elastic#102089 🚨 **This PR is critical for Observability 7.15** 🚨 ## Summary This PR introduces changes that fix the usage of alerts-as-data index naming in RBAC. It builds on top of elastic#109346 and replaces elastic#108872. TODO: - [x] Address elastic#109346 (review) - [x] Make changes to `AlertsClient.getAuthorizedAlertsIndices()` so it starts using `RuleDataService` to get index names by feature ids. - [x] Delete the hardcoded `mapConsumerToIndexName` where we had incorrect index names. - [x] Close elastic#108872 ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
…atures to index names (elastic#109567) **Ticket:** elastic#102089 🚨 **This PR is critical for Observability 7.15** 🚨 ## Summary This PR introduces changes that fix the usage of alerts-as-data index naming in RBAC. It builds on top of elastic#109346 and replaces elastic#108872. TODO: - [x] Address elastic#109346 (review) - [x] Make changes to `AlertsClient.getAuthorizedAlertsIndices()` so it starts using `RuleDataService` to get index names by feature ids. - [x] Delete the hardcoded `mapConsumerToIndexName` where we had incorrect index names. - [x] Close elastic#108872 ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
…atures to index names (#109567) (#110068) **Ticket:** #102089 🚨 **This PR is critical for Observability 7.15** 🚨 ## Summary This PR introduces changes that fix the usage of alerts-as-data index naming in RBAC. It builds on top of #109346 and replaces #108872. TODO: - [x] Address #109346 (review) - [x] Make changes to `AlertsClient.getAuthorizedAlertsIndices()` so it starts using `RuleDataService` to get index names by feature ids. - [x] Delete the hardcoded `mapConsumerToIndexName` where we had incorrect index names. - [x] Close #108872 ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
…atures to index names (#109567) (#110067) **Ticket:** #102089 🚨 **This PR is critical for Observability 7.15** 🚨 ## Summary This PR introduces changes that fix the usage of alerts-as-data index naming in RBAC. It builds on top of #109346 and replaces #108872. TODO: - [x] Address #109346 (review) - [x] Make changes to `AlertsClient.getAuthorizedAlertsIndices()` so it starts using `RuleDataService` to get index names by feature ids. - [x] Delete the hardcoded `mapConsumerToIndexName` where we had incorrect index names. - [x] Close #108872 ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
Ticket: #102089
🚨 This PR is critical for Observability 7.15 🚨
Summary
This PR introduces changes that fix the usage of alerts-as-data index naming in RBAC. It builds on top of #109346 and replaces #108872.
TODO:
AlertsClient.getAuthorizedAlertsIndices()so it starts usingRuleDataServiceto get index names by feature ids.mapConsumerToIndexNamewhere we had incorrect index names.Checklist
Delete any items that are not applicable to this PR.