-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[RAC] [RBAC] add space ids array to each alert document #105173
Conversation
ab2f789
to
43cdac3
Compare
… of this could go in the authorization class but I don't think we have access to the spaceids when we generate the kibana security action strings?
…pdates jest tests, adds integration tests
…e_ids to kibana.space_ids
0aeb067
to
58be86e
Compare
…na.space_ids in rule registry integration tests and apm integration tests
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.
Thanks for the update, LGTM 👍
// not sure why typescript needs the non-null assertion here | ||
// we already assert the value is not undefined with the ternary | ||
// still getting an error with the ternary.. strange. |
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.
This is a Typescript limitation. It is not smart enough to narrow down the type of a computed property inside if-else:
const obj: { prop?: string } = {}
if (obj.prop) {
obj.prop.toLowerCase() // <- guard works, no type error
}
const prop: 'prop' = 'prop'
if (obj[prop]) {
obj[prop].toLowerCase() // <- guard doesn't work, object is possibly 'undefined' error
}
x-pack/plugins/rule_registry/docs/alerts_client/classes/alertsclient.md
Outdated
Show resolved
Hide resolved
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.
Alerting changes LGTM
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.
APM test updates LGTM
💚 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 @dhurley14 |
💔 Backport failed
To backport manually run: |
event[SPACE_IDS] = | ||
event[SPACE_IDS] == null | ||
? [spaceId] | ||
: [spaceId, ...event[SPACE_IDS]!.filter((sid) => sid !== spaceId)]; |
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.
It looks like we're only adding space IDs for lifecycle alerts. Is there something preventing us from injecting the space ID inside the RuleDataClient bulk
method so that persistence rule types and any future rule types will also automatically inject the space ID?
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.
This is true we could push down the space id from the plugins into the rule data client, which would then be accessible via the bulk method. I'll take a look at this.
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 would end up iterating over the data passed into bulk twice rather than once (like in the executor definitions), so not that optimal.
* kind of working solution... need to fix types.. would be great if all of this could go in the authorization class but I don't think we have access to the spaceids when we generate the kibana security action strings? * update mapping type as array:true for space_ids field, fixes types, updates jest tests, adds integration tests * undo changes in alerting authz class * update snapshot for apm api integration test for rules writing alerts * fix apm integration tests * omit version and sequence from expected outcome * re-add space id after this code was moved in master * add another default space id to test * fixes bug to remove duplicate spaceids * add space ids filter to elasticsearch query, updates detection role * update snapshot * update type docs for alerts client * remove dead code * fix type error * renames space ids field on alert documents from kibana.rac.alert.space_ids to kibana.space_ids * fixes kb-rule-data-utils package * update snapshots * remove references to kibana.rac.alert.space_ids and replace with kibana.space_ids in rule registry integration tests and apm integration tests * fix apm functional test snapshots * undo index name changes I made in apm integration test configs * update typedocs references to upstream, not local repo # Conflicts: # x-pack/test/rule_registry/security_and_spaces/tests/trial/update_alert.ts
…06023) * kind of working solution... need to fix types.. would be great if all of this could go in the authorization class but I don't think we have access to the spaceids when we generate the kibana security action strings? * update mapping type as array:true for space_ids field, fixes types, updates jest tests, adds integration tests * undo changes in alerting authz class * update snapshot for apm api integration test for rules writing alerts * fix apm integration tests * omit version and sequence from expected outcome * re-add space id after this code was moved in master * add another default space id to test * fixes bug to remove duplicate spaceids * add space ids filter to elasticsearch query, updates detection role * update snapshot * update type docs for alerts client * remove dead code * fix type error * renames space ids field on alert documents from kibana.rac.alert.space_ids to kibana.space_ids * fixes kb-rule-data-utils package * update snapshots * remove references to kibana.rac.alert.space_ids and replace with kibana.space_ids in rule registry integration tests and apm integration tests * fix apm functional test snapshots * undo index name changes I made in apm integration test configs * update typedocs references to upstream, not local repo # Conflicts: # x-pack/test/rule_registry/security_and_spaces/tests/trial/update_alert.ts
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
Since we cannot provide the space id during the generation of the security URI's in the feature privilege builder step (in plugin setup phase) we must filter them out during the fetch of the alert.
Checklist
Delete any items that are not applicable to this PR.
For maintainers