Skip to content

[AI4SOC] Add rules management table#219111

Merged
xcrzx merged 1 commit intoelastic:mainfrom
xcrzx:promotion_rule_management
Apr 25, 2025
Merged

[AI4SOC] Add rules management table#219111
xcrzx merged 1 commit intoelastic:mainfrom
xcrzx:promotion_rule_management

Conversation

@xcrzx
Copy link
Contributor

@xcrzx xcrzx commented Apr 24, 2025

Resolves: https://github.com/elastic/security-team/issues/11787

Summary

Added the rule management and rule monitoring table to the AI4SOC tier.

Rule Monitoring

image

Rule Management

image

Empty state

Screenshot 2025-04-24 at 17 03 19

UPD: I had to disable links to the rule details page for now. Will be working on enabling them separately

@xcrzx xcrzx self-assigned this Apr 24, 2025
@tomsonpl
Copy link
Contributor

/ci

@xcrzx xcrzx force-pushed the promotion_rule_management branch from 9312274 to ce52ff3 Compare April 25, 2025 11:50
@xcrzx xcrzx marked this pull request as ready for review April 25, 2025 11:56
@xcrzx xcrzx requested review from a team as code owners April 25, 2025 11:56
@xcrzx xcrzx requested review from nikitaindik and rylnd April 25, 2025 11:56
@xcrzx xcrzx added v9.1.0 release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Security Generative AI Security Generative AI labels Apr 25, 2025
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

Code Review only. LGTM 🚀

@maximpn maximpn requested review from maximpn and removed request for nikitaindik April 25, 2025 12:20
import { hasCapabilities } from '../lib/capabilities';
import { useKibana } from '../lib/kibana';

export const useIsSearchAiLakeTier = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const useIsSearchAiLakeTier = () => {
export const useIsExternalDetectionsEnabled = () => {

Copy link
Contributor

Choose a reason for hiding this comment

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

We should not need to care about tiers here, only if externalDetections functionality is enabled or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What we're trying to do here doesn't map well to the product features, since we essentially need to disable multiple parts of the page on the AI4SOC tier. A more robust approach might be to add a key in the config for each feature we want to disable, but that would inflate the product feature config we support. So I'm not sure which approach is best here.

Anyway, reverting the changes for now to give us time for a more well-thought-out solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

If for some reason you do need to check the capability in a future PR you can use this hook:

const { hasSearchAILakeConfigurations } = useAssistantAvailability();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If for some reason you do need to check the capability in a future PR you can use this hook:

Thanks, I was looking for something like that 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

It's hard to grep for these variables that have AI in them because half of the people capitalize it Ai and the other half AI 😂

Copy link
Contributor

@semd semd Apr 25, 2025

Choose a reason for hiding this comment

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

What we're trying to do here doesn't map well to the product features, since we essentially need to disable multiple parts of the page on the AI4SOC tier.

That's why we created new capabilities: detections (traditional in-house siem detections functionalities) and external_detections (new external detections rules functionality, for now it's only used in the new ai serverless tier)

Here we are hiding stuff when the user has external_detections (or does not have detections), the implementation of the hook looked correct to me, it was only the name of the hook that was misleading. In the security_solution plugin we should be agnostic and not know anything serverless-specific stuff, such as tiers.

And about using this here:

const { hasSearchAILakeConfigurations } = useAssistantAvailability();

I don't recommend this either, the assistant stuff should be checked in places where we do assistant-related things, not here. And the configurations capability should be checked only for logic related to the configuration page functionality.

Not saying this would now work, yes it would right now. But this would introduce coupling, if someday configurations (or external_detections) capability is changed and granted by another serverless tier, we will need to remember to come here to change this code, or we'll be introducing a bug. Which should not be necessary.

@xcrzx xcrzx force-pushed the promotion_rule_management branch from ce52ff3 to d1999b3 Compare April 25, 2025 14:28
@xcrzx xcrzx removed request for a team and rylnd April 25, 2025 14:29
Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

Code review and manual testing LGTM

Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

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

@xcrzx Thanks for adding a simple Rules Management table for AI4SOC 🙏

I've tested the PR locally and it works fine. There are non critical comments.

Comment on lines +108 to +114
append:
installedTotal > 0 ? (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
) : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
append:
installedTotal > 0 ? (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
) : undefined,
append: installedTotal > 0 && (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
),,

Comment on lines +120 to +126
append:
installedTotal > 0 ? (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
) : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
append:
installedTotal > 0 ? (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
) : undefined,
append: installedTotal > 0 && (
<EuiNotificationBadge size="m" color="subdued">
{installedTotal}
</EuiNotificationBadge>
),

});
const executionStatusColumn = useRuleExecutionStatusColumn({
sortable: true,
width: '16%',
Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed width should work better. Otherwise min width should be set. Relative width gets too narrow on smaller screens

image

Comment on lines +687 to +723
{isSearchAiLake === false && (
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
<EditRuleSettingButtonLink
ruleId={ruleId}
disabled={
!isExistingRule ||
!hasUserCRUDPermission(canUserCRUD) ||
(isMlRule(rule?.type) && !hasMlPermissions)
}
disabledReason={explainLackOfPermission(
rule,
hasMlPermissions,
hasActionsPrivileges,
canUserCRUD
)}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<RuleActionsOverflow
rule={rule}
userHasPermissions={
isExistingRule && hasUserCRUDPermission(canUserCRUD)
}
canDuplicateRuleWithActions={canEditRuleWithActions(
rule,
hasActionsPrivileges
)}
showBulkDuplicateExceptionsConfirmation={showBulkDuplicateConfirmation}
showManualRuleRunConfirmation={showManualRuleRunConfirmation}
confirmDeletion={confirmDeletion}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should rule actions and settings be extracted to a separate component for better readability?

},
sortable: true,
truncateText: true,
width: '16%',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have the fixed width?

@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 25, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 7336 7338 +2

Async chunks

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

id before after diff
securitySolution 9.1MB 9.1MB +2.7KB

History

cc @xcrzx

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Desk tested and code LGTM for Threat Hunting Investigations team

@xcrzx xcrzx merged commit 857bf1d into elastic:main Apr 25, 2025
9 checks passed
@xcrzx xcrzx deleted the promotion_rule_management branch April 25, 2025 16:14
peluja1012 pushed a commit to peluja1012/kibana that referenced this pull request Apr 25, 2025
**Resolves: elastic/security-team#11787

## Summary

Added the rule management and rule monitoring table to the AI4SOC tier.

### Rule Monitoring


![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)

### Rule Management


![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)

### Empty state

![Screenshot 2025-04-24 at 17 03
19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)

UPD: I had to disable links to the rule details page for now. Will be
working on enabling them separately
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
**Resolves: elastic/security-team#11787

## Summary

Added the rule management and rule monitoring table to the AI4SOC tier.

### Rule Monitoring


![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)

### Rule Management


![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)

### Empty state

![Screenshot 2025-04-24 at 17 03
19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)

UPD: I had to disable links to the rule details page for now. Will be
working on enabling them separately
@xcrzx xcrzx added backport:version Backport to applied version labels v8.19.0 and removed backport:skip This PR does not require backporting labels Jun 16, 2025
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15683081338

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 16, 2025
**Resolves: https://github.com/elastic/security-team/issues/11787**

## Summary

Added the rule management and rule monitoring table to the AI4SOC tier.

### Rule Monitoring

![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)

### Rule Management

![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)

### Empty state

![Screenshot 2025-04-24 at 17 03
19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)

UPD: I had to disable links to the rule details page for now. Will be
working on enabling them separately

(cherry picked from commit 857bf1d)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 16, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[AI4SOC] Add rules management table
(#219111)](#219111)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dmitrii
Shevchenko","email":"dmitrii.shevchenko@elastic.co"},"sourceCommit":{"committedDate":"2025-04-25T16:14:25Z","message":"[AI4SOC]
Add rules management table (#219111)\n\n**Resolves:
https://github.com/elastic/security-team/issues/11787**\n\n##
Summary\n\nAdded the rule management and rule monitoring table to the
AI4SOC tier.\n\n### Rule
Monitoring\n\n\n![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)\n\n###
Rule
Management\n\n\n![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)\n\n###
Empty state\n\n![Screenshot 2025-04-24 at 17
03\n19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)\n\nUPD:
I had to disable links to the rule details page for now. Will
be\nworking on enabling them
separately","sha":"857bf1d90c3f40dff56e7fc58e493658e7107a24","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:
SecuritySolution","Team:Security Generative
AI","backport:version","v9.1.0","v8.19.0"],"title":"[AI4SOC] Add rules
management
table","number":219111,"url":"https://github.com/elastic/kibana/pull/219111","mergeCommit":{"message":"[AI4SOC]
Add rules management table (#219111)\n\n**Resolves:
https://github.com/elastic/security-team/issues/11787**\n\n##
Summary\n\nAdded the rule management and rule monitoring table to the
AI4SOC tier.\n\n### Rule
Monitoring\n\n\n![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)\n\n###
Rule
Management\n\n\n![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)\n\n###
Empty state\n\n![Screenshot 2025-04-24 at 17
03\n19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)\n\nUPD:
I had to disable links to the rule details page for now. Will
be\nworking on enabling them
separately","sha":"857bf1d90c3f40dff56e7fc58e493658e7107a24"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219111","number":219111,"mergeCommit":{"message":"[AI4SOC]
Add rules management table (#219111)\n\n**Resolves:
https://github.com/elastic/security-team/issues/11787**\n\n##
Summary\n\nAdded the rule management and rule monitoring table to the
AI4SOC tier.\n\n### Rule
Monitoring\n\n\n![image](https://github.com/user-attachments/assets/6b22e69e-b2a9-4788-a82b-22a2746aafe9)\n\n###
Rule
Management\n\n\n![image](https://github.com/user-attachments/assets/97fb35e2-014a-4361-8e77-67ffcc37465d)\n\n###
Empty state\n\n![Screenshot 2025-04-24 at 17
03\n19](https://github.com/user-attachments/assets/8b86563b-21aa-49c6-beb2-e00ff671fa29)\n\nUPD:
I had to disable links to the rule details page for now. Will
be\nworking on enabling them
separately","sha":"857bf1d90c3f40dff56e7fc58e493658e7107a24"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants