From c78abd97ddf69159936c0f075442aac99f044e8a Mon Sep 17 00:00:00 2001
From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com>
Date: Fri, 17 Jan 2025 22:28:54 +0100
Subject: [PATCH] Add rules views
---
.../public/components/app.tsx | 20 +-
.../integretions/mock-data-rules.tsx | 746 ++++++++++++++++++
.../public/components/rules/overview.tsx | 90 +++
.../public/components/rules/rule-details.tsx | 7 +
4 files changed, 860 insertions(+), 3 deletions(-)
create mode 100644 plugins/wazuh-security-policies/public/components/integretions/mock-data-rules.tsx
create mode 100644 plugins/wazuh-security-policies/public/components/rules/overview.tsx
create mode 100644 plugins/wazuh-security-policies/public/components/rules/rule-details.tsx
diff --git a/plugins/wazuh-security-policies/public/components/app.tsx b/plugins/wazuh-security-policies/public/components/app.tsx
index f5663fe469..135546d068 100644
--- a/plugins/wazuh-security-policies/public/components/app.tsx
+++ b/plugins/wazuh-security-policies/public/components/app.tsx
@@ -10,7 +10,9 @@ import {
import { Router, Route, Switch, Redirect, useParams } from 'react-router-dom';
import { getCore, getHistory } from '../plugin-services';
import { IntegrationOverview } from './integretions/overview';
-import { IntegrationView } from './integretions/integration';
+import { IntegrationView } from './integretions/integration-details';
+import { RulesOverview } from './rules/overview';
+import { RuleDetails } from './rules/rule-details';
interface ViewInterface {
name: string;
@@ -29,7 +31,8 @@ const views: ViewInterface[] = [
{
name: 'Rules',
id: 'rules',
- render: () =>
Rules
,
+ render: () => ,
+ renderDetails: () => ,
},
{
name: 'Decoders',
@@ -46,6 +49,11 @@ const views: ViewInterface[] = [
export const WazuhSecurityPoliciesApp = () => {
const history = getHistory();
const [currentTab, setCurrentTab] = useState('');
+ const [isSideNavOpenOnMobile, setIsSideNavOpenOnMobile] = useState(false);
+
+ const toggleOpenOnMobile = () => {
+ setIsSideNavOpenOnMobile(!isSideNavOpenOnMobile);
+ };
useEffect(() => {
setCurrentTab(history.location.pathname);
@@ -76,7 +84,13 @@ export const WazuhSecurityPoliciesApp = () => {
<>
-
+ toggleOpenOnMobile()}
+ isOpenOnMobile={isSideNavOpenOnMobile}
+ aria-label='Ruleset'
+ items={sideNav}
+ />
[]:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/1',
+ provider: 'native',
+ status: 'disable',
+ metadata: {
+ module: 'syslog2',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/2',
+ provider: 'native',
+ status: 'disable',
+ metadata: {
+ module: 'syslog3',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/0',
+ provider: 'native',
+ status: 'disable',
+ metadata: {
+ module: 'syslog4',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/1',
+ provider: 'native',
+ status: 'disable',
+ metadata: {
+ module: 'syslog5',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/2',
+ provider: 'native',
+ status: 'draft',
+ metadata: {
+ module: 'syslog6',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/0',
+ provider: 'custom',
+ status: 'enable',
+ metadata: {
+ module: 'syslog',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/1',
+ provider: 'custom',
+ status: 'enable',
+ metadata: {
+ module: 'syslog',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'RFC3164 example 4 section 5.4',
+ },
+ ],
+ normalize: [
+ {
+ map: [
+ { 'event.kind': 'event' },
+ { 'wazuh.decoders': 'array_append(syslog)' },
+ { 'related.hosts': 'array_append($host.hostname)' },
+ { 'process.name': 'rename($TAG)' },
+ { 'host.ip': 'array_append($tmp.host_ip)' },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'decoder/syslog/2',
+ provider: 'custom',
+ status: 'enable',
+ metadata: {
+ module: 'syslog',
+ title: 'Syslog Decoder event',
+ description: 'Syslog header',
+ compatibility: 'This decoder has been tested on Wazuh version 4.3',
+ author: {
+ name: 'Wazuh, Inc.',
+ url: 'https://wazuh.com',
+ date: '2022/11/08',
+ },
+ references: [
+ 'https://www.ietf.org/rfc/rfc3164.txt',
+ 'https://www.ietf.org/rfc/rfc5424.txt',
+ ],
+ },
+ 'parse|event.original': [
+ {
+ pattern:
+ ' []:<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 standard',
+ },
+ {
+ pattern:
+ ' :<~/ignore/ >',
+ description: 'BSD Syslog RFC 3164 no pid',
+ },
+ {
+ pattern:
+ ' []: ',
+ description: 'BSD Syslog RFC 3164 standard ISO8601',
+ },
+ {
+ pattern:
+ ' : ',
+ description: 'BSD Syslog RFC 3164 no pid ISO8601',
+ },
+ {
+ pattern: ' ',
+ description: 'RFC3164 example 2 section 5.4',
+ },
+ {
+ pattern:
+ ' []:<~/ignore/ >