Skip to content
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

[Security Solution] - Updating UI to work with new kibana privileges abstraction on alerts #108961

Merged
merged 26 commits into from
Aug 18, 2021

Conversation

yctercero
Copy link
Contributor

@yctercero yctercero commented Aug 17, 2021

Summary

++ @XavierM , @michaelolo24, @stephmilovic, @semd, @angorayc, @machadoum, @dhurley14 big thanks for helping push these changes through, fix tests, etc.

Holy moly.

What is happening in this PR? 🤷🏽‍♀️ Let's break it down:

  • Added a package @kbn/alerts - another one?! ...yes
    • This is meant to add shared hooks and components around alerts as data
    • useGetUserAlertsPermissions - accepts the Kibana capabilities object and returns whether the user has read and crud alerts privileges
    • AlertsFeatureNoPermissions - component displayed when user does not have alerts privileges
  • UI changes for user with NO alerts privileges
    • Alerts tab hidden in security solution side navigation
    • Alerts tab hidden in rule details page
  • UI changes for user with alerts READ ONLY privileges
    • alerts checkboxes hidden in alerts table
    • alerts bulk actions hidden in alerts table
  • per discussions with @kobelb, @XavierM, @marshallmain, @dhurley14 , @peluja1012 moving forward with changes needed to detections read/create index routes to allow users with kibana privileges to move forward. Investigation is ongoing as to ways to apply any existing document level .siem-signals preferences on top of kibana privileges.
    • 🚨 breaking change 🚨

TO DO

  • remove alerts tab from MAIN navigation when user has no alerts privileges
  • remove alerts link from Kibana search when user has no alerts privileges
  • update privileges warning banner to remove references to needing .siem-signals ES privileges
  • want to follow up with more robust tests

Notes

  • There is now some repetitive logic/code in the UI, where we're maintaining user privilege info in hooks, context, and redux. This will require cleanup, but would rather do once we have more tests in.
  • While coding, found a good chunk of dead code paths around the old alerts table utility bar

Screenshots

Alerts privileges NONE

Screen Shot 2021-08-17 at 7 48 17 PM

Screen Shot 2021-08-17 at 7 45 22 PM

Alerts privileges READ ONLY

Screen Shot 2021-08-17 at 7 44 33 PM

Checklist

For maintainers

@@ -31,7 +31,7 @@ export const mapConsumerToIndexName: Record<AlertConsumers, string | string[]> =
logs: '.alerts-observability.logs',
infrastructure: '.alerts-observability.metrics',
observability: '.alerts-observability',
siem: ['.alerts-security.alerts', '.siem-signals'],
siem: '.alerts-security.alerts',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.siem-signals is dynamically named and also aliased to .alerts-security.alerts-space so no need to query both.

@yctercero yctercero marked this pull request as ready for review August 18, 2021 01:49
@yctercero yctercero requested review from a team as code owners August 18, 2021 01:49

export const useGetUserAlertsPermissions = (
uiCapabilities: RecursiveReadonly<Record<string, any>>,
featureId: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic should be different to allow o11y to be able to use it. we need to remember that they can have multiple alerts from different feature IDs like logs, APM, Metrics etc. Make sense to us but not sure if it will be good for them.

query: { features: SERVER_APP_ID },
}
);
signal = { name: indexName[0] };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - let's add a comment for FUTURE DEVELOPER, that the expectation here is to only have one index for the alert index

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Def! Will add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do...BUT will add if CI fails or as follow up.

Copy link
Contributor

@XavierM XavierM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review it with 👓 🔎 👓, Tested locally, code looks good and it is working as expected.

Good job!!! 👍 👏 🍾

@yctercero yctercero self-assigned this Aug 18, 2021
@yctercero yctercero added release_note:breaking Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.15.0 v8.0.0 labels Aug 18, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@yctercero yctercero added the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 18, 2021
@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

go

@mistic mistic added v7.16.0 and removed v7.15.0 labels Aug 18, 2021
@michaelolo24 michaelolo24 added bug Fixes for quality problems that affect the customer experience v7.15.0 and removed v7.16.0 labels Aug 18, 2021
@XavierM
Copy link
Contributor

XavierM commented Aug 18, 2021

we need tags 7.15 and 7.16 for the auto-backport to work

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2362 2371 +9

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 4.4MB 4.4MB -18.0B
observability 490.5KB 490.5KB -18.0B
securitySolution 6.5MB 6.5MB +8.0KB
timelines 437.5KB 437.6KB +93.0B
total +8.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
infra 149.7KB 149.6KB -18.0B
securitySolution 211.7KB 212.1KB +450.0B
uptime 36.6KB 36.6KB -18.0B
total +414.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @yctercero

@yctercero yctercero merged commit 9fa41d1 into elastic:master Aug 18, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 18, 2021
…abstraction on alerts (elastic#108961)

## Summary

Holy moly. 

What is happening in this PR? 🤷🏽‍♀️ Let's break it down:
- Added a package `@kbn/alerts` - another one?! ...yes
  - This is meant to add shared hooks and components around alerts as data
  - `useGetUserAlertsPermissions` - accepts the Kibana capabilities object and returns whether the user has `read` and `crud` alerts privileges
  - `AlertsFeatureNoPermissions` - component displayed when user does not have alerts privileges
- UI changes for user with NO alerts privileges
  - `Alerts` tab hidden in security solution side navigation
  - `Alerts` tab hidden in rule details page  
- UI changes for user with alerts READ ONLY privileges
  - alerts checkboxes hidden in alerts table
  - alerts bulk actions hidden in alerts table
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 18, 2021
…abstraction on alerts (elastic#108961)

## Summary

Holy moly. 

What is happening in this PR? 🤷🏽‍♀️ Let's break it down:
- Added a package `@kbn/alerts` - another one?! ...yes
  - This is meant to add shared hooks and components around alerts as data
  - `useGetUserAlertsPermissions` - accepts the Kibana capabilities object and returns whether the user has `read` and `crud` alerts privileges
  - `AlertsFeatureNoPermissions` - component displayed when user does not have alerts privileges
- UI changes for user with NO alerts privileges
  - `Alerts` tab hidden in security solution side navigation
  - `Alerts` tab hidden in rule details page  
- UI changes for user with alerts READ ONLY privileges
  - alerts checkboxes hidden in alerts table
  - alerts bulk actions hidden in alerts table
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.15
7.x

The backport PRs will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 18, 2021
…abstraction on alerts (#108961) (#109156)

## Summary

Holy moly. 

What is happening in this PR? 🤷🏽‍♀️ Let's break it down:
- Added a package `@kbn/alerts` - another one?! ...yes
  - This is meant to add shared hooks and components around alerts as data
  - `useGetUserAlertsPermissions` - accepts the Kibana capabilities object and returns whether the user has `read` and `crud` alerts privileges
  - `AlertsFeatureNoPermissions` - component displayed when user does not have alerts privileges
- UI changes for user with NO alerts privileges
  - `Alerts` tab hidden in security solution side navigation
  - `Alerts` tab hidden in rule details page  
- UI changes for user with alerts READ ONLY privileges
  - alerts checkboxes hidden in alerts table
  - alerts bulk actions hidden in alerts table

Co-authored-by: Yara Tercero <yctercero@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Aug 18, 2021
…abstraction on alerts (#108961) (#109155)

## Summary

Holy moly. 

What is happening in this PR? 🤷🏽‍♀️ Let's break it down:
- Added a package `@kbn/alerts` - another one?! ...yes
  - This is meant to add shared hooks and components around alerts as data
  - `useGetUserAlertsPermissions` - accepts the Kibana capabilities object and returns whether the user has `read` and `crud` alerts privileges
  - `AlertsFeatureNoPermissions` - component displayed when user does not have alerts privileges
- UI changes for user with NO alerts privileges
  - `Alerts` tab hidden in security solution side navigation
  - `Alerts` tab hidden in rule details page  
- UI changes for user with alerts READ ONLY privileges
  - alerts checkboxes hidden in alerts table
  - alerts bulk actions hidden in alerts table

Co-authored-by: Yara Tercero <yctercero@users.noreply.github.com>
@yctercero yctercero deleted the alerts_privs_ui branch October 13, 2021 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience release_note:breaking Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.15.0 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants