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][Exceptions] - Add exception list duplication options with and without expired items #154991

Merged
merged 17 commits into from Apr 21, 2023

Conversation

yctercero
Copy link
Contributor

@yctercero yctercero commented Apr 15, 2023

Summary

Adds the following:

  • Add the option to duplicate from the shared exception list management actions dropdowns
    • User can select to include exception items with expired TTL
    • User can select to not include exception items with expired TTL
    • Cypress tests added for both options

Screenshot 2023-04-15 at 9 31 46 AM

Screenshot 2023-04-15 at 9 32 45 AM

  • Add the option to duplicate from the shared exception list details header actions dropdowns
    • User can select to include exception items with expired TTL
    • User can select to not include exception items with expired TTL
    • On duplicate, user is redirected to newly created list
    • Cypress tests added for both options

Screenshot 2023-04-15 at 9 32 02 AM

Screenshot 2023-04-15 at 9 32 45 AM

  • Add the option to include or exclude exception items with expired TTL when bulk duplicating rules from rules management page
    • Cypress tests added for both options

Screenshot 2023-04-20 at 1 30 16 PM

Checklist

@yctercero yctercero self-assigned this Apr 15, 2023
@yctercero yctercero added Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Rule Exceptions Security Solution Rule Exceptions feature release_note:feature Makes this part of the condensed release notes Team:Security Solution Platform Security Solution Platform Team v8.8.0 labels Apr 15, 2023
@yctercero yctercero requested a review from a team April 15, 2023 16:40
@yctercero yctercero marked this pull request as ready for review April 16, 2023 03:47
@yctercero yctercero requested review from a team as code owners April 16, 2023 03:47
@yctercero yctercero requested a review from spong April 16, 2023 03:47
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@dplumlee dplumlee left a comment

Choose a reason for hiding this comment

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

Pulled down and tested all three scenarios, looks good from an alert area pov. Great test coverage!

const filter = includeExpiredExceptions
? []
: [
`(${savedObjectPrefix}.attributes.expire_time > "${new Date().toISOString()}" OR NOT ${savedObjectPrefix}.attributes.expire_time: *)`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't necessarily a comment for your PR but we should perhaps centralize this filter string since it's used just about every place we have to filter for/against expired exceptions and probably will be going forward. I know we have this for an array of SavedObjectType's but nothing else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I can probably do a follow up with this. My only hesitation doing it here is trying not to increase the number of files touched since it's already much more than anticipated.

@nastasha-solomon
Copy link
Contributor

nastasha-solomon commented Apr 20, 2023

Thanks for tagging the docs team for the UI copy, @yctercero! Please find my suggestions below.

Confirmation prompt to duplicate expired exception items

expired-exception-items

Does this prompt only appear after users choose to duplicate a shared exception list with expired exception items? If it does, I recommend some minor tweaks:

  • Title: Duplicate expired exceptions?
  • Body text: This exception list has expired exceptions. Switch the toggle off if you don't want to duplicate them.
  • Button: Duplicate

If this prompt appears after users choose to duplicate a shared exception list or it appears regardless of whether the list contains expired exception items, I'd suggest something different. I'll hold off on that for now though.

Confirmation prompt to duplicate rule

lotsa-options

Title
To clarify, does this prompt appear regardless of whether the rule has an exception? If that's the case, I think the title should reflect the primary action the user is taking, which is duplicating the rule. With that in mind, here's my suggestion for the title:
Duplicate the rule?

Body
My recommendations for the body text if the user is only duplicating one rule:
You're duplicating 1 rule. Choose what to duplicate:

If the user is duplicating multiple rules:
You're duplicating 2 rules. Choose what to duplicate:

Options
My recs for the options if the user is only duplicating one rule:

  • Only the rule
  • The rule and its active exceptions
  • The rule and all of its exceptions (active and expired)

If the user is duplicating multiple rules:

  • Only the rules
  • The rules and their active exceptions
  • The rules and all of their exceptions (active and expired)

Comment on lines +140 to +146
modalDuplicationConfirmationResult === DuplicateOptions.withExceptions ||
modalDuplicationConfirmationResult ===
DuplicateOptions.withExceptionsExcludeExpiredExceptions,
include_expired_exceptions: !(
modalDuplicationConfirmationResult ===
DuplicateOptions.withExceptionsExcludeExpiredExceptions
),
Copy link
Member

Choose a reason for hiding this comment

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

nit: Maybe have useBulkDuplicateExceptionsConfirmation's showBulkDuplicateConfirmation return object also include include_exceptions/include_expired_exceptions bools thus encapsulating this logic?

Was just thinking how to DRY this out since it's used a few places, no biggie either way.

Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Reviewed rules area code changes, checked out, tested locally and LGTM! 👍 🚀

Great stuff here @yctercero 🎉 I left a few nits, but nothing major. Really appreciate the thorough test coverage you added here .

I tested both the Rules Table/Details bulk_editing paths, along with the Shared Exceptions UI duplication as well. Didn't find any issues, and everything looked as expected (even when duplicating lists with only expired exception items :).

@nkhristinin
Copy link
Contributor

LGTM! Nice work @yctercero

I only have one question, currently the rule duplication modal window looks like that.
Screenshot 2023-04-21 at 13 59 30

And for me, options is more confusing than it was here

233483247-773b0672-48bd-4eed-95a9-ce632a5df000

.send()
.expect(200);

// Item should have been duplicated, even if expired
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the comments. Really helpful!

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Investigations changes - Seems like they were only cypress tests, so might be worth updating codeowners or re-organizing the files later on as most of these don't affect us

@yctercero yctercero enabled auto-merge (squash) April 21, 2023 22:41
@yctercero yctercero merged commit 1115532 into elastic:main Apr 21, 2023
19 checks passed
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #8 / AIOps POST /internal/aiops/explain_log_rate_spikes - groups only with ecommerce should return group only in chunks with streaming without compression with flushFix
  • [job] [logs] Security Solution Tests #3 / timeline flyout button the (+) button popover menu owns focus

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lists 259 260 +1
securitySolution 3831 3832 +1
total +2

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/securitysolution-io-ts-list-types 503 515 +12
@kbn/securitysolution-list-api 64 65 +1
@kbn/securitysolution-list-hooks 47 49 +2
total +15

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/securitysolution-io-ts-list-types 1 0 -1

Async chunks

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

id before after diff
lists 157.2KB 157.3KB +78.0B
securitySolution 9.1MB 9.1MB +7.0KB
total +7.1KB
Unknown metric groups

API count

id before after diff
@kbn/securitysolution-io-ts-list-types 516 528 +12
@kbn/securitysolution-list-api 67 69 +2
@kbn/securitysolution-list-hooks 60 62 +2
total +16

ESLint disabled line counts

id before after diff
securitySolution 394 397 +3

Total ESLint disabled count

id before after diff
securitySolution 474 477 +3

History

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

cc @yctercero

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 21, 2023
@yctercero yctercero deleted the exceptions_dupe_8.8 branch April 24, 2023 04:43
nikitaindik pushed a commit to nikitaindik/kibana that referenced this pull request Apr 25, 2023
…ons with and without expired items (elastic#154991)

## Summary

Adds the following:

- Add the option to duplicate from the shared exception list management
actions dropdowns
  - User can select to include exception items with expired TTL
  - User can select to not include exception items with expired TTL 
  - Cypress tests added for both options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Rule Exceptions Security Solution Rule Exceptions feature release_note:feature Makes this part of the condensed release notes Team:Security Solution Platform Security Solution Platform Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants