From eb91b821c4b80ea32d561f8f632daa90887adef3 Mon Sep 17 00:00:00 2001 From: Nicolas Agustin Guevara Pihen <42900763+Tostti@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:03:45 -0300 Subject: [PATCH 01/39] Bump revision 03 for 4.9.0 Alpha3 (#6855) Bump revision 03 --- CHANGELOG.md | 2 +- plugins/main/opensearch_dashboards.json | 2 +- plugins/main/package.json | 2 +- plugins/wazuh-check-updates/opensearch_dashboards.json | 2 +- plugins/wazuh-check-updates/package.json | 2 +- plugins/wazuh-core/opensearch_dashboards.json | 2 +- plugins/wazuh-core/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d80b906b..3bc55521a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Wazuh app project will be documented in this file. -## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 02 +## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 03 ### Added diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index 98c28c7a3e..91947725d3 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuh", - "version": "4.9.0-02", + "version": "4.9.0-03", "opensearchDashboardsVersion": "opensearchDashboards", "configPath": ["wazuh"], "requiredPlugins": [ diff --git a/plugins/main/package.json b/plugins/main/package.json index 3130bcffab..b0fa218cae 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,7 +1,7 @@ { "name": "wazuh", "version": "4.9.0", - "revision": "02", + "revision": "03", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index 531c209840..9062d1cefc 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.9.0-02", + "version": "4.9.0-03", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index f9f8e11db0..653f5519ec 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-check-updates", "version": "4.9.0", - "revision": "02", + "revision": "03", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index b7f006f822..a673911d34 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.9.0-02", + "version": "4.9.0-03", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index 8483947858..bd7ac1706f 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-core", "version": "4.9.0", - "revision": "02", + "revision": "03", "pluginPlatform": { "version": "2.13.0" }, From aefa69ac9d551b2128bbfbd76254801c787c65b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Biset?= <43619595+jbiset@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:24:28 -0300 Subject: [PATCH 02/39] Fix permalink field in Events tab in Virustotal (#6839) * Changed permalink render in Events tab in Virustotal * Considered case that permalink was undefined and CHANGELOG added --- CHANGELOG.md | 1 + .../virustotal/events/virustotal-columns.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bc55521a9..12fde28252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Generate URL with predefined filters [#6745](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6745) - Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790 - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) +- Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) ### Fixed diff --git a/plugins/main/public/components/overview/virustotal/events/virustotal-columns.tsx b/plugins/main/public/components/overview/virustotal/events/virustotal-columns.tsx index 51c063420c..a62693e85c 100644 --- a/plugins/main/public/components/overview/virustotal/events/virustotal-columns.tsx +++ b/plugins/main/public/components/overview/virustotal/events/virustotal-columns.tsx @@ -1,4 +1,6 @@ import { tDataGridColumn } from '../../../common/data-grid'; +import React from 'react'; +import { EuiLink } from '@elastic/eui'; export const virustotalColumns: tDataGridColumn[] = [ { @@ -12,6 +14,17 @@ export const virustotalColumns: tDataGridColumn[] = [ }, { id: 'data.virustotal.permalink', + render: value => { + if (!value) { + return '-'; + } else { + return ( + + {value} + + ); + } + }, }, { id: 'data.virustotal.malicious', From fdc433e8743f3aef16ad6f74b7b9058aa1f87328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Biset?= <43619595+jbiset@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:42:02 -0300 Subject: [PATCH 03/39] Fixed donut card legend (#6832) * Fixed donut card legend * Added CHANGELOG --- CHANGELOG.md | 2 +- .../components/common/charts/visualizations/legend.scss | 2 +- .../endpoints-summary/dashboard/components/donut-card.tsx | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12fde28252..aeb1544969 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) - Changed the usage of the endpoint GET /groups/{group_id}/files/{file_name} [#6385](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6385) -- Refactoring and redesign endpoints summary visualizations [#6268](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6268) +- Refactoring and redesign endpoints summary visualizations [#6268](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6268) [#6832](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6832) - Move AngularJS settings controller to ReactJS [#6580](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6580) - Move AngularJS controller and view for manage groups to ReactJS [#6543](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6543) - Move AngularJS controllers and views of Tools and Dev Tools to ReactJS [#6544](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6544) diff --git a/plugins/main/public/components/common/charts/visualizations/legend.scss b/plugins/main/public/components/common/charts/visualizations/legend.scss index a3a9b27787..25c4c74985 100644 --- a/plugins/main/public/components/common/charts/visualizations/legend.scss +++ b/plugins/main/public/components/common/charts/visualizations/legend.scss @@ -3,7 +3,7 @@ overflow: auto; scrollbar-width: none; @media (min-width: 1024px) { - width: 160px; + width: 195px; } } diff --git a/plugins/main/public/components/endpoints-summary/dashboard/components/donut-card.tsx b/plugins/main/public/components/endpoints-summary/dashboard/components/donut-card.tsx index 58acf75385..fb438968f6 100644 --- a/plugins/main/public/components/endpoints-summary/dashboard/components/donut-card.tsx +++ b/plugins/main/public/components/endpoints-summary/dashboard/components/donut-card.tsx @@ -41,7 +41,10 @@ const DonutCard = ({ betaBadgeLabel={betaBadgeLabel} > - + Date: Mon, 22 Jul 2024 14:59:49 +0200 Subject: [PATCH 04/39] Add colours to GitHub dashboard metric visualisations (#6857) * Add color * Add changelog --- CHANGELOG.md | 2 +- .../github/dashboards/dashboard-panels.ts | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aeb1544969..d892cd01d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts index e6e590c43a..d1d8f5fd0b 100644 --- a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts @@ -889,10 +889,16 @@ const getVisStateMetricOrganizationsCount = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', + colorSchema: 'Greens', + metricColorMode: 'Labels', colorsRange: [ { + type: 'range', + from: 0, + to: 0, + }, + { + type: 'range', from: 0, to: 0, }, @@ -904,7 +910,6 @@ const getVisStateMetricOrganizationsCount = (indexPatternId: string) => { style: { bgFill: '#000', bgColor: false, - labelColor: false, subText: '', fontSize: 40, }, @@ -954,10 +959,16 @@ const getVisStateMetricRepositoriesCount = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', + colorSchema: 'Blues', + metricColorMode: 'Labels', colorsRange: [ { + type: 'range', + from: 0, + to: 0, + }, + { + type: 'range', from: 0, to: 0, }, @@ -1019,10 +1030,16 @@ const getVisStateMetricActorsCount = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', + colorSchema: 'Reds', + metricColorMode: 'Labels', colorsRange: [ { + type: 'range', + from: 0, + to: 0, + }, + { + type: 'range', from: 0, to: 0, }, From 034885ebfcd9279d16a29ef81eb8e2db8a618bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:46:50 -0300 Subject: [PATCH 05/39] Some links in the threat hunting dashboard table do not redirect or have no links (#6845) * fix some links in the threat hunting dashboard table do not redirect or have no links * update changelog * use RedirectAppLinks in threat hunting --- CHANGELOG.md | 2 +- .../common/wazuh-discover/render-columns.tsx | 49 ++++++++++++------- .../events/threat-hunting-columns.tsx | 12 +++-- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d892cd01d6..ca31846c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx index b3e4de94c9..3a69ec65ca 100644 --- a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx +++ b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx @@ -3,29 +3,25 @@ import { EuiLink } from '@elastic/eui'; import { tDataGridRenderColumn } from '../data-grid'; import { getCore } from '../../../kibana-services'; import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; -import { endpointSummary, rules } from '../../../utils/applications'; -import { formatUIDate } from '../../../react-services'; +import { + endpointSummary, + rules, + mitreAttack, +} from '../../../utils/applications'; import NavigationService from '../../../react-services/navigation-service'; export const MAX_ENTRIES_PER_QUERY = 10000; -const navigateTo = (ev, section, params) => { - NavigationService.getInstance().navigateToModule(ev, section, params); -}; - -const renderMitreTechnique = (technique: string) => ( - - navigateTo(e, 'overview', { - tab: 'mitre', - tabView: 'intelligence', - tabRedirect: 'techniques', - idToRedirect: technique, - }) - } - > - {technique} - +const renderMitreTechnique = technique => ( + + + {technique} + + ); export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [ @@ -86,4 +82,19 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
{renderMitreTechnique(value)}
), }, + { + id: 'rule.mitre_techniques', + render: value => + Array.isArray(value) ? ( +
+ {value?.map((technique, index) => ( +
+ {renderMitreTechnique(technique)} +
+ ))} +
+ ) : ( +
{renderMitreTechnique(value)}
+ ), + }, ]; diff --git a/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx b/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx index 87bda4ea92..e09379cae6 100644 --- a/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx +++ b/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx @@ -11,10 +11,10 @@ export const threatHuntingTableDefaultColumns: tDataGridColumn[] = [ id: 'timestamp', }, { - id: 'agent.id' + id: 'agent.id', }, { - id: 'agent.name' + id: 'agent.name', }, { id: 'rule.mitre.id', @@ -22,6 +22,9 @@ export const threatHuntingTableDefaultColumns: tDataGridColumn[] = [ { id: 'rule.mitre.tactic', }, + { + id: 'rule.mitre_technique', + }, { id: 'rule.description', }, @@ -29,7 +32,7 @@ export const threatHuntingTableDefaultColumns: tDataGridColumn[] = [ id: 'rule.level', }, { - id: 'rule.id' + id: 'rule.id', }, ]; @@ -46,6 +49,9 @@ export const threatHuntingTableAgentColumns: EuiDataGridColumn[] = [ { id: 'rule.mitre.tactic', }, + { + id: 'rule.mitre_technique', + }, { id: 'rule.description', }, From 527eeb50a47c928504dae1e5657c267ce4adc9a3 Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:22:01 +0200 Subject: [PATCH 06/39] Bump version 4.9.1 rev 00 (#6864) * chore: bump to 4.9.1 revision 00 * chore: bump the version on the server API mock --- CHANGELOG.md | 6 ++++++ docker/imposter/api-info/api_info.json | 4 ++-- plugins/main/opensearch_dashboards.json | 2 +- plugins/main/package.json | 4 ++-- plugins/wazuh-check-updates/opensearch_dashboards.json | 2 +- plugins/wazuh-check-updates/package.json | 4 ++-- plugins/wazuh-core/opensearch_dashboards.json | 2 +- plugins/wazuh-core/package.json | 4 ++-- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca31846c9a..0af5c4ff81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Wazuh app project will be documented in this file. +## Wazuh v4.9.1 - OpenSearch Dashboards 2.13.0 - Revision 00 + +### Added + +- Support for Wazuh 4.9.1 + ## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 03 ### Added diff --git a/docker/imposter/api-info/api_info.json b/docker/imposter/api-info/api_info.json index 390d836403..57b2c4f66d 100644 --- a/docker/imposter/api-info/api_info.json +++ b/docker/imposter/api-info/api_info.json @@ -1,7 +1,7 @@ { "data": { "title": "Wazuh API REST", - "api_version": "4.9.0", + "api_version": "4.9.1", "revision": 1, "license_name": "GPL 2.0", "license_url": "https://github.com/wazuh/wazuh/blob/4.5/LICENSE", @@ -9,4 +9,4 @@ "timestamp": "2022-06-13T17:20:03Z" }, "error": 0 -} \ No newline at end of file +} diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index 91947725d3..8332797807 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuh", - "version": "4.9.0-03", + "version": "4.9.1-00", "opensearchDashboardsVersion": "opensearchDashboards", "configPath": ["wazuh"], "requiredPlugins": [ diff --git a/plugins/main/package.json b/plugins/main/package.json index b0fa218cae..719f20d8fb 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,7 +1,7 @@ { "name": "wazuh", - "version": "4.9.0", - "revision": "03", + "version": "4.9.1", + "revision": "00", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index 9062d1cefc..9384a18b06 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.9.0-03", + "version": "4.9.1-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index 653f5519ec..419ee75a73 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-check-updates", - "version": "4.9.0", - "revision": "03", + "version": "4.9.1", + "revision": "00", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index a673911d34..3f819f3ee2 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.9.0-03", + "version": "4.9.1-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index bd7ac1706f..322046279a 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-core", - "version": "4.9.0", - "revision": "03", + "version": "4.9.1", + "revision": "00", "pluginPlatform": { "version": "2.13.0" }, From d988e4afdb32abf9d19c5d26af65811c53c3d0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:34:02 -0300 Subject: [PATCH 07/39] Remove `rule.mitre_techniques` column from the Threat Hunting (#6858) remove rule.mitre_techniques column from the threat hunting --- .../common/wazuh-discover/render-columns.tsx | 15 --------------- .../events/threat-hunting-columns.tsx | 6 ------ 2 files changed, 21 deletions(-) diff --git a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx index 3a69ec65ca..e5ea60f6e8 100644 --- a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx +++ b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx @@ -82,19 +82,4 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
{renderMitreTechnique(value)}
), }, - { - id: 'rule.mitre_techniques', - render: value => - Array.isArray(value) ? ( -
- {value?.map((technique, index) => ( -
- {renderMitreTechnique(technique)} -
- ))} -
- ) : ( -
{renderMitreTechnique(value)}
- ), - }, ]; diff --git a/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx b/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx index e09379cae6..d5f6fec7b9 100644 --- a/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx +++ b/plugins/main/public/components/overview/threat-hunting/events/threat-hunting-columns.tsx @@ -22,9 +22,6 @@ export const threatHuntingTableDefaultColumns: tDataGridColumn[] = [ { id: 'rule.mitre.tactic', }, - { - id: 'rule.mitre_technique', - }, { id: 'rule.description', }, @@ -49,9 +46,6 @@ export const threatHuntingTableAgentColumns: EuiDataGridColumn[] = [ { id: 'rule.mitre.tactic', }, - { - id: 'rule.mitre_technique', - }, { id: 'rule.description', }, From f8687221406039dbd4a492586fd4ed577341c7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:09:15 -0300 Subject: [PATCH 08/39] The selected filter is not applied when redirecting to the events tab in the file integrity monitoring module (#6847) * fix the selected filter is not applied when redirecting to the events tab in the file integrity monitoring module * update changelog --- CHANGELOG.md | 2 +- .../agents/fim/inventory/fileDetail.tsx | 66 ++++++++++++------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca31846c9a..135f7f3e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx b/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx index a27cb55bb4..06e373bdd8 100644 --- a/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx +++ b/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx @@ -210,32 +210,15 @@ export class FileDetails extends Component { ]; } - viewInEvents = ev => { + viewInEvents = async ev => { const { file } = this.props.currentFile; - if (this.props.view === 'extern') { - NavigationService.getInstance().navigateToModule(ev, 'overview', { - agentId: this.props?.agent?.id, - tab: 'fim', - tabView: 'events', - filters: { 'syscheck.path': file }, - }); - } else { - NavigationService.getInstance().navigateToModule( - ev, - 'overview', - { - agentId: this.props?.agent?.id, - tab: 'fim', - tabView: 'events', - filters: { 'syscheck.path': file }, - }, - () => this.openEventCurrentWindow(), - ); + const { agent } = this.props; + const agentId = agent?.id; + + if (!this.indexPattern) { + this.indexPattern = await getIndexPattern(); } - }; - openEventCurrentWindow() { - const { file } = this.props.currentFile; const filters = [ { ...buildPhraseFilter( @@ -247,9 +230,42 @@ export class FileDetails extends Component { }, ]; + if (this.props.view === 'extern') { + this.applyFiltersAndNavigate(ev, filters, 'overview', { + agentId, + tab: 'fim', + tabView: 'events', + filters: { 'syscheck.path': file }, + }); + } else { + this.applyFiltersAndNavigate( + ev, + filters, + 'overview', + { agentId, tab: 'fim', tabView: 'events' }, + this.openEventCurrentWindow, + ); + } + }; + + applyFiltersAndNavigate = async (ev, filters, module, params, callback) => { + try { + const { filterManager } = getDataPlugin().query; + filterManager.addFilters(filters); + await NavigationService.getInstance().navigateToModule( + ev, + module, + params, + callback, + ); + } catch (error) { + ErrorHandler.handleError(error); + } + }; + + openEventCurrentWindow = () => { this.props.onSelectedTabChanged('events'); - this.checkFilterManager(filters); - } + }; async checkFilterManager(filters) { try { From 140812dea5fc419bc2ebc9ded22ba48320f5de48 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:19:48 +0200 Subject: [PATCH 09/39] Fix maximized visualizations styles (#6865) * Fix maximized panel styles * Add changelog * Fix styles under 767px --- CHANGELOG.md | 2 +- .../components/common/wazuh-discover/discover.scss | 7 ------- .../cluster/dashboard/cluster_dashboard.scss | 2 +- .../amazon-web-services/dashboards/styles.scss | 2 +- .../components/overview/docker/dashboards/styles.scss | 2 +- .../components/overview/fim/dashboard/styles.scss | 2 +- .../components/overview/gdpr/dashboards/styles.scss | 2 +- .../components/overview/github/dashboards/styles.scss | 2 +- .../overview/google-cloud/dashboards/styles.scss | 2 +- .../components/overview/hipaa/dashboards/styles.scss | 2 +- .../overview/malware-detection/dashboard/styles.scss | 2 +- .../mitre/dashboard/mitre_dashboard_filters.scss | 2 +- .../components/overview/nist/dashboards/styles.scss | 2 +- .../components/overview/office/dashboard/styles.scss | 2 +- .../components/overview/pci/dashboards/styles.scss | 2 +- .../dashboards/statistics_dashboard.scss | 2 +- .../dashboard/threat_hunting_dashboard.scss | 2 +- .../components/overview/tsc/dashboards/styles.scss | 2 +- .../virustotal/dashboard/virustotal_dashboard.scss | 2 +- .../overview/vulnerability_detector_filters.scss | 2 +- plugins/main/public/styles/common.scss | 10 ++++++++-- 21 files changed, 27 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 135f7f3e87..b5d55c346a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/common/wazuh-discover/discover.scss b/plugins/main/public/components/common/wazuh-discover/discover.scss index 1bd68be0bc..f1dbfb1998 100644 --- a/plugins/main/public/components/common/wazuh-discover/discover.scss +++ b/plugins/main/public/components/common/wazuh-discover/discover.scss @@ -16,12 +16,5 @@ .discoverChartContainer { min-height: 234px; - .dshLayout-isMaximizedPanel { - top: 0; - left: 0; - min-height: calc(100vh - 49px); - position: fixed; - z-index: 9999; - } } } diff --git a/plugins/main/public/components/management/cluster/dashboard/cluster_dashboard.scss b/plugins/main/public/components/management/cluster/dashboard/cluster_dashboard.scss index ccb47c4acb..34639f01a3 100644 --- a/plugins/main/public/components/management/cluster/dashboard/cluster_dashboard.scss +++ b/plugins/main/public/components/management/cluster/dashboard/cluster_dashboard.scss @@ -5,7 +5,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/amazon-web-services/dashboards/styles.scss b/plugins/main/public/components/overview/amazon-web-services/dashboards/styles.scss index 18697c1dce..c297a0b12b 100644 --- a/plugins/main/public/components/overview/amazon-web-services/dashboards/styles.scss +++ b/plugins/main/public/components/overview/amazon-web-services/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/docker/dashboards/styles.scss b/plugins/main/public/components/overview/docker/dashboards/styles.scss index f8ee063233..32ac151690 100644 --- a/plugins/main/public/components/overview/docker/dashboards/styles.scss +++ b/plugins/main/public/components/overview/docker/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/fim/dashboard/styles.scss b/plugins/main/public/components/overview/fim/dashboard/styles.scss index 7b072729a2..389626d616 100644 --- a/plugins/main/public/components/overview/fim/dashboard/styles.scss +++ b/plugins/main/public/components/overview/fim/dashboard/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/gdpr/dashboards/styles.scss b/plugins/main/public/components/overview/gdpr/dashboards/styles.scss index a198ad811f..229dd2d9ec 100644 --- a/plugins/main/public/components/overview/gdpr/dashboards/styles.scss +++ b/plugins/main/public/components/overview/gdpr/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/github/dashboards/styles.scss b/plugins/main/public/components/overview/github/dashboards/styles.scss index 4a4bec26ba..3cbf8eb692 100644 --- a/plugins/main/public/components/overview/github/dashboards/styles.scss +++ b/plugins/main/public/components/overview/github/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/google-cloud/dashboards/styles.scss b/plugins/main/public/components/overview/google-cloud/dashboards/styles.scss index 89e050cb20..3041d008ec 100644 --- a/plugins/main/public/components/overview/google-cloud/dashboards/styles.scss +++ b/plugins/main/public/components/overview/google-cloud/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/hipaa/dashboards/styles.scss b/plugins/main/public/components/overview/hipaa/dashboards/styles.scss index 5251debd25..8d5c850990 100644 --- a/plugins/main/public/components/overview/hipaa/dashboards/styles.scss +++ b/plugins/main/public/components/overview/hipaa/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/malware-detection/dashboard/styles.scss b/plugins/main/public/components/overview/malware-detection/dashboard/styles.scss index 961a8c5f4b..b5727f4276 100644 --- a/plugins/main/public/components/overview/malware-detection/dashboard/styles.scss +++ b/plugins/main/public/components/overview/malware-detection/dashboard/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/mitre/dashboard/mitre_dashboard_filters.scss b/plugins/main/public/components/overview/mitre/dashboard/mitre_dashboard_filters.scss index 8d156a0937..791042a695 100644 --- a/plugins/main/public/components/overview/mitre/dashboard/mitre_dashboard_filters.scss +++ b/plugins/main/public/components/overview/mitre/dashboard/mitre_dashboard_filters.scss @@ -14,7 +14,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/nist/dashboards/styles.scss b/plugins/main/public/components/overview/nist/dashboards/styles.scss index 6630bbc35b..5431432b2a 100644 --- a/plugins/main/public/components/overview/nist/dashboards/styles.scss +++ b/plugins/main/public/components/overview/nist/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/office/dashboard/styles.scss b/plugins/main/public/components/overview/office/dashboard/styles.scss index b47665524a..3f235ab0ea 100644 --- a/plugins/main/public/components/overview/office/dashboard/styles.scss +++ b/plugins/main/public/components/overview/office/dashboard/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/pci/dashboards/styles.scss b/plugins/main/public/components/overview/pci/dashboards/styles.scss index a3b1005567..77d26b2671 100644 --- a/plugins/main/public/components/overview/pci/dashboards/styles.scss +++ b/plugins/main/public/components/overview/pci/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/server-management-statistics/dashboards/statistics_dashboard.scss b/plugins/main/public/components/overview/server-management-statistics/dashboards/statistics_dashboard.scss index 1d997a00e4..a1fb779e1f 100644 --- a/plugins/main/public/components/overview/server-management-statistics/dashboards/statistics_dashboard.scss +++ b/plugins/main/public/components/overview/server-management-statistics/dashboards/statistics_dashboard.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/threat-hunting/dashboard/threat_hunting_dashboard.scss b/plugins/main/public/components/overview/threat-hunting/dashboard/threat_hunting_dashboard.scss index a44ea6bd14..8758c9a143 100644 --- a/plugins/main/public/components/overview/threat-hunting/dashboard/threat_hunting_dashboard.scss +++ b/plugins/main/public/components/overview/threat-hunting/dashboard/threat_hunting_dashboard.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/tsc/dashboards/styles.scss b/plugins/main/public/components/overview/tsc/dashboards/styles.scss index 493a31c311..bdf2a000a6 100644 --- a/plugins/main/public/components/overview/tsc/dashboards/styles.scss +++ b/plugins/main/public/components/overview/tsc/dashboards/styles.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/virustotal/dashboard/virustotal_dashboard.scss b/plugins/main/public/components/overview/virustotal/dashboard/virustotal_dashboard.scss index 0802d38593..6e8f3eab43 100644 --- a/plugins/main/public/components/overview/virustotal/dashboard/virustotal_dashboard.scss +++ b/plugins/main/public/components/overview/virustotal/dashboard/virustotal_dashboard.scss @@ -4,7 +4,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/vulnerability_detector_filters.scss b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/vulnerability_detector_filters.scss index 996f0272b2..dc9616a146 100644 --- a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/vulnerability_detector_filters.scss +++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/vulnerability_detector_filters.scss @@ -14,7 +14,7 @@ height: auto !important; } .dshLayout-isMaximizedPanel { - height: 100% !important; + height: calc(100vh - 44px) !important; } } } diff --git a/plugins/main/public/styles/common.scss b/plugins/main/public/styles/common.scss index c2de869880..69f2be672e 100644 --- a/plugins/main/public/styles/common.scss +++ b/plugins/main/public/styles/common.scss @@ -1813,11 +1813,17 @@ iframe.width-changed { /* Workaround to fix maximize embeddable dashboard */ .wz-app .dshLayout-isMaximizedPanel { - top: 0; - left: 0; + height: calc(100vh - 49px) !important; + bottom: 0; + right: 0; + position: fixed !important; z-index: 9999; } +.euiBody--hasFlyout .wz-app .dshLayout-isMaximizedPanel { + width: calc(100% - 320px) !important; +} + .wz-app { .euiPage { background-color: transparent; From 334ea4bb604d014c8fd12efbc2d28e83986241ac Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Fri, 26 Jul 2024 08:48:46 +0200 Subject: [PATCH 10/39] Unification the rendering of flyout columns (#6848) * Fix redirection to agent 000 * Unify rendering of flyout columns * Add changelog * Fix merge commit * Add wz-link component * Change subscribe to useObservable * Implement component * Add documentation * Update changelog * Remove unused imports * Fix typo * improvement function addRenderColumn --- CHANGELOG.md | 5 +- plugins/main/docs/wz-link.md | 50 ++++++ .../common/wazuh-discover/render-columns.tsx | 95 ++++++++---- .../requirement-flyout/requirement-flyout.tsx | 146 +++++++----------- .../flyout-technique-columns.tsx | 71 --------- .../flyout-technique/flyout-technique.tsx | 17 +- .../public/components/wz-link/wz-link.tsx | 50 ++++++ 7 files changed, 239 insertions(+), 195 deletions(-) create mode 100644 plugins/main/docs/wz-link.md create mode 100644 plugins/main/public/components/wz-link/wz-link.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index b5d55c346a..5573e18b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,10 +19,11 @@ All notable changes to the Wazuh app project will be documented in this file. - Added ability to open the report file or Reporting application from the toast message [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) - Added support for agents to Office 365 [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) - Added pinned agent data validation when rendering the Inventory data, Stats and Configuration tabs in Agent preview of Endpoints Summary [#6800](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6800) +- Added wz-link component to make redirections [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) @@ -44,7 +45,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improve margins and paddings in the Events, Inventory and Control tabs [#6708](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6708) - Refactored the search bar to correctly handle fixed and user-added filters [#6716](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6716) [#6755](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6755) [#6833](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6833) - Generate URL with predefined filters [#6745](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6745) -- Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790 +- Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790) - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) diff --git a/plugins/main/docs/wz-link.md b/plugins/main/docs/wz-link.md new file mode 100644 index 0000000000..337a0ae871 --- /dev/null +++ b/plugins/main/docs/wz-link.md @@ -0,0 +1,50 @@ +## Link component + +To make the redirections we have to see if it is in the same application or in another application, depending on that it is necessary to make a type of redirection or another +So this component was created to simplify the implementation and to be able to control everything in one place. + +The component needs as props the `appId` to go to and the `path` to navigate to. The component itself will know in which application it is located in order to display its respective link. + +#### Same application + +In this case we have to navigate with the React Router because the application does not recognise that we are navigating and does not navigate using the Opensearch Dashboard navigation. + +```tsx + { + NavigationService.getInstance().navigate(path); + }} +> + {children} + +``` + +#### Diferent application + +When navigating between applications you can use Opensearch Dashboard navigation and have the path you are going to navigate to when you are over the link. + +```tsx + + + {children} + + +``` + +### Implementation + +```tsx + } + path={} + otherPropsForTheEuiLink + > + whatever you want to render in the link + +``` diff --git a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx index e5ea60f6e8..b4e8f34d07 100644 --- a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx +++ b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx @@ -1,70 +1,76 @@ import React from 'react'; -import { EuiLink } from '@elastic/eui'; +import { EuiText } from '@elastic/eui'; import { tDataGridRenderColumn } from '../data-grid'; -import { getCore } from '../../../kibana-services'; -import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; import { endpointSummary, rules, mitreAttack, } from '../../../utils/applications'; -import NavigationService from '../../../react-services/navigation-service'; +import { WzLink } from '../../wz-link/wz-link'; export const MAX_ENTRIES_PER_QUERY = 10000; +const renderRequirementsSecurityOperations = (value: []) => { + return ( + + {value.join(', ')} + + ); +}; + const renderMitreTechnique = technique => ( - - - {technique} - - + + {technique} + ); export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [ { id: 'agent.id', render: value => { - if (value === '000') return value; + if (value === '000') { + return value; + } return ( - - - {value} - - + + {value} + ); }, }, { id: 'agent.name', render: (value, row) => { - if (row.agent.id === '000') return value; + if (row.agent.id === '000') { + return value; + } return ( - - - {value} - - + + {value} + ); }, }, { id: 'rule.id', render: value => ( - - - {value} - - + + {value} + ), }, { @@ -82,4 +88,25 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
{renderMitreTechnique(value)}
), }, + + { + id: 'rule.pci_dss', + render: renderRequirementsSecurityOperations, + }, + { + id: 'rule.gdpr', + render: renderRequirementsSecurityOperations, + }, + { + id: 'rule.nist_800_53', + render: renderRequirementsSecurityOperations, + }, + { + id: 'rule.hipaa', + render: renderRequirementsSecurityOperations, + }, + { + id: 'rule.tsc', + render: renderRequirementsSecurityOperations, + }, ]; diff --git a/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx b/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx index bdf990efa6..03413cb97b 100644 --- a/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx +++ b/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx @@ -22,11 +22,10 @@ import { EuiText, EuiFlexItem, EuiSpacer, - EuiLink, } from '@elastic/eui'; import { AppState } from '../../../../../react-services/app-state'; import { requirementGoal } from '../../requirement-goal'; -import { getCore, getUiSettings } from '../../../../../kibana-services'; +import { getUiSettings } from '../../../../../kibana-services'; import { FilterManager, IndexPattern, @@ -38,20 +37,7 @@ import { formatUIDate } from '../../../../../react-services'; import TechniqueRowDetails from '../../../mitre/framework/components/techniques/components/flyout-technique/technique-row-details'; import { buildPhraseFilter } from '../../../../../../../../src/plugins/data/common'; import { connect } from 'react-redux'; -import { rules } from '../../../../../utils/applications'; -import { endpointSummary } from '../../../../../utils/applications'; -import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; -import NavigationService from '../../../../../react-services/navigation-service'; - -const renderRequirements = (value: []) => { - return ( - - {value.map(v => { - return {v}; - })} - - ); -}; +import { wzDiscoverRenderColumns } from '../../../../common/wazuh-discover/render-columns'; const mapStateToProps = state => ({ currentAgentData: state.appStateReducers.currentAgentData, @@ -76,80 +62,66 @@ export const RequirementFlyout = connect(mapStateToProps)( this._isMount = true; } + addRenderColumn(columns) { + return columns.map(column => { + const renderColumn = wzDiscoverRenderColumns.find( + columnRender => columnRender.id === column.id, + ); + if (renderColumn) { + return { ...column, render: renderColumn.render }; + } + return column; + }); + } + getDiscoverColumns() { + const columnsAgent = [ + { + id: 'timestamp', + displayAsText: 'Time', + render: value => formatUIDate(value), + }, + { + id: this.props.getRequirementKey(), + displayAsText: 'Requirement(s)', + }, + { id: 'rule.description', displayAsText: 'Description' }, + { id: 'rule.level', displayAsText: 'Level' }, + { + id: 'rule.id', + displayAsText: 'Rule ID', + }, + ]; + + const columnsWithoutAgent = [ + { + id: 'timestamp', + displayAsText: 'Time', + render: value => formatUIDate(value), + }, + { + id: 'agent.id', + displayAsText: 'Agent', + }, + { + id: 'agent.name', + displayAsText: 'Agent name', + }, + { + id: this.props.getRequirementKey(), + displayAsText: 'Requirement', + }, + { id: 'rule.description', displayAsText: 'Description' }, + { id: 'rule.level', displayAsText: 'Level' }, + { + id: 'rule.id', + displayAsText: 'Rule ID', + }, + ]; const agentId = this.props.currentAgentData?.id; return agentId - ? [ - { - id: 'timestamp', - displayAsText: 'Time', - render: value => formatUIDate(value), - }, - { - id: this.props.getRequirementKey(), - displayAsText: 'Requirement(s)', - render: renderRequirements, - }, - { id: 'rule.description', displayAsText: 'Description' }, - { id: 'rule.level', displayAsText: 'Level' }, - { - id: 'rule.id', - displayAsText: 'Rule ID', - render: value => ( - - - {value} - - - ), - }, - ] - : [ - { - id: 'timestamp', - displayAsText: 'Time', - render: value => formatUIDate(value), - }, - { - id: 'agent.id', - displayAsText: 'Agent', - render: value => ( - - - {value} - - - ), - }, - { - id: 'agent.name', - displayAsText: 'Agent name', - }, - { - id: this.props.getRequirementKey(), - displayAsText: 'Requirement', - render: renderRequirements, - }, - { id: 'rule.description', displayAsText: 'Description' }, - { id: 'rule.level', displayAsText: 'Level' }, - { - id: 'rule.id', - displayAsText: 'Rule ID', - render: value => ( - - - {value} - - - ), - }, - ]; + ? this.addRenderColumn(columnsAgent) + : this.addRenderColumn(columnsWithoutAgent); } renderHeader() { diff --git a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique-columns.tsx b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique-columns.tsx index 8931d7a801..ca157c0ce9 100644 --- a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique-columns.tsx +++ b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique-columns.tsx @@ -1,52 +1,6 @@ import React from 'react'; import { formatUIDate } from '../../../../../../../../react-services'; import { tDataGridColumn } from '../../../../../../../common/data-grid'; -import { EuiLink, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { getCore } from '../../../../../../../../kibana-services'; -import { - rules, - endpointSummary, -} from '../../../../../../../../utils/applications'; -import { RedirectAppLinks } from '../../../../../../../../../../../src/plugins/opensearch_dashboards_react/public'; -import NavigationService from '../../../../../../../../react-services/navigation-service'; - -const navigateTo = (ev, section, params) => { - NavigationService.getInstance().navigateToModule(ev, section, params); -}; - -const renderTechniques = (value: []) => { - const techniques = value.map(technique => { - /* - ToDo: - This link redirect to the Intelligence tab and open the flyout technique detail - This must be replaced by the RedirectAppLinks but right now the RedirectAppLinks is not working, - doesn't open the tab and the flyout technique, so we are using the AppNavigate.navigateToModule - */ - return ( - - - navigateTo(e, 'overview', { - tab: 'mitre', - tabView: 'intelligence', - tabRedirect: 'techniques', - idToRedirect: technique, - }) - } - > - {technique} - - - ); - }); - - return ( - - {techniques} - - ); -}; export const techniquesColumns: tDataGridColumn[] = [ { @@ -57,34 +11,17 @@ export const techniquesColumns: tDataGridColumn[] = [ { id: 'agent.id', displayAsText: 'Agent', - render: agentId => ( - - - {agentId} - - - ), }, { id: 'agent.name', displayAsText: 'Agent Name' }, { id: 'rule.mitre.id', displayAsText: 'Technique(s)', - render: value => renderTechniques(value), }, { id: 'rule.mitre.tactic', displayAsText: 'Tactic(s)' }, { id: 'rule.level', displayAsText: 'Level' }, { id: 'rule.id', displayAsText: 'Rule ID', - render: value => ( - - - {value} - - - ), }, { id: 'rule.description', displayAsText: 'Description' }, ]; @@ -98,20 +35,12 @@ export const agentTechniquesColumns: tDataGridColumn[] = [ { id: 'rule.mitre.id', displayAsText: 'Technique(s)', - render: value => renderTechniques(value), }, { id: 'rule.mitre.tactic', displayAsText: 'Tactic(s)' }, { id: 'rule.level', displayAsText: 'Level' }, { id: 'rule.id', displayAsText: 'Rule ID', - render: value => ( - - - {value} - - - ), }, { id: 'rule.description', displayAsText: 'Description' }, ]; diff --git a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx index efba1e3b01..0a7007c8f4 100644 --- a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx +++ b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx @@ -46,6 +46,7 @@ import TechniqueRowDetails from './technique-row-details'; import { buildPhraseFilter } from '../../../../../../../../../../../src/plugins/data/common'; import store from '../../../../../../../../redux/store'; import NavigationService from '../../../../../../../../react-services/navigation-service'; +import { wzDiscoverRenderColumns } from '../../../../../../../common/wazuh-discover/render-columns'; type tFlyoutTechniqueProps = { currentTechnique: string; @@ -229,10 +230,24 @@ export const FlyoutTechnique = (props: tFlyoutTechniqueProps) => { return ; }; + const addRenderColumn = columns => { + return columns.map(column => { + const renderColumn = wzDiscoverRenderColumns.find( + columnRender => columnRender.id === column.id, + ); + if (renderColumn) { + return { ...column, render: renderColumn.render }; + } + return column; + }); + }; + const getDiscoverColumns = () => { // when the agent is pinned const agentId = store.getState().appStateReducers?.currentAgentData?.id; - return agentId ? agentTechniquesColumns : techniquesColumns; + return agentId + ? addRenderColumn(agentTechniquesColumns) + : addRenderColumn(techniquesColumns); }; const renderBody = () => { diff --git a/plugins/main/public/components/wz-link/wz-link.tsx b/plugins/main/public/components/wz-link/wz-link.tsx new file mode 100644 index 0000000000..45415133f9 --- /dev/null +++ b/plugins/main/public/components/wz-link/wz-link.tsx @@ -0,0 +1,50 @@ +import React, { useEffect, useState } from 'react'; +import { RedirectAppLinks } from '../../../../../src/plugins/opensearch_dashboards_react/public'; +import { EuiLink } from '@elastic/eui'; +import { getCore } from '../../kibana-services'; +import NavigationService from '../../react-services/navigation-service'; +import useObservable from 'react-use/lib/useObservable'; + +type tWzLinkProps = { + appId: string; + path: string; + children: React.ReactNode; +}; + +export const WzLink = (props: tWzLinkProps) => { + const { appId, path, children, ...otherProps } = props; + + const [isCurrentApp, setIsCurrentApp] = useState(false); + const currentAppId$ = useObservable( + getCore().application.currentAppId$, + undefined, + ); + + useEffect(() => { + setIsCurrentApp(currentAppId$ === appId); + }, [currentAppId$, appId]); + + const linkDiferentApps = ( + + + {children} + + + ); + const linkSameApp = ( + { + NavigationService.getInstance().navigate(path); + }} + > + {children} + + ); + return isCurrentApp ? linkSameApp : linkDiferentApps; +}; From 6123462f731a5abb88177c848762606484b2da04 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:04:13 +0200 Subject: [PATCH 11/39] Clear session button text is displayed in full (#6871) * remove the width-max of the button * Update changelog --- CHANGELOG.md | 1 + plugins/main/public/directives/wz-logtest/components/logtest.tsx | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5573e18b41..f1112e1bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed cronjob max seconds interval validation [#6730](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6730) - Fixed styles in small height viewports [#6747](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6747) - Fixed behavior in Configuration Assessment when changing API [#6770](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6770) +- Fixed the fixed maximum width of the clear session button in the ruleset test view [#6871](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6871) ### Removed diff --git a/plugins/main/public/directives/wz-logtest/components/logtest.tsx b/plugins/main/public/directives/wz-logtest/components/logtest.tsx index 2767087a32..a540748e26 100644 --- a/plugins/main/public/directives/wz-logtest/components/logtest.tsx +++ b/plugins/main/public/directives/wz-logtest/components/logtest.tsx @@ -267,7 +267,6 @@ export const Logtest = compose(
Date: Fri, 26 Jul 2024 11:12:32 -0300 Subject: [PATCH 12/39] Fix flyout of the inventory tab of the fim module the bottom of the dropdown shows a different grey than the background (#6868) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix flyout of the inventory tab of the fim module the bottom of the dropdown shows a different grey than the background * update changelog * style for inventory tab * fim conditional style * fix flyout en los siguientes modulos file integrity monitoring, mitre y pci dss * delete changes * delete change * delete changes * fix(flyout): add margin between table and flyout border * add flex group * add style details row * remove div --------- Co-authored-by: Antonio David Gutiérrez --- CHANGELOG.md | 2 +- .../agents/fim/inventory/fileDetail.tsx | 20 +++++++-------- .../wazuh-discover/wz-flyout-discover.tsx | 25 ++++++++----------- .../requirement-flyout/requirement-flyout.tsx | 20 +++++++-------- .../flyout-technique/flyout-technique.tsx | 16 ++++++------ 5 files changed, 36 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1112e1bb6..fc1ef45d53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,7 +125,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed the help menu, to be consistent and avoid duplication [#6374](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6374) - Fixed the axis label visual bug from dashboards [#6378](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6378) - Fixed a error pop-up spawn in MITRE ATT&CK [#6431](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6431) -- Fixed minor style issues [#6484](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6484) [#6489](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6489) [#6587](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6587) +- Fixed minor style issues [#6484](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6484) [#6489](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6489) [#6587](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6587) [#6868](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6868) - Fixed "View alerts of this Rule" link [#6553](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6553) - Fixed disconnected agent configuration error [#6587](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6617) diff --git a/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx b/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx index 06e373bdd8..e0fa2ad5c7 100644 --- a/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx +++ b/plugins/main/public/components/agents/fim/inventory/fileDetail.tsx @@ -667,17 +667,15 @@ export class FileDetails extends Component { paddingSize='none' initialIsOpen={true} > -
- - this.renderDiscoverExpandedRow(...args) - } - /> -
+ + this.renderDiscoverExpandedRow(...args) + } + /> ); diff --git a/plugins/main/public/components/common/wazuh-discover/wz-flyout-discover.tsx b/plugins/main/public/components/common/wazuh-discover/wz-flyout-discover.tsx index 0113dcc34f..37fe60c020 100644 --- a/plugins/main/public/components/common/wazuh-discover/wz-flyout-discover.tsx +++ b/plugins/main/public/components/common/wazuh-discover/wz-flyout-discover.tsx @@ -1,6 +1,7 @@ import React, { useState, useMemo, useEffect } from 'react'; import { - EuiPageTemplate, + EuiFlexGroup, + EuiFlexItem, EuiBasicTable, EuiBasicTableProps, EuiButtonIcon, @@ -101,7 +102,6 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => { dataSource, filters, fetchFilters, - fixedFilters, isLoading: isDataSourceLoading, fetchData, setFilters, @@ -264,13 +264,8 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => { return ( - - <> + + {isDataSourceLoading ? ( ) : ( @@ -281,10 +276,10 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => { hideFixedFilters /> )} - {!isDataSourceLoading && results?.hits?.total === 0 ? ( + {!isDataSourceLoading && results?.hits?.total === 0 && ( - ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( + )} + {!isDataSourceLoading && dataSource && results?.hits?.total > 0 && ( <> { onChange={onTableChange} /> - ) : null} - - + )} +
+
); }; diff --git a/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx b/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx index 03413cb97b..cd4a22584e 100644 --- a/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx +++ b/plugins/main/public/components/overview/compliance-table/components/requirement-flyout/requirement-flyout.tsx @@ -300,17 +300,15 @@ export const RequirementFlyout = connect(mapStateToProps)( paddingSize='none' initialIsOpen={true} > -
- - this.renderDiscoverExpandedRow(...args) - } - /> -
+ + this.renderDiscoverExpandedRow(...args) + } + /> ); diff --git a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx index 0a7007c8f4..b0eace1ea7 100644 --- a/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx +++ b/plugins/main/public/components/overview/mitre/framework/components/techniques/components/flyout-technique/flyout-technique.tsx @@ -393,15 +393,13 @@ export const FlyoutTechnique = (props: tFlyoutTechniqueProps) => { paddingSize='none' initialIsOpen={true} > -
- -
+ ); From 1b3b815a8422f214ecd463fc4d589ade060a612e Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:03:21 -0300 Subject: [PATCH 13/39] Add view single document and surrounding documents (#6831) * Add document details header component with links * Apply document header in flyout details * Apply prettier * Update CHANGELOG * Remove unused imports * Change link method --------- Co-authored-by: Luciano Gorza <103193307+lucianogorza@users.noreply.github.com> --- .../common/wazuh-data-grid/wz-data-grid.tsx | 6 ++- .../components/doc-details-header.tsx | 51 +++++++++++++++++++ .../common/wazuh-discover/wz-discover.tsx | 8 +-- .../threat-hunting/dashboard/dashboard.tsx | 9 ++-- 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 plugins/main/public/components/common/wazuh-discover/components/doc-details-header.tsx diff --git a/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx b/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx index 6f01fe5ee9..e5c135e883 100644 --- a/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx +++ b/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx @@ -30,6 +30,7 @@ import { DocumentViewTableAndJson } from '../wazuh-discover/components/document- import DiscoverDataGridAdditionalControls from '../wazuh-discover/components/data-grid-additional-controls'; import './wazuh-data-grid.scss'; import { wzDiscoverRenderColumns } from '../wazuh-discover/render-columns'; +import DocDetailsHeader from '../wazuh-discover/components/doc-details-header'; export const MAX_ENTRIES_PER_QUERY = 10000; @@ -180,7 +181,10 @@ const WazuhDataGrid = (props: tWazuhDataGridProps) => { setInspectedHit(undefined)} size='m'> -

Document Details

+
diff --git a/plugins/main/public/components/common/wazuh-discover/components/doc-details-header.tsx b/plugins/main/public/components/common/wazuh-discover/components/doc-details-header.tsx new file mode 100644 index 0000000000..6e961cfe26 --- /dev/null +++ b/plugins/main/public/components/common/wazuh-discover/components/doc-details-header.tsx @@ -0,0 +1,51 @@ +import React from 'react'; +import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiLink } from '@elastic/eui'; +import { RedirectAppLinks } from '../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { getCore } from '../../../../kibana-services'; +import NavigationService from '../../../../react-services/navigation-service'; + +const DocDetailsHeader = ({ doc, indexPattern }) => { + return ( + + + +

Document Details

+
+
+ + + + + + View surrounding documents + + + + + + + View single document + + + + + +
+ ); +}; + +export default DocDetailsHeader; diff --git a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx index af14c9f6cc..8e5ee43d35 100644 --- a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx +++ b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx @@ -43,6 +43,7 @@ import { import DiscoverDataGridAdditionalControls from './components/data-grid-additional-controls'; import { wzDiscoverRenderColumns } from './render-columns'; import { WzSearchBar } from '../search-bar'; +import DocDetailsHeader from './components/doc-details-header'; export const MAX_ENTRIES_PER_QUERY = 10000; @@ -267,9 +268,10 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => { {inspectedHit && ( setInspectedHit(undefined)} size='m'> - -

Document Details

-
+
diff --git a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx index 2e31c0fc10..f35725346f 100644 --- a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx @@ -55,6 +55,8 @@ import { useReportingCommunicateSearchContext } from '../../../common/hooks/use- import { wzDiscoverRenderColumns } from '../../../common/wazuh-discover/render-columns'; import { WzSearchBar } from '../../../common/search-bar'; +import DocDetailsHeader from '../../../common/wazuh-discover/components/doc-details-header'; + const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; @@ -332,9 +334,10 @@ const DashboardTH: React.FC = () => { {inspectedHit && ( setInspectedHit(undefined)} size='m'> - -

Document details

-
+
From 3f1d8cb4ff126cf5a92a68692cdfa9816edb639f Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:15:02 -0300 Subject: [PATCH 14/39] Add field links in discover document details (#6843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Pass render columns options to doc viewer * Apply render fields * Solve links for custom data grid columns * Update CHANGELOG * Solve agent.name link in flyout * Run prettier --------- Co-authored-by: Chantal Belén kelm <99441266+chantal-kelm@users.noreply.github.com> --- CHANGELOG.md | 2 +- .../common/data-grid/data-grid-service.ts | 75 ++++++++++++++----- .../common/doc-viewer/doc-viewer.tsx | 36 ++++++--- .../common/doc-viewer/use-doc-viewer.ts | 45 +++++------ .../common/wazuh-data-grid/wz-data-grid.tsx | 11 ++- .../document-view-table-and-json.tsx | 12 ++- .../common/wazuh-discover/wz-discover.tsx | 11 ++- .../threat-hunting/dashboard/dashboard.tsx | 9 ++- .../document-view-table-and-json.tsx | 40 ---------- .../dashboards/inventory/inventory.tsx | 11 ++- 10 files changed, 152 insertions(+), 100 deletions(-) delete mode 100644 plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index fc1ef45d53..f3cda8a0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/common/data-grid/data-grid-service.ts b/plugins/main/public/components/common/data-grid/data-grid-service.ts index 71a2f494a5..a82befa0fc 100644 --- a/plugins/main/public/components/common/data-grid/data-grid-service.ts +++ b/plugins/main/public/components/common/data-grid/data-grid-service.ts @@ -7,8 +7,10 @@ export const MAX_ENTRIES_PER_QUERY = 10000; import { EuiDataGridColumn } from '@elastic/eui'; import { tDataGridColumn } from './use-data-grid'; -export const parseData = (resultsHits: SearchResponse['hits']['hits']): any[] => { - const data = resultsHits.map((hit) => { +export const parseData = ( + resultsHits: SearchResponse['hits']['hits'], +): any[] => { + const data = resultsHits.map(hit => { if (!hit) { return {}; } @@ -25,15 +27,20 @@ export const parseData = (resultsHits: SearchResponse['hits']['hits']): any[] => return data; }; -export const getFieldFormatted = (rowIndex, columnId, indexPattern, rowsParsed) => { - const field = indexPattern.fields.find((field) => field.name === columnId); +export const getFieldFormatted = ( + rowIndex, + columnId, + indexPattern, + rowsParsed, +) => { + const field = indexPattern.fields.find(field => field.name === columnId); let fieldValue = null; if (columnId.includes('.')) { // when the column is a nested field. The column could have 2 to n levels // get dinamically the value of the nested field const nestedFields = columnId.split('.'); fieldValue = rowsParsed[rowIndex]; - nestedFields.forEach((field) => { + nestedFields.forEach(field => { if (fieldValue) { fieldValue = fieldValue[field]; } @@ -66,14 +73,25 @@ export const getFieldFormatted = (rowIndex, columnId, indexPattern, rowsParsed) }; // receive search params -export const exportSearchToCSV = async (params: SearchParams): Promise => { +export const exportSearchToCSV = async ( + params: SearchParams, +): Promise => { const DEFAULT_MAX_SIZE_PER_CALL = 1000; - const { indexPattern, filters = [], query, sorting, fields, pagination } = params; + const { + indexPattern, + filters = [], + query, + sorting, + fields, + pagination, + } = params; // when the pageSize is greater than the default max size per call (10000) // then we need to paginate the search const mustPaginateSearch = pagination?.pageSize && pagination?.pageSize > DEFAULT_MAX_SIZE_PER_CALL; - const pageSize = mustPaginateSearch ? DEFAULT_MAX_SIZE_PER_CALL : pagination?.pageSize; + const pageSize = mustPaginateSearch + ? DEFAULT_MAX_SIZE_PER_CALL + : pagination?.pageSize; const totalHits = pagination?.pageSize || DEFAULT_MAX_SIZE_PER_CALL; let pageIndex = params.pagination?.pageIndex || 0; let hitsCount = 0; @@ -104,13 +122,13 @@ export const exportSearchToCSV = async (params: SearchParams): Promise => } const resultsFields = fields; - const data = allHits.map((hit) => { + const data = allHits.map(hit => { // check if the field type is a date const dateFields = indexPattern.fields.getByType('date'); - const dateFieldsNames = dateFields.map((field) => field.name); + const dateFieldsNames = dateFields.map(field => field.name); const flattenHit = indexPattern.flattenHit(hit); // replace the date fields with the formatted date - dateFieldsNames.forEach((field) => { + dateFieldsNames.forEach(field => { if (flattenHit[field]) { flattenHit[field] = beautifyDate(flattenHit[field]); } @@ -125,8 +143,8 @@ export const exportSearchToCSV = async (params: SearchParams): Promise => if (!data || data.length === 0) return; const parsedData = data - .map((row) => { - const parsedRow = resultsFields?.map((field) => { + .map(row => { + const parsedRow = resultsFields?.map(field => { const value = row[field]; if (value === undefined || value === null) { return ''; @@ -153,14 +171,16 @@ export const exportSearchToCSV = async (params: SearchParams): Promise => export const parseColumns = ( fields: IFieldType[], - defaultColumns: tDataGridColumn[] = [] + defaultColumns: tDataGridColumn[] = [], ): EuiDataGridColumn[] => { // remove _source field becuase is a object field and is not supported - fields = fields.filter((field) => field.name !== '_source'); + fields = fields.filter(field => field.name !== '_source'); // merge the properties of the field with the default columns const columns = - fields.map((field) => { - const defaultColumn = defaultColumns.find((column) => column.id === field.name); + fields.map(field => { + const defaultColumn = defaultColumns.find( + column => column.id === field.name, + ); return { ...field, id: field.name, @@ -174,3 +194,24 @@ export const parseColumns = ( }) || []; return columns; }; + +/** + * Merge the defaults columns and the wzDiscoverRenderColumns + * The custom columns renders will override the defaults columns. + * Only consider the fields that have the render method + * @param customColumns + * @param defaultColumns + */ +export const getAllCustomRenders = ( + customColumns: tDataGridColumn[], + discoverColumns: tDataGridColumn[], +): tDataGridColumn[] => { + const customColumnsWithRender = customColumns.filter(column => column.render); + const allColumns = discoverColumns.map(column => { + const customColumn = customColumnsWithRender.find( + customColumn => customColumn.id === column.id, + ); + return customColumn || column; + }); + return allColumns; +}; diff --git a/plugins/main/public/components/common/doc-viewer/doc-viewer.tsx b/plugins/main/public/components/common/doc-viewer/doc-viewer.tsx index 6cd7cb1384..f0249a1eaf 100644 --- a/plugins/main/public/components/common/doc-viewer/doc-viewer.tsx +++ b/plugins/main/public/components/common/doc-viewer/doc-viewer.tsx @@ -11,8 +11,10 @@ const DOT_PREFIX_RE = /(.).+?\./g; export type tDocViewerProps = { flattened: any; formatted: any; + renderFields: () => {}; mapping: any; indexPattern: any; + docJSON: any; }; /** @@ -80,7 +82,8 @@ const DocViewer = (props: tDocViewerProps) => { const [fieldRowOpen, setFieldRowOpen] = useState( {} as Record, ); - const { flattened, formatted, mapping, indexPattern } = props; + const { flattened, formatted, mapping, indexPattern, renderFields, docJSON } = + props; return ( <> @@ -144,17 +147,26 @@ const DocViewer = (props: tDocViewerProps) => { -
+ {renderFields && + renderFields?.find( + (field: string) => field?.id === displayName, + ) ? ( + renderFields + ?.find((field: string) => field.id === displayName) + .render(flattened[displayName], docJSON) + ) : ( +
+ )} ); diff --git a/plugins/main/public/components/common/doc-viewer/use-doc-viewer.ts b/plugins/main/public/components/common/doc-viewer/use-doc-viewer.ts index 61a0b3af2d..7f60b9338a 100644 --- a/plugins/main/public/components/common/doc-viewer/use-doc-viewer.ts +++ b/plugins/main/public/components/common/doc-viewer/use-doc-viewer.ts @@ -1,28 +1,29 @@ -import { tDocViewerProps } from "./doc-viewer" -import { IndexPattern } from "../../../../../../src/plugins/data/common"; +import { tDocViewerProps } from './doc-viewer'; +import { IndexPattern } from '../../../../../../src/plugins/data/common'; type tUseDocViewerInputs = { - indexPattern: IndexPattern; - doc: any; -} + indexPattern: IndexPattern; + doc: any; +}; export const useDocViewer = (props: tUseDocViewerInputs): tDocViewerProps => { - const { indexPattern, doc } = props; + const { indexPattern, doc } = props; - if (!indexPattern || !doc) { - return { - flattened: {}, - formatted: {}, - indexPattern: undefined, - mapping: undefined - } - } - - const mapping = indexPattern?.fields.getByName; + if (!indexPattern || !doc) { return { - flattened: indexPattern?.flattenHit(doc), - formatted: indexPattern?.formatHit(doc, 'html'), - indexPattern, - mapping - } -} \ No newline at end of file + flattened: {}, + formatted: {}, + indexPattern: undefined, + mapping: undefined, + }; + } + + const mapping = indexPattern?.fields.getByName; + return { + flattened: indexPattern?.flattenHit(doc), + formatted: indexPattern?.formatHit(doc, 'html'), + indexPattern, + mapping, + docJSON: doc._source, + }; +}; diff --git a/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx b/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx index e5c135e883..f422889e97 100644 --- a/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx +++ b/plugins/main/public/components/common/wazuh-data-grid/wz-data-grid.tsx @@ -12,7 +12,12 @@ import { EuiFlyoutBody, EuiFlexGroup, } from '@elastic/eui'; -import { useDataGrid, exportSearchToCSV, tDataGridColumn } from '../data-grid'; +import { + useDataGrid, + exportSearchToCSV, + tDataGridColumn, + getAllCustomRenders, +} from '../data-grid'; import { getWazuhCorePlugin } from '../../../kibana-services'; import { IndexPattern, @@ -193,6 +198,10 @@ const WazuhDataGrid = (props: tWazuhDataGridProps) => { diff --git a/plugins/main/public/components/common/wazuh-discover/components/document-view-table-and-json.tsx b/plugins/main/public/components/common/wazuh-discover/components/document-view-table-and-json.tsx index 7e2f34d1e1..2592e340b9 100644 --- a/plugins/main/public/components/common/wazuh-discover/components/document-view-table-and-json.tsx +++ b/plugins/main/public/components/common/wazuh-discover/components/document-view-table-and-json.tsx @@ -1,10 +1,14 @@ import React from 'react'; import { EuiFlexItem, EuiCodeBlock, EuiTabbedContent } from '@elastic/eui'; import { IndexPattern } from '../../../../../../../../src/plugins/data/common'; -import DocViewer from '../../doc-viewer/doc-viewer' +import DocViewer from '../../doc-viewer/doc-viewer'; import { useDocViewer } from '../../doc-viewer'; -export const DocumentViewTableAndJson = ({ document, indexPattern }) => { +export const DocumentViewTableAndJson = ({ + document, + indexPattern, + renderFields, +}) => { const docViewerProps = useDocViewer({ doc: document, indexPattern: indexPattern as IndexPattern, @@ -17,7 +21,9 @@ export const DocumentViewTableAndJson = ({ document, indexPattern }) => { { id: 'table', name: 'Table', - content: , + content: ( + + ), }, { id: 'json', diff --git a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx index 8e5ee43d35..1b606680da 100644 --- a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx +++ b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx @@ -18,7 +18,12 @@ import { IndexPattern } from '../../../../../../src/plugins/data/common'; import { SearchResponse } from '../../../../../../src/core/server'; import { DiscoverNoResults } from '../no-results/no-results'; import { LoadingSpinner } from '../loading-spinner/loading-spinner'; -import { useDataGrid, tDataGridColumn, exportSearchToCSV } from '../data-grid'; +import { + useDataGrid, + tDataGridColumn, + exportSearchToCSV, + getAllCustomRenders, +} from '../data-grid'; import { DocumentViewTableAndJson } from './components/document-view-table-and-json'; import { ErrorHandler, @@ -279,6 +284,10 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => { diff --git a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx index f35725346f..7ba7570193 100644 --- a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx @@ -28,6 +28,7 @@ import { import { MAX_ENTRIES_PER_QUERY, exportSearchToCSV, + getAllCustomRenders, } from '../../../common/data-grid/data-grid-service'; import { useDocViewer } from '../../../common/doc-viewer/use-doc-viewer'; import { useDataGrid } from '../../../common/data-grid/use-data-grid'; @@ -342,7 +343,13 @@ const DashboardTH: React.FC = () => { - + diff --git a/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx b/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx deleted file mode 100644 index c82e73eef8..0000000000 --- a/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import { EuiFlexItem, EuiCodeBlock, EuiTabbedContent } from '@elastic/eui'; -import { IndexPattern } from '../../../../../../../../src/plugins/data/common'; -import DocViewer from '../../../../common/doc-viewer/doc-viewer'; -import { useDocViewer } from '../../../../common/doc-viewer'; - -export const DocumentViewTableAndJson = ({ document, indexPattern }) => { - const docViewerProps = useDocViewer({ - doc: document, - indexPattern: indexPattern as IndexPattern, - }); - - return ( - - , - }, - { - id: 'json', - name: 'JSON', - content: ( - - {JSON.stringify(document, null, 2)} - - ), - }, - ]} - /> - - ); -}; diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx index 028897d876..3b75c4a954 100644 --- a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx @@ -25,7 +25,10 @@ import { } from '../../../../../react-services/error-management'; import './inventory.scss'; import { inventoryTableDefaultColumns } from './config'; -import { MAX_ENTRIES_PER_QUERY } from '../../../../common/data-grid/data-grid-service'; +import { + MAX_ENTRIES_PER_QUERY, + getAllCustomRenders, +} from '../../../../common/data-grid/data-grid-service'; import { DiscoverNoResults } from '../../common/components/no_results'; import { LoadingSpinner } from '../../common/components/loading_spinner'; // common components/hooks @@ -45,8 +48,8 @@ import { } from '../../../../common/data-source'; import { useDataSource } from '../../../../common/data-source/hooks'; import { IndexPattern } from '../../../../../../../../src/plugins/data/public'; -import { DocumentViewTableAndJson } from '../../common/components/document-view-table-and-json'; import { wzDiscoverRenderColumns } from '../../../../common/wazuh-discover/render-columns'; +import { DocumentViewTableAndJson } from '../../../../common/wazuh-discover/components/document-view-table-and-json'; import { WzSearchBar } from '../../../../common/search-bar'; const InventoryVulsComponent = () => { @@ -261,6 +264,10 @@ const InventoryVulsComponent = () => { From b4df0b3df07064aec278ec285789ce599ef3f010 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:42:59 +0200 Subject: [PATCH 15/39] Fixes report generation when have a pinned agent (#6873) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add conditional type of meta filter * Add changelog * fix(agent-inventory): reports PDF data source missing cluster/manager filter --------- Co-authored-by: Antonio David Gutiérrez --- CHANGELOG.md | 2 +- .../pattern-data-source-filter-manager.ts | 2 +- .../components/common/modules/main-agent.tsx | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3cda8a0d9..54f203a7cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Refactored the search bar to correctly handle fixed and user-added filters [#6716](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6716) [#6755](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6755) [#6833](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6833) - Generate URL with predefined filters [#6745](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6745) - Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790) -- Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) +- Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) ### Fixed diff --git a/plugins/main/public/components/common/data-source/pattern/pattern-data-source-filter-manager.ts b/plugins/main/public/components/common/data-source/pattern/pattern-data-source-filter-manager.ts index d1587939fe..90e13ac255 100644 --- a/plugins/main/public/components/common/data-source/pattern/pattern-data-source-filter-manager.ts +++ b/plugins/main/public/components/common/data-source/pattern/pattern-data-source-filter-manager.ts @@ -537,7 +537,7 @@ export class PatternDataSourceFilterManager value: Array.isArray(value) ? value.join(', ') : value, params: value, negate, - type: 'phrases', + type: Array.isArray(value) ? 'phrases' : 'phrase', index: indexPatternId, controlledBy, }, diff --git a/plugins/main/public/components/common/modules/main-agent.tsx b/plugins/main/public/components/common/modules/main-agent.tsx index 6255d974bd..b7d477038f 100644 --- a/plugins/main/public/components/common/modules/main-agent.tsx +++ b/plugins/main/public/components/common/modules/main-agent.tsx @@ -32,6 +32,7 @@ import { AlertsDataSource, AlertsDataSourceRepository, PatternDataSource, + tFilter, tParsedIndexPattern, useDataSource, } from '../data-source'; @@ -224,6 +225,19 @@ export default compose( }), )(MainModuleAgent); +export class AgentInventoryDataSource extends AlertsDataSource { + constructor(id: string, title: string) { + super(id, title); + } + + getFixedFilters(): tFilter[] { + return [ + ...super.getFixedFiltersClusterManager(), + ...super.getFixedFilters(), + ]; + } +} + const GenerateSyscollectorReportButton = ({ agent }) => { const { dataSource, @@ -231,7 +245,7 @@ const GenerateSyscollectorReportButton = ({ agent }) => { isLoading: isDataSourceLoading, } = useDataSource({ repository: new AlertsDataSourceRepository(), // this makes only works with alerts index pattern - DataSource: AlertsDataSource, + DataSource: AgentInventoryDataSource, }); const action = useAsyncAction(async () => { From da9d55f777adcf302e11c1765962d208cf6a9c2c Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:43:18 +0200 Subject: [PATCH 16/39] Checking the internal tab when changing agent on FIM > Inventory > Windows registry (#6880) * Fix(Inventory): Checking the internal tab when changing agent * Changelog: Update changelog --- CHANGELOG.md | 1 + .../components/agents/fim/inventory.tsx | 192 +++++++++++------- 2 files changed, 120 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f203a7cf..db3dc774ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed styles in small height viewports [#6747](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6747) - Fixed behavior in Configuration Assessment when changing API [#6770](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6770) - Fixed the fixed maximum width of the clear session button in the ruleset test view [#6871](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6871) +- Fixed redirection to FIM > Inventory > Files from FIM > Inventory > Windows Registry when switching to non-Windows agent. [#6880](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6880) ### Removed diff --git a/plugins/main/public/components/agents/fim/inventory.tsx b/plugins/main/public/components/agents/fim/inventory.tsx index e6bdf38716..fbb5d41b22 100644 --- a/plugins/main/public/components/agents/fim/inventory.tsx +++ b/plugins/main/public/components/agents/fim/inventory.tsx @@ -23,7 +23,6 @@ import { EuiSpacer, EuiTab, EuiTabs, - EuiTitle, } from '@elastic/eui'; import { InventoryTable, RegistryTable } from './inventory/'; import { WzRequest } from '../../../react-services/wz-request'; @@ -65,8 +64,8 @@ export class Inventory extends Component { totalItemsRegistry: 0, isLoading: true, customBadges: [], - isConfigured: false - } + isConfigured: false, + }; this.onFiltersChange.bind(this); } @@ -76,8 +75,15 @@ export class Inventory extends Component { } componentDidUpdate(prevProps) { - if (JSON.stringify(this.props.agent) !== JSON.stringify(prevProps.agent)){ - this.setState({isLoading: true}, this.loadAgent) + if (JSON.stringify(this.props.agent) !== JSON.stringify(prevProps.agent)) { + if (this.props?.agent?.os?.platform !== 'windows') { + this.setState( + { isLoading: true, selectedTabId: 'files' }, + this.loadAgent, + ); + return; + } + this.setState({ isLoading: true }, this.loadAgent); } } @@ -86,73 +92,90 @@ export class Inventory extends Component { } async loadAgent() { - const agentPlatform = ((this.props.agent || {}).os || {}).platform; - const {totalItemsFile, syscheck} = await this.getItemNumber('file'); - const totalItemsRegistry = agentPlatform === 'windows' ? await this.getItemNumber('registry') : 0; + const agentPlatform = this.props.agent?.os?.platform; + const { totalItemsFile, syscheck } = await this.getItemNumber('file'); + const totalItemsRegistry = + agentPlatform === 'windows' ? await this.getItemNumber('registry') : 0; const isConfigured = await this.isConfigured(); - if (this._isMount){ - this.setState({ totalItemsFile, totalItemsRegistry, syscheck, isLoading: false, isConfigured }); + if (this._isMount) { + this.setState({ + totalItemsFile, + totalItemsRegistry, + syscheck, + isLoading: false, + isConfigured, + }); } } - // Do not load the localStorage filters when changing tabs - // componentDidUpdate(prevProps, prevState) { - // const { selectedTabId } = this.state; - // if (selectedTabId !== prevState.selectedTabId) { - // const filters = this.getStoreFilters(this.props); - // this.setState({ filters }); - // } - // } - tabs() { - let auxTabs = [ + const auxTabs = [ { id: 'files', - name: `Files ${this.state.isLoading === true ? '' : '(' + this.state.totalItemsFile + ')'}`, - disabled: false, - }, - ] - const platform = (this.props.agent.os || {}).platform || "other"; - platform === 'windows' ? auxTabs.push( - { - id: 'registry', - name: `Windows Registry ${this.state.isLoading === true ? '' : '(' + this.state.totalItemsRegistry + ')'}`, + name: `Files ${ + this.state.isLoading === true + ? '' + : '(' + this.state.totalItemsFile + ')' + }`, disabled: false, }, - ) : null; - return (auxTabs); + ]; + const registryTab = { + id: 'registry', + name: `Windows Registry ${ + this.state.isLoading === true + ? '' + : '(' + this.state.totalItemsRegistry + ')' + }`, + disabled: false, + }; + + const platform = this.props.agent.os?.platform || 'other'; + platform === 'windows' ? auxTabs.push(registryTab) : null; + return auxTabs; } getStoreFilters(props) { const { section, selectView, agent } = props; - const filters = JSON.parse(window.localStorage.getItem(`wazuh-${section}-${selectView}-${((this.state || {}).selectedTabId || 'files')}-${agent['id']}`) || '{}'); + const filters = JSON.parse( + window.localStorage.getItem( + `wazuh-${section}-${selectView}-${ + this.state?.selectedTabId || 'files' + }-${agent['id']}`, + ) || '{}', + ); return filters; } setStoreFilters(filters) { const { section, selectView, agent } = this.props; - window.localStorage.setItem(`wazuh-${section}-${selectView}-${(this.state || {}).selectedTabId || 'files'}-${agent['id']}`, JSON.stringify(filters)) + window.localStorage.setItem( + `wazuh-${section}-${selectView}-${this.state?.selectedTabId || 'files'}-${ + agent['id'] + }`, + JSON.stringify(filters), + ); } - onFiltersChange = (filters) => { + onFiltersChange = filters => { this.setState({ filters }); - } + }; onTotalItemsChange = (totalItems: number) => { this.setState({ totalItemsFile: totalItems }); - } + }; onSelectedTabChanged = id => { this.setState({ selectedTabId: id }); - } + }; buildFilter(type) { const filters = filtersToObject(this.state.filters); const filter = { ...filters, limit: type === 'file' ? '15' : '1', - ...(type === 'registry' ? {q: 'type=registry_key'} : {type}), - ...(type === 'file' && {sort: '+file'}) + ...(type === 'registry' ? { q: 'type=registry_key' } : { type }), + ...(type === 'file' && { sort: '+file' }), }; return filter; } @@ -165,11 +188,11 @@ export class Inventory extends Component { }); if (type === 'file') { return { - totalItemsFile: ((response.data || {}).data || {}).total_affected_items || 0, - syscheck: ((response.data || {}).data || {}).affected_items || [], + totalItemsFile: response.data?.data?.total_affected_items || 0, + syscheck: response.data?.data?.affected_items || [], }; } - return ((response.data || {}).data || {}).total_affected_items || 0; + return response.data?.data?.total_affected_items || 0; } catch (error) { this.setState({ isLoading: false }); @@ -198,13 +221,15 @@ export class Inventory extends Component { onClick={() => this.onSelectedTabChanged(tab.id)} isSelected={tab.id === this.state.selectedTabId} disabled={tab.disabled} - key={index}> - {tab.name} {isLoading === true && } + key={index} + > + {tab.name}  + {isLoading === true && } ))} ); - }; + } return null; } @@ -217,25 +242,33 @@ export class Inventory extends Component { }; renderTable() { - const { filters, syscheck, selectedTabId, customBadges, totalItemsRegistry, totalItemsFile } = this.state; + const { + filters, + syscheck, + selectedTabId, + totalItemsRegistry, + totalItemsFile, + } = this.state; return ( <> - {selectedTabId === 'files' && + {selectedTabId === 'files' && ( - } - {selectedTabId === 'registry' && + onTotalItemsChange={this.onTotalItemsChange} + /> + )} + {selectedTabId === 'registry' && ( - } + onFiltersChange={this.onFiltersChange} + /> + )} ); } @@ -243,30 +276,35 @@ export class Inventory extends Component { noConfiguredMonitoring() { return ( Integrity monitoring is not configured for this agent} body={ How to configure the module } - />); + /> + ); } loadingInventory() { - return - - - - - - ; + return ( + + + + + + + + ); } async isConfigured() { @@ -274,10 +312,10 @@ export class Inventory extends Component { const response = await WzRequest.apiReq( 'GET', `/agents/${this.props.agent.id}/config/syscheck/syscheck`, - {} + {}, ); - return (((response.data || {}).data).syscheck || {}).disabled === 'no'; + return response.data?.data?.syscheck?.disabled === 'no'; } catch (error) { const options: UIErrorLog = { context: `${Inventory.name}.isConfigured`, @@ -297,19 +335,27 @@ export class Inventory extends Component { render() { const { isLoading, isConfigured } = this.state; if (isLoading) { - return this.loadingInventory() + return this.loadingInventory(); } const table = this.renderTable(); const tabs = this.renderTabs(); - return isConfigured - ? ( + return isConfigured ? ( + {tabs} - + {table} - ) - : this.noConfiguredMonitoring() + + ) : ( + this.noConfiguredMonitoring() + ); } } From 309520045ec995949628e270745102499621e4d3 Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:30:53 +0200 Subject: [PATCH 17/39] Add missing entries on the changelog related to logging system replacement (#6875) * changelog: add entries related to the replacement of logging system * changelog: typo --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db3dc774ac..030de56af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790) - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) +- Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) ### Fixed @@ -71,6 +72,11 @@ All notable changes to the Wazuh app project will be documented in this file. - Removed legacy discover references and methods [#6646](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6646) - Removed custom EuiSuggestItem component in favor of OUI's native component [#6714](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6714) - Removed API endpoint unused endpoints from creation of old visualisations: GET /elastic/visualizations/{tab}/{pattern} and GET /elastic/visualizations/{tab}/{pattern} [#6782](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6782) +- Removed `logs.level` setting [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Removed the usage of `wazuhapp-plain.log`, `wazuhapp.log`, `wazuh-ui-plain.log` and `wazuh-ui.log` files [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Removed the `App logs` application [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Removed API endpoint GET /utils/logs/ui [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Removed API endpoint GET /utils/logs [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) ## Wazuh v4.8.1 - OpenSearch Dashboards 2.10.0 - Revision 04 From bfdd8419afc060d3bdfc425cf8f3000aae1ff6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Wed, 31 Jul 2024 04:15:08 -0300 Subject: [PATCH 18/39] The dashboard of the mitre module is the same with or without a pinned agent (#6878) * fix the dashboard of the mitre module is the same with or without a pinned agent * delete specification --- .github/workflows/prettier.yml | 2 +- CHANGELOG.md | 2 +- .../fim/dashboard/dashboard-panels.ts | 2 +- .../github/dashboards/dashboard-panels.ts | 2 +- ...ashboard_panels.ts => dashboard-panels.ts} | 433 +++++++++++++++++- .../overview/mitre/dashboard/dashboard.tsx | 2 +- 6 files changed, 417 insertions(+), 26 deletions(-) rename plugins/main/public/components/overview/mitre/dashboard/{dashboard_panels.ts => dashboard-panels.ts} (64%) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 9c1748cd4b..23de4aa1e6 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -30,7 +30,7 @@ jobs: echo "Listing branches" git branch -a echo "Getting diff files ignoring deleted and getting the changed or renamed files" - CHANGED_FILES=$(git diff --name-status --diff-filter d ${REMOTE_NAME}/${GITHUB_BASE_REF}..${REMOTE_NAME}/${GITHUB_HEAD_REF} | awk '{print $2}') + CHANGED_FILES=$(git diff --name-status --diff-filter d ${REMOTE_NAME}/${GITHUB_BASE_REF}..${REMOTE_NAME}/${GITHUB_HEAD_REF} | awk '{print $NF}') echo "Changed files:" echo "${CHANGED_FILES}" git checkout $GITHUB_HEAD_REF diff --git a/CHANGELOG.md b/CHANGELOG.md index 030de56af7..cd38a0a675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/overview/fim/dashboard/dashboard-panels.ts b/plugins/main/public/components/overview/fim/dashboard/dashboard-panels.ts index 590af31489..8bcd983b0f 100644 --- a/plugins/main/public/components/overview/fim/dashboard/dashboard-panels.ts +++ b/plugins/main/public/components/overview/fim/dashboard/dashboard-panels.ts @@ -344,7 +344,7 @@ const getVisStateFIMCommonActions = (indexPatternId: string) => { addTooltip: true, addLegend: true, legendPosition: 'right', - isDonut: false, + isDonut: true, labels: { show: false, values: true, diff --git a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts index d1d8f5fd0b..1eb52f1b8a 100644 --- a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts @@ -160,7 +160,7 @@ const getVisStateTopOrganizationsByAlertCount = (indexPatternId: string) => { addTooltip: true, addLegend: true, legendPosition: 'right', - isDonut: false, + isDonut: true, labels: { show: false, values: true, diff --git a/plugins/main/public/components/overview/mitre/dashboard/dashboard_panels.ts b/plugins/main/public/components/overview/mitre/dashboard/dashboard-panels.ts similarity index 64% rename from plugins/main/public/components/overview/mitre/dashboard/dashboard_panels.ts rename to plugins/main/public/components/overview/mitre/dashboard/dashboard-panels.ts index 033d59e532..cc0f251ebf 100644 --- a/plugins/main/public/components/overview/mitre/dashboard/dashboard_panels.ts +++ b/plugins/main/public/components/overview/mitre/dashboard/dashboard-panels.ts @@ -4,7 +4,7 @@ import { EmbeddableInput } from '../../../../../../../../src/plugins/embeddable/ const getVisStateAlertsEvolution = (indexPatternId: string) => { return { id: 'Wazuh-App-Overview-MITRE-Alerts-Evolution', - title: 'Mitre alerts evolution', + title: 'Alerts evolution over time', type: 'line', params: { type: 'line', @@ -552,7 +552,7 @@ const getVisStateTopTacticsByAgent = (indexPatternId: string) => { const getVisStateTechniqueByAgent = (indexPatternId: string) => { return { id: 'Wazuh-App-Overview-MITRE-Attacks-By-Agent', - title: 'Attack by agent', + title: 'Mitre techniques by agent', type: 'pie', params: { type: 'pie', @@ -636,6 +636,398 @@ const getVisStateTechniqueByAgent = (indexPatternId: string) => { }; }; +const getVisStateAlertsLevelByAttack = indexPatternId => { + return { + id: 'Wazuh-App-Agents-MITRE-Level-By-Attack', + title: 'Rule level by attack', + type: 'pie', + params: { + type: 'pie', + addTooltip: true, + addLegend: true, + legendPosition: 'right', + isDonut: true, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, + dimensions: { + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + buckets: [ + { + accessor: 0, + format: { + id: 'terms', + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + { + accessor: 2, + format: { + id: 'terms', + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + { + accessor: 4, + format: { + id: 'terms', + params: { + id: 'number', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + ], + }, + }, + data: { + searchSource: { + query: { + language: 'lucene', + query: '', + }, + filter: [], + index: indexPatternId, + }, + references: [ + { + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + type: 'index-pattern', + id: indexPatternId, + }, + ], + aggs: [ + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, + { + id: '3', + enabled: true, + type: 'terms', + schema: 'segment', + params: { + field: 'rule.mitre.technique', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + customLabel: 'Attack ID', + }, + }, + { + id: '4', + enabled: true, + type: 'terms', + schema: 'segment', + params: { + field: 'rule.level', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + customLabel: 'Rule level', + }, + }, + ], + }, + }; +}; + +const getVisStateMitreAttacksByTactic = indexPatternId => { + return { + id: 'Wazuh-App-Agents-MITRE-Attacks-By-Tactic', + title: 'MITRE attacks by tactic', + type: 'histogram', + params: { + type: 'histogram', + grid: { categoryLines: false }, + categoryAxes: [ + { + id: 'CategoryAxis-1', + type: 'category', + position: 'bottom', + show: true, + style: {}, + scale: { type: 'linear' }, + labels: { show: true, filter: true, truncate: 100 }, + title: {}, + }, + ], + valueAxes: [ + { + id: 'ValueAxis-1', + name: 'LeftAxis-1', + type: 'value', + position: 'left', + show: true, + style: {}, + scale: { type: 'linear', mode: 'normal' }, + labels: { show: true, rotate: 0, filter: false, truncate: 100 }, + title: { text: 'Count' }, + }, + ], + seriesParams: [ + { + show: 'true', + type: 'histogram', + mode: 'stacked', + data: { label: 'Count', id: '1' }, + valueAxis: 'ValueAxis-1', + drawLinesBetweenPoints: true, + showCircles: true, + }, + ], + addTooltip: true, + addLegend: true, + legendPosition: 'right', + times: [], + addTimeMarker: false, + labels: { show: false }, + thresholdLine: { + show: false, + value: 10, + width: 1, + style: 'full', + color: '#34130C', + }, + dimensions: { + x: null, + y: [ + { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + ], + series: [ + { + accessor: 0, + format: { + id: 'terms', + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + ], + }, + }, + data: { + searchSource: { + query: { + language: 'lucene', + query: '', + }, + filter: [], + index: indexPatternId, + }, + references: [ + { + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + type: 'index-pattern', + id: indexPatternId, + }, + ], + aggs: [ + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, + { + id: '2', + enabled: true, + type: 'terms', + schema: 'group', + params: { + field: 'rule.mitre.technique', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + }, + }, + { + id: '3', + enabled: true, + type: 'terms', + schema: 'segment', + params: { + field: 'rule.mitre.tactic', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + }, + }, + ], + }, + }; +}; + +const getVisStateAlertsLevelByTactic = indexPatternId => { + return { + id: 'Wazuh-App-Agents-MITRE-Level-By-Tactic', + title: 'Rule level by tactic', + type: 'pie', + params: { + type: 'pie', + addTooltip: true, + addLegend: true, + legendPosition: 'right', + isDonut: true, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, + dimensions: { + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + buckets: [ + { + accessor: 0, + format: { + id: 'terms', + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + { + accessor: 2, + format: { + id: 'terms', + params: { + id: 'number', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, + }, + params: {}, + aggType: 'terms', + }, + ], + }, + }, + data: { + searchSource: { + query: { + language: 'lucene', + query: '', + }, + filter: [], + index: indexPatternId, + }, + references: [ + { + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + type: 'index-pattern', + id: indexPatternId, + }, + ], + aggs: [ + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, + { + id: '3', + enabled: true, + type: 'terms', + schema: 'segment', + params: { + field: 'rule.mitre.tactic', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + customLabel: 'Attack ID', + }, + }, + { + id: '4', + enabled: true, + type: 'terms', + schema: 'segment', + params: { + field: 'rule.level', + orderBy: '1', + order: 'desc', + size: 5, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + customLabel: 'Rule level', + }, + }, + ], + }, + }; +}; + export const getDashboardPanels = ( indexPatternId: string, pinnedAgent?: boolean, @@ -644,7 +1036,6 @@ export const getDashboardPanels = ( EmbeddableInput & { [k: string]: unknown } >; } => { - //There is currently no difference between the panels that are rendered with or without an agent, but in light of future changes, it has been decided to keep this structure. const pinnedAgentPanels = { '1': { gridData: { @@ -685,7 +1076,7 @@ export const getDashboardPanels = ( type: 'visualization', explicitInput: { id: '3', - savedVis: getVisStateAttacksByTechnique(indexPatternId), + savedVis: getVisStateAlertsLevelByAttack(indexPatternId), }, }, '4': { @@ -699,7 +1090,7 @@ export const getDashboardPanels = ( type: 'visualization', explicitInput: { id: '4', - savedVis: getVisStateTopTacticsByAgent(indexPatternId), + savedVis: getVisStateMitreAttacksByTactic(indexPatternId), }, }, '5': { @@ -713,78 +1104,78 @@ export const getDashboardPanels = ( type: 'visualization', explicitInput: { id: '5', - savedVis: getVisStateTechniqueByAgent(indexPatternId), + savedVis: getVisStateAlertsLevelByTactic(indexPatternId), }, }, }; const panels = { - '1': { + '6': { gridData: { w: 36, h: 12, x: 0, y: 0, - i: '1', + i: '6', }, type: 'visualization', explicitInput: { - id: '1', + id: '6', savedVis: getVisStateAlertsEvolution(indexPatternId), }, }, - '2': { + '7': { gridData: { w: 12, h: 12, x: 36, y: 0, - i: '2', + i: '7', }, type: 'visualization', explicitInput: { - id: '2', + id: '7', savedVis: getVisStateTopTactics(indexPatternId), }, }, - '3': { + '8': { gridData: { w: 16, h: 12, x: 0, y: 12, - i: '3', + i: '8', }, type: 'visualization', explicitInput: { - id: '3', + id: '8', savedVis: getVisStateAttacksByTechnique(indexPatternId), }, }, - '4': { + '9': { gridData: { w: 16, h: 12, x: 16, y: 12, - i: '4', + i: '9', }, type: 'visualization', explicitInput: { - id: '4', + id: '9', savedVis: getVisStateTopTacticsByAgent(indexPatternId), }, }, - '5': { + '10': { gridData: { w: 16, h: 12, x: 32, y: 12, - i: '5', + i: '10', }, type: 'visualization', explicitInput: { - id: '5', + id: '10', savedVis: getVisStateTechniqueByAgent(indexPatternId), }, }, diff --git a/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx b/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx index da5cfb265e..c43919ceab 100644 --- a/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import { getPlugins } from '../../../../kibana-services'; import { ViewMode } from '../../../../../../../src/plugins/embeddable/public'; -import { getDashboardPanels } from './dashboard_panels'; +import { getDashboardPanels } from './dashboard-panels'; import { I18nProvider } from '@osd/i18n/react'; import useSearchBar from '../../../common/search-bar/use-search-bar'; import { SampleDataWarning } from '../../../visualize/components'; From 85ca71e6cec88216afb1ac90720d14a36098aa32 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Wed, 31 Jul 2024 09:24:58 +0200 Subject: [PATCH 19/39] Leave the date of last modification on a single line on the FIM > Inventory > Windows Registry (#6876) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update imposter * Change width * Add white-space nowrap * feat(workflow): fix prettier workflow when renaming files * Add changelog * feat(mock-server): enhance FIM data --------- Co-authored-by: Antonio David Gutiérrez --- CHANGELOG.md | 1 + docker/imposter/agents/agent.json | 40 ----- .../agent-active-groups.json} | 0 .../agent-disconnected.json} | 0 .../agent-macos.json} | 4 +- .../agent-manager.json} | 0 .../agent-never-connected.json} | 0 .../agent-pending.json} | 0 .../imposter/agents/agent/agent-windows.json | 38 +++++ docker/imposter/agents/agent/agent.json | 34 +++++ .../imposter/agents/{ => agent}/agents.json | 130 ++++++++-------- docker/imposter/agents/agents.js | 35 +++-- docker/imposter/syscheck/get-agent.js | 140 ++++++++++++++++++ docker/imposter/wazuh-config.yml | 3 + .../agents/fim/inventory/registry-table.tsx | 3 +- plugins/main/public/styles/typography.scss | 4 + 16 files changed, 309 insertions(+), 123 deletions(-) delete mode 100644 docker/imposter/agents/agent.json rename docker/imposter/agents/{agent_active_groups.json => agent/agent-active-groups.json} (100%) rename docker/imposter/agents/{agent_disconnected.json => agent/agent-disconnected.json} (100%) rename docker/imposter/agents/{agent_macos.json => agent/agent-macos.json} (94%) rename docker/imposter/agents/{agent_manager.json => agent/agent-manager.json} (100%) rename docker/imposter/agents/{agent_never_connected.json => agent/agent-never-connected.json} (100%) rename docker/imposter/agents/{agent_pending.json => agent/agent-pending.json} (100%) create mode 100644 docker/imposter/agents/agent/agent-windows.json create mode 100644 docker/imposter/agents/agent/agent.json rename docker/imposter/agents/{ => agent}/agents.json (74%) create mode 100644 docker/imposter/syscheck/get-agent.js diff --git a/CHANGELOG.md b/CHANGELOG.md index cd38a0a675..e75b867862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed styles in small height viewports [#6747](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6747) - Fixed behavior in Configuration Assessment when changing API [#6770](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6770) - Fixed the fixed maximum width of the clear session button in the ruleset test view [#6871](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6871) +- Fixed the width of the last modification column of the table in Windows Registry [#6876](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6876) - Fixed redirection to FIM > Inventory > Files from FIM > Inventory > Windows Registry when switching to non-Windows agent. [#6880](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6880) ### Removed diff --git a/docker/imposter/agents/agent.json b/docker/imposter/agents/agent.json deleted file mode 100644 index 82c4f3789c..0000000000 --- a/docker/imposter/agents/agent.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "data": { - "affected_items": [ - { - "os": { - "arch": "x86_64", - "codename": "stretch", - "major": "9", - "name": "Debian GNU/Linux", - "platform": "debian", - "uname": "Linux |ip-10-0-1-106 |4.9.0-9-amd64 |#1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) |x86_64", - "version": "9" - }, - "ip": "FE80:0034:0223:A000:0002:B3FF:0000:8329", - "configSum": "6f4293818ef64291ca53727fb9ab8958", - "mergedSum": "7976a83d1aebcca09bc14459b5518ed5", - "id": "001", - "registerIP": "any", - "dateAdd": "2022-08-25T16:25:53Z", - "disconnection_time": "2022-08-25T16:36:35Z", - "name": "Debian", - "status": "active", - "manager": "wazuh-manager-master-0", - "node_name": "master", - "group": [ - "default", - "debian" - ], - "lastKeepAlive": "2022-09-12T08:48:40Z", - "version": "Wazuh v4.3.7", - "status_code": 0 - } - ], - "total_affected_items": 1, - "total_failed_items": 0, - "failed_items": [] - }, - "message": "All selected agents information was returned", - "error": 0 -} diff --git a/docker/imposter/agents/agent_active_groups.json b/docker/imposter/agents/agent/agent-active-groups.json similarity index 100% rename from docker/imposter/agents/agent_active_groups.json rename to docker/imposter/agents/agent/agent-active-groups.json diff --git a/docker/imposter/agents/agent_disconnected.json b/docker/imposter/agents/agent/agent-disconnected.json similarity index 100% rename from docker/imposter/agents/agent_disconnected.json rename to docker/imposter/agents/agent/agent-disconnected.json diff --git a/docker/imposter/agents/agent_macos.json b/docker/imposter/agents/agent/agent-macos.json similarity index 94% rename from docker/imposter/agents/agent_macos.json rename to docker/imposter/agents/agent/agent-macos.json index 514b908210..7219ab11b9 100644 --- a/docker/imposter/agents/agent_macos.json +++ b/docker/imposter/agents/agent/agent-macos.json @@ -11,12 +11,12 @@ "version": "2" }, "ip": "127.0.0.1", - "id": "005", + "id": "004", "group": ["default"], "registerIP": "127.0.0.1", "dateAdd": "2022-08-25T16:17:46Z", "name": "macOS High Sierra agent", - "status": "disconnected", + "status": "active", "manager": "wazuh-manager-master-0", "node_name": "master", "lastKeepAlive": "9999-12-31T23:59:59Z", diff --git a/docker/imposter/agents/agent_manager.json b/docker/imposter/agents/agent/agent-manager.json similarity index 100% rename from docker/imposter/agents/agent_manager.json rename to docker/imposter/agents/agent/agent-manager.json diff --git a/docker/imposter/agents/agent_never_connected.json b/docker/imposter/agents/agent/agent-never-connected.json similarity index 100% rename from docker/imposter/agents/agent_never_connected.json rename to docker/imposter/agents/agent/agent-never-connected.json diff --git a/docker/imposter/agents/agent_pending.json b/docker/imposter/agents/agent/agent-pending.json similarity index 100% rename from docker/imposter/agents/agent_pending.json rename to docker/imposter/agents/agent/agent-pending.json diff --git a/docker/imposter/agents/agent/agent-windows.json b/docker/imposter/agents/agent/agent-windows.json new file mode 100644 index 0000000000..34ae700474 --- /dev/null +++ b/docker/imposter/agents/agent/agent-windows.json @@ -0,0 +1,38 @@ +{ + "data": { + "affected_items": [ + { + "os": { + "build": "19045", + "major": "10", + "minor": "0", + "name": "Microsoft Windows 10 Home Single Language", + "platform": "windows", + "uname": "Microsoft Windows 10 Home Single Language", + "version": "10.0.19045" + }, + "disconnection_time": "2023-03-14T04:37:42Z", + "manager": "test.com", + "status": "active", + "name": "Windows-agent", + "dateAdd": "1970-01-01T00:00:00Z", + "group": ["default", "test"], + "lastKeepAlive": "2023-03-14T04:20:51Z", + "node_name": "node01", + "registerIP": "any", + "id": "003", + "version": "Wazuh v4.3.10", + "ip": "111.111.1.111", + "mergedSum": "e669d89eba52f6897060fc65a45300ac", + "configSum": "97fccbb67e250b7c80aadc8d0dc59abe", + "group_config_status": "not synced", + "status_code": 1 + } + ], + "total_affected_items": 1, + "total_failed_items": 0, + "failed_items": [] + }, + "message": "All selected agents information was returned", + "error": 0 +} diff --git a/docker/imposter/agents/agent/agent.json b/docker/imposter/agents/agent/agent.json new file mode 100644 index 0000000000..7eafa2ee26 --- /dev/null +++ b/docker/imposter/agents/agent/agent.json @@ -0,0 +1,34 @@ +{ + "data": { + "affected_items": [ + { + "os": { + "arch": "x86_64", + "major": "2", + "name": "Amazon Linux", + "platform": "amzn", + "uname": "Linux |wazuh-manager-master-0 |4.14.114-105.126.amzn2.x86_64 |#1 SMP Tue May 7 02:26:40 UTC 2019 |x86_64", + "version": "2" + }, + "group": ["default", "test", "test2"], + "ip": "127.0.0.1", + "id": "002", + "registerIP": "127.0.0.1", + "dateAdd": "2022-08-25T16:17:46Z", + "name": "wazuh-manager-master-0", + "status": "active", + "manager": "wazuh-manager-master-0", + "node_name": "master", + "lastKeepAlive": "9999-12-31T23:59:59Z", + "version": "Wazuh v4.5.0", + "group_config_status": "synced", + "status_code": 0 + } + ], + "total_affected_items": 1, + "total_failed_items": 0, + "failed_items": [] + }, + "message": "All selected agents information was returned", + "error": 0 +} diff --git a/docker/imposter/agents/agents.json b/docker/imposter/agents/agent/agents.json similarity index 74% rename from docker/imposter/agents/agents.json rename to docker/imposter/agents/agent/agents.json index 88f62aa07c..368893b278 100644 --- a/docker/imposter/agents/agents.json +++ b/docker/imposter/agents/agent/agents.json @@ -27,7 +27,7 @@ "id": "000", "registerIP": "FE80:0034:0223:A000:0002:B3FF:0000:8329", "dateAdd": "2022-08-25T16:17:46Z", - "name": "wazuh-manager-master-0", + "name": "Debian", "status": "active", "manager": "wazuh-manager-master-0", "node_name": "master", @@ -39,11 +39,11 @@ { "os": { "arch": "x86_64", - "major": "2", - "name": "Amazon Linux", - "platform": "amzn", - "uname": "Linux |wazuh-manager-master-0 |4.14.114-105.126.amzn2.x86_64 |#1 SMP Tue May 7 02:26:40 UTC 2019 |x86_64", - "version": "2" + "major": "9", + "name": "Debian GNU/Linux", + "platform": "debian", + "uname": "Linux |ip-10-0-1-106 |4.9.0-9-amd64 |#1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) |x86_64", + "version": "9" }, "group": [ "default", @@ -51,18 +51,21 @@ "test2", "test3", "test4", - "test5" + "test5", + "test6", + "test7", + "test8" ], "ip": "FE80:1234:2223:A000:2202:B3FF:FE1E:8329", "id": "001", "registerIP": "FE80:1234:2223:A000:2202:B3FF:FE1E:8329", "dateAdd": "2022-08-25T16:17:46Z", - "name": "wazuh-manager-master-0", + "name": "Debian agent", "status": "active", "manager": "wazuh-manager-master-0", "node_name": "master", "lastKeepAlive": "9999-12-31T23:59:59Z", - "version": "Wazuh v4.4.0", + "version": "Wazuh v4.5.0", "group_config_status": "not synced", "status_code": 0 }, @@ -75,11 +78,7 @@ "uname": "Linux |wazuh-manager-master-0 |4.14.114-105.126.amzn2.x86_64 |#1 SMP Tue May 7 02:26:40 UTC 2019 |x86_64", "version": "2" }, - "group": [ - "default", - "test", - "test2" - ], + "group": ["default", "test", "test2"], "ip": "127.0.0.1", "id": "002", "registerIP": "127.0.0.1", @@ -105,13 +104,10 @@ }, "disconnection_time": "2023-03-14T04:37:42Z", "manager": "test.com", - "status": "disconnected", - "name": "disconnected-agent", + "status": "active", + "name": "Windows-agent", "dateAdd": "1970-01-01T00:00:00Z", - "group": [ - "default", - "test" - ], + "group": ["default", "test"], "lastKeepAlive": "2023-03-14T04:20:51Z", "node_name": "node01", "registerIP": "any", @@ -123,17 +119,6 @@ "group_config_status": "not synced", "status_code": 1 }, - { - "status": "never_connected", - "name": "never_connected_agent", - "dateAdd": "2023-03-14T09:44:11Z", - "node_name": "unknown", - "registerIP": "any", - "id": "004", - "ip": "any", - "group_config_status": "not synced", - "status_code": 4 - }, { "os": { "arch": "x86_64", @@ -144,41 +129,41 @@ "version": "2" }, "ip": "127.0.0.1", - "id": "005", - "group": [ - "default" - ], + "id": "004", + "group": ["default"], "registerIP": "127.0.0.1", "dateAdd": "2022-08-25T16:17:46Z", "name": "macOS High Sierra agent", - "status": "disconnected", + "status": "active", "manager": "wazuh-manager-master-0", "node_name": "master", "lastKeepAlive": "9999-12-31T23:59:59Z", "version": "Wazuh v4.5.0", "group_config_status": "synced", - "status_code": 2 + "status_code": 3 }, { "os": { - "name": "Ubuntu", - "platform": "ubuntu", - "uname": "Linux |f288f4c59dbc |5.19.0-35-generic |#36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 |x86_64", - "version": "18.04.6 LTS" + "arch": "x86_64", + "major": "2", + "name": "macOS High Sierra", + "platform": "darwin", + "uname": "macOS High Sierra |wazuh-manager-master-0 |4.14.114-105.126.amzn2.x86_64 |#1 SMP Tue May 7 02:26:40 UTC 2019 |x86_64", + "version": "2" }, - "group_config_status": "not synced", - "status_code": 0, - "ip": "172.19.0.27", + "ip": "127.0.0.1", + "id": "005", + "group": ["default"], + "registerIP": "127.0.0.1", + "dateAdd": "2022-08-25T16:17:46Z", "status": "pending", "name": "Pending agent", - "group": [ - "default" - ], - "node_name": "master-node", - "version": "Wazuh v4.4.0", - "lastKeepAlive": "2023-03-16T15:15:05+00:00", - "id": "006", - "dateAdd": "2023-03-16T15:14:47+00:00" + "manager": "wazuh-manager-master-0", + "node_name": "master", + "lastKeepAlive": "9999-12-31T23:59:59Z", + "version": "Wazuh v4.5.0", + "group_config_status": "synced", + "status_code": 2 }, { "status": "never_connected", @@ -186,31 +171,43 @@ "dateAdd": "2023-03-14T09:44:11Z", "node_name": "unknown", "registerIP": "any", - "id": "007", + "id": "006", "ip": "any", "group_config_status": "not synced", "status_code": 5 }, { "status": "never_connected", - "name": "never_connected_agent-3", + "name": "never_connected_agent-2", "dateAdd": "2023-03-14T09:44:11Z", "node_name": "unknown", "registerIP": "any", - "id": "008", + "id": "007", "ip": "any", "group_config_status": "not synced", - "status_code": 1 + "status_code": 5 }, { - "status": "never_connected", - "name": "never_connected_agent-4", - "dateAdd": "2023-03-14T09:44:11Z", - "node_name": "unknown", - "registerIP": "any", + "os": { + "arch": "x86_64", + "major": "2", + "name": "macOS High Sierra", + "platform": "darwin", + "uname": "macOS High Sierra |wazuh-manager-master-0 |4.14.114-105.126.amzn2.x86_64 |#1 SMP Tue May 7 02:26:40 UTC 2019 |x86_64", + "version": "2" + }, + "ip": "127.0.0.1", "id": "009", - "ip": "any", - "group_config_status": "not synced", + "group": ["default"], + "registerIP": "127.0.0.1", + "dateAdd": "2022-08-25T16:17:46Z", + "status": "disconnected", + "name": "disconnected-agent-1", + "manager": "wazuh-manager-master-0", + "node_name": "master", + "lastKeepAlive": "9999-12-31T23:59:59Z", + "version": "Wazuh v4.5.0", + "group_config_status": "synced", "status_code": 2 }, { @@ -228,10 +225,7 @@ "status": "disconnected", "name": "disconnected-agent-2", "dateAdd": "1970-01-01T00:00:00Z", - "group": [ - "default", - "test" - ], + "group": ["default", "test"], "lastKeepAlive": "2023-03-14T04:20:51Z", "node_name": "node01", "registerIP": "any", @@ -249,4 +243,4 @@ }, "message": "All selected agents information was returned", "error": 0 -} \ No newline at end of file +} diff --git a/docker/imposter/agents/agents.js b/docker/imposter/agents/agents.js index 1a3cdff7f5..329fee9586 100644 --- a/docker/imposter/agents/agents.js +++ b/docker/imposter/agents/agents.js @@ -10,31 +10,42 @@ if (queryAgentIdExist) { switch (agentId) { case undefined: - respond().withStatusCode(200).withFile('agents/agents.json'); + respond().withStatusCode(200).withFile('agents/agent/agents.json'); break; case '000': - respond().withStatusCode(200).withFile('agents/agent_manager.json'); + respond().withStatusCode(200).withFile('agents/agent/agent-manager.json'); break; case '001': - respond().withStatusCode(200).withFile('agents/agent_active_groups.json'); + respond() + .withStatusCode(200) + .withFile('agents/agent/agent-active-groups.json'); + break; + case '002': + respond().withStatusCode(200).withFile('agents/agent/agent.json'); break; case '003': - case '010': - respond().withStatusCode(200).withFile('agents/agent_disconnected.json'); + respond().withStatusCode(200).withFile('agents/agent/agent-windows.json'); break; case '004': - case '007': - case '008': - case '009': - respond().withStatusCode(200).withFile('agents/agent_never_connected.json'); + respond().withStatusCode(200).withFile('agents/agent/agent-macos.json'); break; case '005': - respond().withStatusCode(200).withFile('agents/agent_macos.json'); + respond().withStatusCode(200).withFile('agents/agent/agent-pending.json'); break; case '006': - respond().withStatusCode(200).withFile('agents/agent_pending.json'); + case '007': + case '008': + respond() + .withStatusCode(200) + .withFile('agents/agent/agent-never-connected.json'); + break; + case '009': + case '010': + respond() + .withStatusCode(200) + .withFile('agents/agent/agent-disconnected.json'); break; default: - respond().withStatusCode(200).withFile('agents/agent.json'); + respond().withStatusCode(200).withFile('agents/agent/agent.json'); break; } diff --git a/docker/imposter/syscheck/get-agent.js b/docker/imposter/syscheck/get-agent.js new file mode 100644 index 0000000000..f3c0e142f5 --- /dev/null +++ b/docker/imposter/syscheck/get-agent.js @@ -0,0 +1,140 @@ +if (!String.prototype.includes) { + String.prototype.includes = function (search, start) { + 'use strict'; + + if (search instanceof RegExp) { + throw TypeError('first argument must not be a RegExp'); + } + if (start === undefined) { + start = 0; + } + return this.indexOf(search, start) !== -1; + }; +} + +var queryParamsQ = context.request.queryParams.q; +var payload; + +if (queryParamsQ && queryParamsQ.includes('type=file')) { + payload = { + data: { + affected_items: [ + { + changes: 1, + date: '2019-11-22T10:24:52Z', + file: '/etc/resolv.conf', + gid: '0', + gname: 'root', + inode: 1459742, + md5: '731423fa8ba067262f8ef37882d1e742', + mtime: '2009-02-02T23:06:58Z', + perm: '100644', + sha1: 'b65f7f2af66c53b51765877bbe91a22bc6fca1e2', + sha256: + '50f35af8ac4a5df3690991a4b428fa49d56580b0020fcc6e38283b3b1b2e6c74', + size: 82, + type: 'file', + uid: '0', + uname: 'root', + attributes: '', + }, + { + changes: 1, + date: '2019-11-22T10:24:56Z', + file: '/etc/sgml/xml-core.cat', + gid: '0', + gname: 'root', + inode: 2896763, + md5: '055ba0bd3154c0a58b9bf8a0c9ecf2fa', + mtime: '2012-11-07T21:44:21Z', + perm: '100644', + sha1: '3dec5570307472381671ff18bbe4d4be09951690', + sha256: + '3c46704b553c4b55ce928ffe89badfcfd08a02f0e6558211dfd57d9ae1e72aa4', + size: 45, + type: 'file', + uid: '0', + uname: 'root', + attributes: '', + }, + ], + total_affected_items: 2, + total_failed_items: 0, + failed_items: [], + }, + message: 'FIM findings of the agent were returned', + error: 0, + }; +} else if (queryParamsQ && queryParamsQ.includes('type=registry_key')) { + payload = { + data: { + affected_items: [ + { + file: 'HKEY_LOCAL_MACHINE\\SYSTEM\\Setup', + mtime: '2009-02-02T23:06:58Z', + }, + { + file: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\test', + mtime: '2009-02-02T23:06:58Z', + }, + ], + total_affected_items: 2, + total_failed_items: 0, + failed_items: [], + }, + message: 'FIM findings of the agent were returned', + error: 0, + }; +} else { + payload = { + data: { + affected_items: [ + { + changes: 1, + date: '2019-11-22T10:24:52Z', + file: '/etc/resolv.conf', + gid: '0', + gname: 'root', + inode: 1459742, + md5: '731423fa8ba067262f8ef37882d1e742', + mtime: '2009-02-02T23:06:58Z', + perm: '100644', + sha1: 'b65f7f2af66c53b51765877bbe91a22bc6fca1e2', + sha256: + '50f35af8ac4a5df3690991a4b428fa49d56580b0020fcc6e38283b3b1b2e6c74', + size: 82, + type: 'file', + uid: '0', + uname: 'root', + attributes: '', + }, + { + changes: 1, + date: '2019-11-22T10:24:56Z', + file: '/etc/sgml/xml-core.cat', + gid: '0', + gname: 'root', + inode: 2896763, + md5: '055ba0bd3154c0a58b9bf8a0c9ecf2fa', + mtime: '2012-11-07T21:44:21Z', + perm: '100644', + sha1: '3dec5570307472381671ff18bbe4d4be09951690', + sha256: + '3c46704b553c4b55ce928ffe89badfcfd08a02f0e6558211dfd57d9ae1e72aa4', + size: 45, + type: 'file', + uid: '0', + uname: 'root', + attributes: '', + }, + ], + total_affected_items: 2, + total_failed_items: 0, + failed_items: [], + }, + message: 'FIM findings of the agent were returned', + error: 0, + }; +} + +respond().withStatusCode(200).withData(JSON.stringify(payload)); diff --git a/docker/imposter/wazuh-config.yml b/docker/imposter/wazuh-config.yml index 67a56da9ce..a538b3fafe 100755 --- a/docker/imposter/wazuh-config.yml +++ b/docker/imposter/wazuh-config.yml @@ -827,6 +827,9 @@ resources: # Get results - method: GET path: /syscheck/{agent_id} + response: + statusCode: 200 + scriptFile: syscheck/get-agent.js # Clearresults - method: DELETE diff --git a/plugins/main/public/components/agents/fim/inventory/registry-table.tsx b/plugins/main/public/components/agents/fim/inventory/registry-table.tsx index 58dd8f2e84..ee96fff10c 100644 --- a/plugins/main/public/components/agents/fim/inventory/registry-table.tsx +++ b/plugins/main/public/components/agents/fim/inventory/registry-table.tsx @@ -88,7 +88,8 @@ export const RegistryTable = withRouterSearch( ), sortable: true, - width: '200px', + width: '250px', + className: 'wz-white-space-nowrap', render: formatUIDate, searchable: false, }, diff --git a/plugins/main/public/styles/typography.scss b/plugins/main/public/styles/typography.scss index 24f5319e11..113b2531a9 100644 --- a/plugins/main/public/styles/typography.scss +++ b/plugins/main/public/styles/typography.scss @@ -55,6 +55,10 @@ select { text-align: right; } +.wz-white-space-nowrap { + white-space: nowrap; +} + .wz-text-left { text-align: left; } From b242cd10f7e8366f9d4f167b600d80b5627435c7 Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:16:29 +0200 Subject: [PATCH 20/39] Display rule details flyout based on URL (#6886) * fix(rules): display rule flyout details based on URL * chore(changelog): add entry --- CHANGELOG.md | 1 + .../ruleset/components/ruleset-table.tsx | 127 ++++++++---------- 2 files changed, 60 insertions(+), 68 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e75b867862..224520e071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) - Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Changed the display of rule details flyout to be based on URL [#6886](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6886) ### Fixed diff --git a/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx b/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx index cfbe1de5bb..01983217fb 100644 --- a/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx +++ b/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ -import React, { useEffect, useState, useCallback } from 'react'; +import React, { useState, useCallback } from 'react'; import { getToasts } from '../../../../../../kibana-services'; import { resourceDictionary, @@ -38,7 +38,9 @@ import { } from '../../common/actions-buttons'; import apiSuggestsItems from './ruleset-suggestions'; -import { useRouterSearch } from '../../../../../../components/common/hooks'; +import { Route, Switch } from '../../../../../../components/router-search'; +import { withRouterSearch } from '../../../../../../components/common/hocs'; +import NavigationService from '../../../../../../react-services/navigation-service'; const searchBarWQLOptions = { searchTermFields: [ @@ -107,52 +109,60 @@ const FilesTable = ({ /> ); -const RulesFlyoutTable = ({ - actionButtons, - columns, - searchBarSuggestions, - filters, - updateFilters, - getRowProps, - isFlyoutVisible, - currentItem, - closeFlyout, - cleanFilters, - ...props -}) => ( - <> - - {isFlyoutVisible && ( - ( + <> + - )} - + + ( + { + NavigationService.getInstance().updateAndNavigateSearchParams({ + redirectRule: null, + }); + }} + showViewInEvents={true} + outsideClickCloses={true} + filters={filters} + onFiltersChange={updateFilters} + cleanFilters={cleanFilters} + {...props} + /> + )} + > + + + ), ); /*************************************** @@ -160,23 +170,10 @@ const RulesFlyoutTable = ({ */ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { const [filters, setFilters] = useState([]); - const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); - const [currentItem, setCurrentItem] = useState(null); - const search = useRouterSearch(); - const [tableFootprint, setTableFootprint] = useState(0); const resourcesHandler = new ResourcesHandler(ResourcesConstants.RULES); - useEffect(() => { - if (search.redirectRule) { - // TODO: the view to display the specific group should be managed through the routing based on - // the URL instead of a component state. This lets refreshing the page and display the same view - setCurrentItem(parseInt(search.redirectRule)); - setIsFlyoutVisible(true); - } - }, []); - const updateFilters = filters => { setFilters(filters); }; @@ -190,10 +187,6 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { setShowingFiles(!showingFiles); }; - const closeFlyout = () => { - setIsFlyoutVisible(false); - }; - /** * Remove files method */ @@ -266,8 +259,9 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { props.userPermissions, ) ? item => { - setCurrentItem(id); - setIsFlyoutVisible(true); + NavigationService.getInstance().updateAndNavigateSearchParams({ + redirectRule: id, + }); } : undefined, }; @@ -326,9 +320,6 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { filters={filters} updateFilters={updateFilters} getRowProps={getRowProps} - isFlyoutVisible={isFlyoutVisible} - currentItem={currentItem} - closeFlyout={closeFlyout} cleanFilters={cleanFilters} updateFileContent={updateFileContent} /> From 96908557b0e7e0a88a76de79b525ccae975dc414 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 31 Jul 2024 16:14:16 +0200 Subject: [PATCH 21/39] Fixed render bug in Security alerts table (#6883) * Remove rule.mitre.id and .tactics * Added Changelog * Updated changelog * Rename Time label to timestamp --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> --- CHANGELOG.md | 2 +- .../dashboard/dashboard-panels.ts | 40 ++----------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 224520e071..63d2127f7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) [#6883](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6883) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/overview/malware-detection/dashboard/dashboard-panels.ts b/plugins/main/public/components/overview/malware-detection/dashboard/dashboard-panels.ts index 9e4bc8c59b..f5b863f14c 100644 --- a/plugins/main/public/components/overview/malware-detection/dashboard/dashboard-panels.ts +++ b/plugins/main/public/components/overview/malware-detection/dashboard/dashboard-panels.ts @@ -357,7 +357,7 @@ const getVisStateSecurityAlerts = (indexPatternId: string) => { drop_partials: false, min_doc_count: 1, extended_bounds: {}, - customLabel: 'Time', + customLabel: 'timestamp', }, schema: 'bucket', }, @@ -382,40 +382,6 @@ const getVisStateSecurityAlerts = (indexPatternId: string) => { id: '4', enabled: true, type: 'terms', - params: { - field: 'rule.mitre.id', - orderBy: '_key', - order: 'desc', - size: 5, - otherBucket: false, - otherBucketLabel: 'Other', - missingBucket: false, - missingBucketLabel: 'Missing', - customLabel: 'rule.mitre.id', - }, - schema: 'bucket', - }, - { - id: '5', - enabled: true, - type: 'terms', - params: { - field: 'rule.mitre.tactic', - orderBy: '_key', - order: 'desc', - size: 5, - otherBucket: false, - otherBucketLabel: 'Other', - missingBucket: false, - missingBucketLabel: 'Missing', - customLabel: 'rule.mitre.tactic', - }, - schema: 'bucket', - }, - { - id: '6', - enabled: true, - type: 'terms', params: { field: 'rule.description', orderBy: '_key', @@ -430,7 +396,7 @@ const getVisStateSecurityAlerts = (indexPatternId: string) => { schema: 'bucket', }, { - id: '7', + id: '5', enabled: true, type: 'terms', params: { @@ -447,7 +413,7 @@ const getVisStateSecurityAlerts = (indexPatternId: string) => { schema: 'bucket', }, { - id: '8', + id: '6', enabled: true, type: 'terms', params: { From 669f9873b683367a70d0399f4a1eb0222dc30cf8 Mon Sep 17 00:00:00 2001 From: Luciano Gorza <103193307+lucianogorza@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:26:09 -0300 Subject: [PATCH 22/39] Add tooltips to new discover table call to actions (#6889) * Add tooltips to new discover table call to actions * Update CHANGELOG * Update Wz-Link documentation --- CHANGELOG.md | 2 +- plugins/main/docs/wz-link.md | 5 +++++ .../common/wazuh-discover/render-columns.tsx | 22 +++++++++++++++++++ .../public/components/wz-link/wz-link.tsx | 15 ++++++++++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d2127f7a..6e368956f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) [#6883](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6883) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) [#6883](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6883) [#6889](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6889) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/docs/wz-link.md b/plugins/main/docs/wz-link.md index 337a0ae871..89d333d60a 100644 --- a/plugins/main/docs/wz-link.md +++ b/plugins/main/docs/wz-link.md @@ -37,12 +37,17 @@ When navigating between applications you can use Opensearch Dashboard navigation ``` +#### With tooltip + +If the component receives the `toolTipProps` object as a prop, then it wraps the link with a tooltip component. + ### Implementation ```tsx } path={} + toolTipProps={{content: 'This is a tooltip'}} //Optional prop otherPropsForTheEuiLink > whatever you want to render in the link diff --git a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx index b4e8f34d07..c58a4a6837 100644 --- a/plugins/main/public/components/common/wazuh-discover/render-columns.tsx +++ b/plugins/main/public/components/common/wazuh-discover/render-columns.tsx @@ -7,6 +7,7 @@ import { mitreAttack, } from '../../../utils/applications'; import { WzLink } from '../../wz-link/wz-link'; +import { i18n } from '@osd/i18n'; export const MAX_ENTRIES_PER_QUERY = 10000; @@ -22,6 +23,12 @@ const renderMitreTechnique = technique => ( {technique} @@ -39,6 +46,11 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [ {value} @@ -56,6 +68,11 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [ {value} @@ -68,6 +85,11 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [ {value} diff --git a/plugins/main/public/components/wz-link/wz-link.tsx b/plugins/main/public/components/wz-link/wz-link.tsx index 45415133f9..61e40b20c8 100644 --- a/plugins/main/public/components/wz-link/wz-link.tsx +++ b/plugins/main/public/components/wz-link/wz-link.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { RedirectAppLinks } from '../../../../../src/plugins/opensearch_dashboards_react/public'; -import { EuiLink } from '@elastic/eui'; +import { EuiLink, EuiToolTip, EuiToolTipProps } from '@elastic/eui'; import { getCore } from '../../kibana-services'; import NavigationService from '../../react-services/navigation-service'; import useObservable from 'react-use/lib/useObservable'; @@ -9,10 +9,11 @@ type tWzLinkProps = { appId: string; path: string; children: React.ReactNode; + toolTipProps?: EuiToolTipProps; }; export const WzLink = (props: tWzLinkProps) => { - const { appId, path, children, ...otherProps } = props; + const { appId, path, children, toolTipProps, ...otherProps } = props; const [isCurrentApp, setIsCurrentApp] = useState(false); const currentAppId$ = useObservable( @@ -36,6 +37,7 @@ export const WzLink = (props: tWzLinkProps) => { ); + const linkSameApp = ( { {children} ); - return isCurrentApp ? linkSameApp : linkDiferentApps; + + const finalLink = isCurrentApp ? linkSameApp : linkDiferentApps; + + return toolTipProps ? ( + {finalLink} + ) : ( + finalLink + ); }; From ede74fd5417778b103b763eb6b9399b335f3ce08 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:05:31 +0200 Subject: [PATCH 23/39] Fixes redirects to specific techniques (#6882) * Add switch route to flyout * Update redirections * Add tabRedirect to know subTab * Update changelog * Fix(intelligence test): Mock service * Fix(intelligence): Fix comment * Change(Visualizations): Change donut: true * Fix(tableColumnsCreator): remove parameter unused --------- Co-authored-by: Federico Rodriguez --- CHANGELOG.md | 1 + .../github/dashboards/dashboard-panels.ts | 2 +- .../mitre/intelligence/intelligence.test.tsx | 13 ++++- .../mitre/intelligence/intelligence.tsx | 47 ++++++++++++------- .../overview/mitre/intelligence/resource.tsx | 32 ++++++++----- .../intelligence/resource_detail_flyout.tsx | 2 +- .../overview/mitre/intelligence/resources.tsx | 21 +++++++-- .../office/panel/config/visualizations.ts | 2 +- 8 files changed, 82 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e368956f6..054f41f271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) - Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Change the internal control from Mitre > intelligence > Table to a control via url. [#6882](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6882) - Changed the display of rule details flyout to be based on URL [#6886](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6886) ### Fixed diff --git a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts index 1eb52f1b8a..4c8d85e059 100644 --- a/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/github/dashboards/dashboard-panels.ts @@ -600,7 +600,7 @@ const getVisStateAgentTopOrganizationsByAlertCount = ( addTooltip: true, addLegend: true, legendPosition: 'right', - isDonut: false, + isDonut: true, labels: { show: false, values: true, diff --git a/plugins/main/public/components/overview/mitre/intelligence/intelligence.test.tsx b/plugins/main/public/components/overview/mitre/intelligence/intelligence.test.tsx index 8528b41f58..2f18e4262d 100644 --- a/plugins/main/public/components/overview/mitre/intelligence/intelligence.test.tsx +++ b/plugins/main/public/components/overview/mitre/intelligence/intelligence.test.tsx @@ -46,7 +46,18 @@ jest.mock('react', () => ({ })); jest.mock('../../../../react-services/navigation-service', () => ({ - getInstance() {}, + getInstance() { + return { + getLocation: () => { + return { search: '?tabRedirect=groups' }; + }, + getParams: () => { + return { + has: () => 'groups', + }; + }, + }; + }, })); const mockStore = configureMockStore(); diff --git a/plugins/main/public/components/overview/mitre/intelligence/intelligence.tsx b/plugins/main/public/components/overview/mitre/intelligence/intelligence.tsx index 5372e0185e..fa20f0e82f 100644 --- a/plugins/main/public/components/overview/mitre/intelligence/intelligence.tsx +++ b/plugins/main/public/components/overview/mitre/intelligence/intelligence.tsx @@ -17,17 +17,19 @@ import { EuiPanel } from '@elastic/eui'; import { MitreAttackResources } from './resources'; import { ModuleMitreAttackIntelligenceLeftPanel } from './intelligence_left_panel'; import { ModuleMitreAttackIntelligenceRightPanel } from './intelligence_right_panel'; -import { useAsyncAction } from '../../../common/hooks'; +import { useAsyncAction, useRouterSearch } from '../../../common/hooks'; import { WzRequest } from '../../../../react-services'; import { PanelSplit } from '../../../common/panels'; import { withUserAuthorizationPrompt } from '../../../common/hocs'; import { compose } from 'redux'; +import NavigationService from '../../../../react-services/navigation-service'; export const ModuleMitreAttackIntelligence = compose( withUserAuthorizationPrompt([{ action: 'mitre:read', resource: '*:*:*' }]), )(() => { + const paramTabRedirect = useRouterSearch().tabRedirect; const [selectedResource, setSelectedResource] = useState( - MitreAttackResources[0].id, + paramTabRedirect || MitreAttackResources[0].id, ); const [searchTermAllResources, setSearchTermAllResources] = useState(''); const searchTermAllResourcesLastSearch = useRef(''); @@ -50,8 +52,8 @@ export const ModuleMitreAttackIntelligence = compose( params: { ...(searchTerm ? { - q: fields.map(key => `${key}~${searchTerm}`).join(','), - } + q: fields.map(key => `${key}~${searchTerm}`).join(','), + } : {}), limit: limitResults, }, @@ -70,13 +72,13 @@ export const ModuleMitreAttackIntelligence = compose( setResourceFilters({ ...(searchTermAllResourcesLastSearch.current ? { - q: fields - .map( - key => - `${key}~${searchTermAllResourcesLastSearch.current}`, - ) - .join(','), - } + q: fields + .map( + key => + `${key}~${searchTermAllResourcesLastSearch.current}`, + ) + .join(','), + } : {}), }); setSelectedResource(resource.id); @@ -93,19 +95,23 @@ export const ModuleMitreAttackIntelligence = compose( ); useEffect(() => { - const urlParams = new URLSearchParams(location.href); - const redirectTab = urlParams.get('tabRedirect'); - if (redirectTab) { - setSelectedResource(redirectTab); + if (!paramTabRedirect) { + NavigationService.getInstance().updateAndNavigateSearchParams({ + tabRedirect: selectedResource, + }); } - }, []); + setSelectedResource(paramTabRedirect); + }, [paramTabRedirect]); const onSelectResource = useCallback( resourceID => { + NavigationService.getInstance().updateAndNavigateSearchParams({ + tabRedirect: resourceID, + }); setResourceFilters({}); setSelectedResource(prevSelectedResource => prevSelectedResource === resourceID && - searchTermAllResourcesUsed.current + searchTermAllResourcesUsed.current ? null : resourceID, ); @@ -118,7 +124,12 @@ export const ModuleMitreAttackIntelligence = compose( }, []); return ( - + { try { @@ -69,10 +69,13 @@ export const ModuleMitreAttackIntelligenceResource = ({ } }; - const tableColumns = useMemo(() => tableColumnsCreator(setDetails), []); + const tableColumns = useMemo(() => tableColumnsCreator(), []); const closeFlyout = useCallback(() => { setDetails(null); + NavigationService.getInstance().updateAndNavigateSearchParams({ + idToRedirect: null, + }); }, []); return ( @@ -91,11 +94,18 @@ export const ModuleMitreAttackIntelligenceResource = ({ }} /> {details && ( - closeFlyout()} - onSelectResource={setDetails} - /> + + ( + closeFlyout()} + onSelectResource={setDetails} + /> + )} + /> + )} ); diff --git a/plugins/main/public/components/overview/mitre/intelligence/resource_detail_flyout.tsx b/plugins/main/public/components/overview/mitre/intelligence/resource_detail_flyout.tsx index a043af9897..57299494f8 100644 --- a/plugins/main/public/components/overview/mitre/intelligence/resource_detail_flyout.tsx +++ b/plugins/main/public/components/overview/mitre/intelligence/resource_detail_flyout.tsx @@ -95,7 +95,7 @@ export const ModuleMitreAttackIntelligenceFlyout = ({ { startReference.current?.scrollIntoView(); }} diff --git a/plugins/main/public/components/overview/mitre/intelligence/resources.tsx b/plugins/main/public/components/overview/mitre/intelligence/resources.tsx index f85b730c29..e55a088763 100644 --- a/plugins/main/public/components/overview/mitre/intelligence/resources.tsx +++ b/plugins/main/public/components/overview/mitre/intelligence/resources.tsx @@ -15,13 +15,14 @@ import { WzRequest } from '../../../../react-services'; import { Markdown } from '../../../common/util'; import { formatUIDate } from '../../../../react-services'; import React from 'react'; -import { EuiLink } from '@elastic/eui'; import { SEARCH_BAR_WQL_VALUE_SUGGESTIONS_COUNT, UI_LOGGER_LEVELS, } from '../../../../../common/constants'; import { UI_ERROR_SEVERITIES } from '../../../../react-services/error-orchestrator/types'; import { getErrorOrchestrator } from '../../../../react-services/common-services'; +import { mitreAttack } from '../../../../utils/applications'; +import { WzLink } from '../../../wz-link/wz-link'; const getMitreAttackIntelligenceSuggestions = async ( endpoint: string, @@ -98,13 +99,18 @@ function buildResource(label: string) { apiEndpoint: endpoint, fieldName: 'name', initialSortingField: 'name', - tableColumnsCreator: openResourceDetails => [ + tableColumnsCreator: () => [ { field: 'external_id', name: 'ID', width: '12%', - render: (value, item) => ( - openResourceDetails(item)}>{value} + render: value => ( + + {value} + ), }, { @@ -113,7 +119,12 @@ function buildResource(label: string) { sortable: true, width: '30%', render: (value, item) => ( - openResourceDetails(item)}>{value} + + {value} + ), }, { diff --git a/plugins/main/public/components/overview/office/panel/config/visualizations.ts b/plugins/main/public/components/overview/office/panel/config/visualizations.ts index 1d8a7567cc..4d449d0c1d 100644 --- a/plugins/main/public/components/overview/office/panel/config/visualizations.ts +++ b/plugins/main/public/components/overview/office/panel/config/visualizations.ts @@ -90,7 +90,7 @@ export const getVisStateOfficeTopsEventsPie = (indexPatternId: string) => { addTooltip: true, addLegend: true, legendPosition: 'right', - isDonut: false, + isDonut: true, labels: { show: false, values: true, From 6035f0e62436b50067a81c8ef8c3262d9bf17fc5 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Wed, 31 Jul 2024 20:04:28 +0200 Subject: [PATCH 24/39] Added consistency between url and Endpoint groups view (#6890) * Fix(Endpoint Groups): URL consistent with the state of the selected group * Changelog: Update --------- Co-authored-by: Federico Rodriguez --- CHANGELOG.md | 1 + .../management/groups/group-detail.js | 57 ++++++++++--------- .../management/groups/groups-main.js | 31 ++++++++-- .../management/groups/groups-overview.js | 8 ++- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 054f41f271..b8e8561fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) - Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Change the internal control from Endpoint Groups to a control via url. [#6890](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6890) - Change the internal control from Mitre > intelligence > Table to a control via url. [#6882](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6882) - Changed the display of rule details flyout to be based on URL [#6886](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6886) diff --git a/plugins/main/public/controllers/management/components/management/groups/group-detail.js b/plugins/main/public/controllers/management/components/management/groups/group-detail.js index bbfc161651..23a5325c69 100644 --- a/plugins/main/public/controllers/management/components/management/groups/group-detail.js +++ b/plugins/main/public/controllers/management/components/management/groups/group-detail.js @@ -1,4 +1,4 @@ -import React, { Component, Fragment } from 'react'; +import React, { Component } from 'react'; // Eui components import { EuiFlexGroup, @@ -6,11 +6,10 @@ import { EuiPanel, EuiPage, EuiTitle, - EuiText, EuiTab, EuiTabs, EuiToolTip, - EuiButtonIcon + EuiButtonIcon, } from '@elastic/eui'; import { connect } from 'react-redux'; @@ -19,7 +18,7 @@ import GroupsHandler from './utils/groups-handler'; import { cleanTabs, - updateSelectedTab + updateSelectedTab, } from '../../../../../redux/actions/groupsActions'; import WzGroupsActionButtonsAgents from './actions-buttons-agents'; import WzGroupsActionButtonsFiles from './actions-buttons-files'; @@ -27,6 +26,7 @@ import WzGroupAgentsTable from './group-agents-table'; import WzGroupFilesTable from './group-files-table'; import { withUserAuthorizationPrompt } from '../../../../../components/common/hocs'; import { compose } from 'redux'; +import NavigationService from '../../../../../react-services/navigation-service'; class WzGroupDetail extends Component { constructor(props) { @@ -36,17 +36,17 @@ class WzGroupDetail extends Component { { id: 'agents', name: 'Agents', - disabled: false + disabled: false, }, { id: 'files', name: 'Files', - disabled: false - } + disabled: false, + }, ]; this.state = { - selectedTabId: this.props.state.selectedTabId + selectedTabId: this.props.state.selectedTabId, }; this.groupsHandler = GroupsHandler; @@ -58,13 +58,16 @@ class WzGroupDetail extends Component { onSelectedTabChanged = id => { this.setState({ - selectedTabId: id + selectedTabId: id, }); this.props.updateSelectedTab(id); }; goBack() { this.props.cleanTabs(); + NavigationService.getInstance().updateAndNavigateSearchParams({ + group: null, + }); } renderTabs() { @@ -82,15 +85,11 @@ class WzGroupDetail extends Component { } renderAgents() { - return ( - - ); + return ; } renderFiles() { - return ( - - ); + return ; } render() { @@ -103,19 +102,19 @@ class WzGroupDetail extends Component { - + this.goBack()} /> - +

{itemDetail.name}

@@ -147,7 +146,7 @@ class WzGroupDetail extends Component { const mapStateToProps = state => { return { - state: state.groupsReducers + state: state.groupsReducers, }; }; @@ -155,14 +154,16 @@ const mapDispatchToProps = dispatch => { return { cleanTabs: () => dispatch(cleanTabs()), updateSelectedTab: selectedTabId => - dispatch(updateSelectedTab(selectedTabId)) + dispatch(updateSelectedTab(selectedTabId)), }; }; export default compose( - connect( - mapStateToProps, - mapDispatchToProps - ), - withUserAuthorizationPrompt((props) => [{action: 'group:read', resource: `group:id:${props.state.itemDetail.name}`}]), + connect(mapStateToProps, mapDispatchToProps), + withUserAuthorizationPrompt(props => [ + { + action: 'group:read', + resource: `group:id:${props.state.itemDetail.name}`, + }, + ]), )(WzGroupDetail); diff --git a/plugins/main/public/controllers/management/components/management/groups/groups-main.js b/plugins/main/public/controllers/management/components/management/groups/groups-main.js index 77ad7d7260..109ed61a48 100644 --- a/plugins/main/public/controllers/management/components/management/groups/groups-main.js +++ b/plugins/main/public/controllers/management/components/management/groups/groups-main.js @@ -39,7 +39,7 @@ class WzGroups extends Component { this.state = {}; } - async componentDidMount() { + getGroupDetail = async () => { // Check if there is a group in the URL const { group } = this.props.search; if (group) { @@ -50,9 +50,6 @@ class WzGroups extends Component { }); const dataGroup = responseGroup?.data?.data?.affected_items?.[0]; this.props.updateGroupDetail(dataGroup); - NavigationService.getInstance().updateAndNavigateSearchParams({ - group: null, - }); } catch (error) { const options = { context: `${WzGroups.name}.componentDidMount`, @@ -68,6 +65,17 @@ class WzGroups extends Component { getErrorOrchestrator().handleError(options); } } + }; + async componentDidMount() { + await this.getGroupDetail(); + } + + async componentDidUpdate(prevProps) { + if (this.props.search?.group !== prevProps.search?.group) { + this.props.search?.group === undefined + ? this.props.updateGroupDetail(false) + : await this.getGroupDetail(); + } } UNSAFE_componentWillReceiveProps(nextProps) { @@ -113,7 +121,20 @@ const mapDispatchToProps = dispatch => { export default compose( connect(mapStateToProps, mapDispatchToProps), withGlobalBreadcrumb(props => { - return [{ text: endpointGroups.breadcrumbLabel }]; + return props.state?.itemDetail + ? [ + { + text: endpointGroups.breadcrumbLabel, + onClick: ev => { + ev.preventDefault(); + NavigationService.getInstance().updateAndNavigateSearchParams({ + group: null, + }); + }, + }, + { text: props.state?.itemDetail.name }, + ] + : [{ text: endpointGroups.breadcrumbLabel }]; }), withRouterSearch, )(WzGroups); diff --git a/plugins/main/public/controllers/management/components/management/groups/groups-overview.js b/plugins/main/public/controllers/management/components/management/groups/groups-overview.js index 687281f7f8..826cd71d78 100644 --- a/plugins/main/public/controllers/management/components/management/groups/groups-overview.js +++ b/plugins/main/public/controllers/management/components/management/groups/groups-overview.js @@ -39,6 +39,7 @@ import { WzRequest, WzUserPermissions } from '../../../../../react-services'; import { getToasts } from '../../../../../kibana-services'; import GroupsHandler from './utils/groups-handler'; import { SEARCH_BAR_WQL_VALUE_SUGGESTIONS_COUNT } from '../../../../../../common/constants'; +import NavigationService from '../../../../../react-services/navigation-service'; export class WzGroupsOverview extends Component { _isMounted = false; @@ -256,7 +257,12 @@ export class WzGroupsOverview extends Component { [{ action: 'group:read', resource: `group:id:${item.name}` }], this.props.userPermissions, ) - ? () => this.props.updateGroupDetail(item) + ? () => { + NavigationService.getInstance().updateAndNavigateSearchParams({ + group: item.name, + }); + return this.props.updateGroupDetail(item); + } : undefined, }; }; From 422ff84499c3bcade64c559630c3003eac2d20d2 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Thu, 1 Aug 2024 12:33:03 +0200 Subject: [PATCH 25/39] Fix endpoints summary agent action buttons navigation (#6893) * Fix endpoints summary agent action buttons navigation * Add changelog --- CHANGELOG.md | 2 +- .../endpoints-summary/table/actions/actions.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e8561fcd..afbb1bb8ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improve margins and paddings in the Events, Inventory and Control tabs [#6708](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6708) - Refactored the search bar to correctly handle fixed and user-added filters [#6716](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6716) [#6755](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6755) [#6833](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6833) - Generate URL with predefined filters [#6745](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6745) -- Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790) +- Migrated AngularJS routing to ReactJS [#6689](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6689) [#6775](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6775) [#6790](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6790) [#6893](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6893) - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) - Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) diff --git a/plugins/main/public/components/endpoints-summary/table/actions/actions.tsx b/plugins/main/public/components/endpoints-summary/table/actions/actions.tsx index d70d0ce785..897eaa3227 100644 --- a/plugins/main/public/components/endpoints-summary/table/actions/actions.tsx +++ b/plugins/main/public/components/endpoints-summary/table/actions/actions.tsx @@ -35,9 +35,9 @@ export const agentsTableActions = ( color: 'primary', enabled: agent => agent.status !== API_NAME_AGENT_STATUS.NEVER_CONNECTED, onClick: agent => - NavigationService.getInstance().navigateToApp(endpointSummary.id, { - path: `#/agents?tab=welcome&agent=${agent.id}`, - }), + NavigationService.getInstance().navigate( + `/agents?tab=welcome&agent=${agent.id}`, + ), }, { name: agent => { @@ -57,9 +57,9 @@ export const agentsTableActions = ( icon: 'wrench', type: 'icon', onClick: agent => - NavigationService.getInstance().navigateToApp(endpointSummary.id, { - path: `#/agents?tab=configuration&agent=${agent.id}`, - }), + NavigationService.getInstance().navigate( + `/agents?tab=configuration&agent=${agent.id}`, + ), enabled: agent => agent.status !== API_NAME_AGENT_STATUS.NEVER_CONNECTED, 'data-test-subj': 'action-configuration', }, From 730067d4ad52db7031359c6df538dfb146e615c0 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Fri, 2 Aug 2024 10:16:46 +0200 Subject: [PATCH 26/39] Added mocked imposter version to dev.yml and fix a typo in decoders response (#6895) Added imposter version to dev.yml and fix a typo in decoders response --- .../decoders/{get_decorer_raw.txt => get_decoders_raw.txt} | 0 docker/imposter/wazuh-config.yml | 2 +- docker/osd-dev/dev.yml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename docker/imposter/decoders/{get_decorer_raw.txt => get_decoders_raw.txt} (100%) diff --git a/docker/imposter/decoders/get_decorer_raw.txt b/docker/imposter/decoders/get_decoders_raw.txt similarity index 100% rename from docker/imposter/decoders/get_decorer_raw.txt rename to docker/imposter/decoders/get_decoders_raw.txt diff --git a/docker/imposter/wazuh-config.yml b/docker/imposter/wazuh-config.yml index a538b3fafe..8f99c6897e 100755 --- a/docker/imposter/wazuh-config.yml +++ b/docker/imposter/wazuh-config.yml @@ -291,7 +291,7 @@ resources: raw: true response: statusCode: 200 - staticFile: rules/get_rule_raw.txt + staticFile: decoders/get_decoders_raw.txt # Update decoders file - method: PUT diff --git a/docker/osd-dev/dev.yml b/docker/osd-dev/dev.yml index 92c29e45af..24d9c2821e 100755 --- a/docker/osd-dev/dev.yml +++ b/docker/osd-dev/dev.yml @@ -26,7 +26,7 @@ services: - '--es.all' imposter: - image: outofcoffee/imposter + image: outofcoffee/imposter:3.44.1 # <<: *logging hostname: imposter-osd-${OS_VERSION} From b05489bcd070f1ffc58a92dd6261d7fd0980f109 Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:39:59 +0200 Subject: [PATCH 27/39] Bump 4.9.0 rev 04 (#6896) chore: bump 4.9.0 rev 04 --- CHANGELOG.md | 2 +- plugins/main/opensearch_dashboards.json | 2 +- plugins/main/package.json | 2 +- plugins/wazuh-check-updates/opensearch_dashboards.json | 2 +- plugins/wazuh-check-updates/package.json | 2 +- plugins/wazuh-core/opensearch_dashboards.json | 2 +- plugins/wazuh-core/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afbb1bb8ff..00c3ad8398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Wazuh app project will be documented in this file. -## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 03 +## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 04 ### Added diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index 91947725d3..bff08ae75c 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuh", - "version": "4.9.0-03", + "version": "4.9.0-04", "opensearchDashboardsVersion": "opensearchDashboards", "configPath": ["wazuh"], "requiredPlugins": [ diff --git a/plugins/main/package.json b/plugins/main/package.json index b0fa218cae..d1b054f68b 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,7 +1,7 @@ { "name": "wazuh", "version": "4.9.0", - "revision": "03", + "revision": "04", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index 9062d1cefc..d9d7a0a912 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.9.0-03", + "version": "4.9.0-04", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index 653f5519ec..6e786e03e8 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-check-updates", "version": "4.9.0", - "revision": "03", + "revision": "04", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index a673911d34..ad4c695c65 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.9.0-03", + "version": "4.9.0-04", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index bd7ac1706f..623914a750 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-core", "version": "4.9.0", - "revision": "03", + "revision": "04", "pluginPlatform": { "version": "2.13.0" }, From bc925066d734c1e45942a377b652b4f68e148480 Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:59:43 +0200 Subject: [PATCH 28/39] Bump 4.9.0 rev 05 (#6904) chore: bump 4.9.0 rev 05 --- CHANGELOG.md | 2 +- plugins/main/opensearch_dashboards.json | 2 +- plugins/main/package.json | 2 +- plugins/wazuh-check-updates/opensearch_dashboards.json | 2 +- plugins/wazuh-check-updates/package.json | 2 +- plugins/wazuh-core/opensearch_dashboards.json | 2 +- plugins/wazuh-core/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00c3ad8398..3201b22788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Wazuh app project will be documented in this file. -## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 04 +## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 05 ### Added diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index bff08ae75c..bd80d9627e 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuh", - "version": "4.9.0-04", + "version": "4.9.0-05", "opensearchDashboardsVersion": "opensearchDashboards", "configPath": ["wazuh"], "requiredPlugins": [ diff --git a/plugins/main/package.json b/plugins/main/package.json index d1b054f68b..c25060bb57 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,7 +1,7 @@ { "name": "wazuh", "version": "4.9.0", - "revision": "04", + "revision": "05", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index d9d7a0a912..2248450d09 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.9.0-04", + "version": "4.9.0-05", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index 6e786e03e8..13301b2265 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-check-updates", "version": "4.9.0", - "revision": "04", + "revision": "05", "pluginPlatform": { "version": "2.13.0" }, diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index ad4c695c65..f0a467eb07 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.9.0-04", + "version": "4.9.0-05", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index 623914a750..bb512113bc 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,7 +1,7 @@ { "name": "wazuh-core", "version": "4.9.0", - "revision": "04", + "revision": "05", "pluginPlatform": { "version": "2.13.0" }, From 5360fa7e20d5bf71aaa813307cc3bb89c1e84bce Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Mon, 12 Aug 2024 13:22:06 +0200 Subject: [PATCH 29/39] Fixed always disabled property from Active response (#6901) * Render from disabled response was deleted and description changes * Changes title and add changelog --- CHANGELOG.md | 4 + .../active-response-active-response.js | 7 +- .../configuration/configuration-settings.js | 90 +++++++++---------- 3 files changed, 49 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af5c4ff81..93c9ca9767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to the Wazuh app project will be documented in this file. - Support for Wazuh 4.9.1 +### Fixed + +- Fixed rendering an active response as disabled when is active [#6901](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6901) + ## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 03 ### Added diff --git a/plugins/main/public/controllers/management/components/management/configuration/active-response/active-response-active-response.js b/plugins/main/public/controllers/management/components/management/configuration/active-response/active-response-active-response.js index 7d5f26790e..eff4d0a323 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/active-response/active-response-active-response.js +++ b/plugins/main/public/controllers/management/components/management/configuration/active-response/active-response-active-response.js @@ -26,11 +26,6 @@ import withWzConfig from '../util-hocs/wz-config'; import { webDocumentationLink } from '../../../../../../../common/services/web_documentation'; const mainSettings = [ - { - field: 'disabled', - label: 'Status of this active response', - render: renderValueNoThenEnabled, - }, { field: 'command', label: 'Command to execute' }, { field: 'location', label: 'Execute the command on this location' }, { field: 'agent_id', label: 'Agent ID on which execute the command' }, @@ -93,7 +88,7 @@ class WzConfigurationActiveResponseActiveResponse extends Component { currentConfig['analysis-active_response']['active-response'].length ? ( hasAgentSupportModule(agent, WAZUH_MODULES_ID.OPEN_SCAP) + when: agent => hasAgentSupportModule(agent, WAZUH_MODULES_ID.OPEN_SCAP), }, { name: 'CIS-CAT', description: 'Configuration assessment using CIS scanner and SCAP checks', - goto: 'cis-cat' - } - ] + goto: 'cis-cat', + }, + ], }, { title: 'System threats and incident response', @@ -122,45 +122,45 @@ export default [ description: 'Discover what applications are affected by well-known vulnerabilities', goto: 'vulnerabilities', - when: 'manager' + when: 'manager', }, { name: 'Osquery', description: 'Expose an operating system as a high-performance relational database', - goto: 'osquery' + goto: 'osquery', }, { name: 'Inventory data', description: 'Gather relevant information about system operating system, hardware, networking and packages', - goto: 'inventory' + goto: 'inventory', }, { - name: 'Active Response', + name: 'Active response', description: 'Active threat addressing by immediate response', goto: 'active-response', - when: 'manager' + when: 'manager', }, { name: 'Active response', description: 'Active threat addressing by immediate response', goto: 'active-response-agent', - when: 'agent' + when: 'agent', }, { name: 'Commands', description: 'Configuration options of the Command wodle', - goto: 'commands' + goto: 'commands', }, { name: 'Docker listener', description: 'Monitor and collect the activity from Docker containers such as creation, running, starting, stopping or pausing events', goto: 'docker-listener', - when: agent => hasAgentSupportModule(agent, WAZUH_MODULES_ID.DOCKER) - } - ] + when: agent => hasAgentSupportModule(agent, WAZUH_MODULES_ID.DOCKER), + }, + ], }, { title: 'Log data analysis', @@ -170,22 +170,22 @@ export default [ name: 'Log collection', description: 'Log analysis from text files, Windows events or syslog outputs', - goto: 'log-collection' + goto: 'log-collection', }, { name: 'Integrity monitoring', description: 'Identify changes in content, permissions, ownership, and attributes of files', - goto: 'integrity-monitoring' + goto: 'integrity-monitoring', }, { name: 'Agentless', description: 'Run integrity checks on devices such as routers, firewalls and switches', goto: 'agentless', - when: 'manager' - } - ] + when: 'manager', + }, + ], }, { title: 'Cloud security monitoring', @@ -195,32 +195,30 @@ export default [ name: 'Amazon S3', description: 'Security events related to Amazon AWS services, collected directly via AWS API', - goto: 'aws-s3' + goto: 'aws-s3', }, { name: 'Azure Logs', description: 'Configuration options of the Azure Logs wodle', goto: 'azure-logs', - when: 'manager' + when: 'manager', }, { name: 'Google Cloud Pub/Sub', description: 'Configuration options of the Google Cloud Pub/Sub module', - goto: 'gcp-pubsub' + goto: 'gcp-pubsub', }, { name: 'GitHub', - description: - 'Detect threats targeting GitHub organizations', - goto: 'github' + description: 'Detect threats targeting GitHub organizations', + goto: 'github', }, { name: 'Office 365', - description: - 'Configuration options of the Office 365 module', + description: 'Configuration options of the Office 365 module', goto: 'office365', - when: 'manager' - } - ] - } + when: 'manager', + }, + ], + }, ]; From 2f0141158f015f7744b8f9379d0375742057cafe Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Tue, 13 Aug 2024 09:15:38 +0200 Subject: [PATCH 30/39] Changed windows-agent-deployment command (#6905) * Repair windows agent deployment command * Added changelog * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../services/register-agent-os-commands-services.test.ts | 4 ++-- .../services/register-agent-os-commands-services.tsx | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c9ca9767..316da08320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed +- Fixed windows-agent-deployment-command from deploy new agent [#6905](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6905) - Fixed rendering an active response as disabled when is active [#6901](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6901) ## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 03 diff --git a/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.test.ts b/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.test.ts index cea94326b9..0d7bf848de 100644 --- a/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.test.ts +++ b/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.test.ts @@ -145,7 +145,7 @@ describe('getLinuxStartCommand', () => { describe('getWindowsInstallCommand', () => { it('should return the correct install command', () => { - let expected = `Invoke-WebRequest -Uri ${test.urlPackage} -OutFile \${env.tmp}\\wazuh-agent; msiexec.exe /i \${env.tmp}\\wazuh-agent /q ${test.optionals.serverAddress} ${test.optionals.wazuhPassword} ${test.optionals.agentGroups} ${test.optionals.agentName} `; + let expected = `Invoke-WebRequest -Uri ${test.urlPackage} -OutFile \$env:tmp\\wazuh-agent; msiexec.exe /i \$env:tmp\\wazuh-agent /q ${test.optionals.serverAddress} ${test.optionals.wazuhPassword} ${test.optionals.agentGroups} ${test.optionals.agentName} `; const withAllOptionals = getWindowsInstallCommand(test); expect(withAllOptionals).toEqual(expected); @@ -153,7 +153,7 @@ describe('getWindowsInstallCommand', () => { delete test.optionals.wazuhPassword; delete test.optionals.agentName; - expected = `Invoke-WebRequest -Uri ${test.urlPackage} -OutFile \${env.tmp}\\wazuh-agent; msiexec.exe /i \${env.tmp}\\wazuh-agent /q ${test.optionals.serverAddress} ${test.optionals.agentGroups} `; + expected = `Invoke-WebRequest -Uri ${test.urlPackage} -OutFile \$env:tmp\\wazuh-agent; msiexec.exe /i \$env:tmp\\wazuh-agent /q ${test.optionals.serverAddress} ${test.optionals.agentGroups} `; const withServerAddresAndAgentGroupsOptions = getWindowsInstallCommand(test); diff --git a/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.tsx b/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.tsx index f3ef7c34f3..85fe46a8ba 100644 --- a/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.tsx +++ b/plugins/main/public/components/endpoints-summary/register-agent/services/register-agent-os-commands-services.tsx @@ -111,7 +111,7 @@ export const getWindowsInstallCommand = ( props: tOSEntryInstallCommand, ) => { const { optionals, urlPackage, name } = props; - return `Invoke-WebRequest -Uri ${urlPackage} -OutFile \${env.tmp}\\wazuh-agent; msiexec.exe /i \${env.tmp}\\wazuh-agent /q ${ + return `Invoke-WebRequest -Uri ${urlPackage} -OutFile \$env:tmp\\wazuh-agent; msiexec.exe /i \$env:tmp\\wazuh-agent /q ${ optionals && getAllOptionals(optionals, name) }`; }; From 7d47823eb4e1d69001ce244be15c0eddc27234cd Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:21:32 +0200 Subject: [PATCH 31/39] Fix error generating dashboard reports on Firefox (#6902) * fix(reporting): fix an error generating the dashboard reports on Firefox - Add dom-to-image-more dependency - Replace the library to generate de screenshots of the dashboard visualizations - Apply a fix related to cropped screenshots on Firefox * fix(reporting): remove embedded dom-to-image dependency * chore(changelog): add entry * fix(reporting): remove undefined variable * fix(reporting): remove dom-to-image-more dependency from package and embed on the source code * fix(reporting): change KPIs label color when generating a report on dark mode * fix(visualizations): set metric label color to green on some visualziations of HIPAA and NIST 800-53 applications * remove(tsc): unused visualization definition * fix(reporting): add license header to dom-to-image-more embedded dependency --- CHANGELOG.md | 4 +- plugins/main/public/app.js | 2 - .../modules/buttons/generate_report.tsx | 4 +- .../hipaa/dashboards/dashboard-panels.ts | 19 +- .../nist/dashboards/dashboard-panels.ts | 38 +- .../tsc/dashboards/dashboard-panels.ts | 76 - .../main/public/react-services/reporting.js | 41 +- .../main/public/utils/dom-to-image-more.js | 1550 +++++++++++++++++ plugins/main/public/utils/dom-to-image.js | 806 --------- 9 files changed, 1627 insertions(+), 913 deletions(-) create mode 100644 plugins/main/public/utils/dom-to-image-more.js delete mode 100644 plugins/main/public/utils/dom-to-image.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 3201b22788..be768cfac5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,10 +20,11 @@ All notable changes to the Wazuh app project will be documented in this file. - Added support for agents to Office 365 [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) - Added pinned agent data validation when rendering the Inventory data, Stats and Configuration tabs in Agent preview of Endpoints Summary [#6800](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6800) - Added wz-link component to make redirections [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) +- Add embedded and customized `dom-to-image-more` dependency [#6902](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6902) ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) [#6883](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6883) [#6889](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6889) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6845](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6845) [#6857](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6857) [#6847](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6847) [#6865](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6865) [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848) [#6843](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6843) [#6878](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6878) [#6883](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6883) [#6889](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6889) [#6902](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6902) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) @@ -81,6 +82,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Removed the `App logs` application [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) - Removed API endpoint GET /utils/logs/ui [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) - Removed API endpoint GET /utils/logs [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Removed embedded `dom-to-image` dependency [#6902](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6902) ## Wazuh v4.8.1 - OpenSearch Dashboards 2.10.0 - Revision 04 diff --git a/plugins/main/public/app.js b/plugins/main/public/app.js index efc0d877fd..1fe4f431c0 100644 --- a/plugins/main/public/app.js +++ b/plugins/main/public/app.js @@ -15,5 +15,3 @@ import './styles'; import './utils/fontawesome/scss/font-awesome.scss'; // Dev tools import './utils/codemirror'; -// Require lib to dashboards PDFs -require('./utils/dom-to-image.js'); diff --git a/plugins/main/public/components/common/modules/buttons/generate_report.tsx b/plugins/main/public/components/common/modules/buttons/generate_report.tsx index 311658588f..097bae7d6a 100644 --- a/plugins/main/public/components/common/modules/buttons/generate_report.tsx +++ b/plugins/main/public/components/common/modules/buttons/generate_report.tsx @@ -38,7 +38,9 @@ export const ButtonModuleGenerateReport = connect(mapStateToProps)( const defaultTextColor = '#DFE5EF'; //Patch to fix dark backgrounds in visualizations dark-mode pdf reports - const $labels = $('.euiButtonEmpty__text, .echLegendItem'); + const $labels = $( + '.euiButtonEmpty__text, .echLegendItem, div.mtrVis__value ~ div', + ); const $vizBackground = $('.echChartBackground'); const defaultVizBackground = $vizBackground.css('background-color'); diff --git a/plugins/main/public/components/overview/hipaa/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/hipaa/dashboards/dashboard-panels.ts index dcd53ff99c..ca68cf0d8b 100644 --- a/plugins/main/public/components/overview/hipaa/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/hipaa/dashboards/dashboard-panels.ts @@ -366,10 +366,21 @@ const getVisStateStats = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', - colorsRange: [{ type: 'range', from: 0, to: 10000 }], - labels: { show: true }, + colorSchema: 'Greens', + metricColorMode: 'Labels', + colorsRange: [ + { + from: 0, + to: 0, + }, + { + from: 0, + to: 0, + }, + ], + labels: { + show: true, + }, invertColors: false, style: { bgFill: '#000', diff --git a/plugins/main/public/components/overview/nist/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/nist/dashboards/dashboard-panels.ts index 34d5069697..f7271f7f73 100644 --- a/plugins/main/public/components/overview/nist/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/nist/dashboards/dashboard-panels.ts @@ -554,10 +554,21 @@ const getVisStateMetrics = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', - colorsRange: [{ type: 'range', from: 0, to: 10000 }], - labels: { show: true }, + colorSchema: 'Greens', + metricColorMode: 'Labels', + colorsRange: [ + { + from: 0, + to: 0, + }, + { + from: 0, + to: 0, + }, + ], + labels: { + show: true, + }, invertColors: false, style: { bgFill: '#000', @@ -722,10 +733,21 @@ const getVisStateAgentStats = (indexPatternId: string) => { metric: { percentageMode: false, useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', - colorsRange: [{ type: 'range', from: 0, to: 10000 }], - labels: { show: true }, + colorSchema: 'Greens', + metricColorMode: 'Labels', + colorsRange: [ + { + from: 0, + to: 0, + }, + { + from: 0, + to: 0, + }, + ], + labels: { + show: true, + }, invertColors: false, style: { bgFill: '#000', diff --git a/plugins/main/public/components/overview/tsc/dashboards/dashboard-panels.ts b/plugins/main/public/components/overview/tsc/dashboards/dashboard-panels.ts index b7470cdc8b..488c7c0e68 100644 --- a/plugins/main/public/components/overview/tsc/dashboards/dashboard-panels.ts +++ b/plugins/main/public/components/overview/tsc/dashboards/dashboard-panels.ts @@ -547,82 +547,6 @@ const getVisStateRequirementsByAgent = (indexPatternId: string) => { ], }, }; - return { - title: 'Stats', - type: 'metric', - params: { - metric: { - percentageMode: false, - useRanges: false, - colorSchema: 'Green to Red', - metricColorMode: 'None', - colorsRange: [{ type: 'range', from: 0, to: 10000 }], - labels: { show: true }, - invertColors: false, - style: { - bgFill: '#000', - bgColor: false, - labelColor: false, - subText: '', - fontSize: 20, - }, - }, - dimensions: { - metrics: [ - { - type: 'vis_dimension', - accessor: 0, - format: { id: 'number', params: {} }, - }, - { - type: 'vis_dimension', - accessor: 1, - format: { id: 'number', params: {} }, - }, - ], - }, - addTooltip: true, - addLegend: false, - type: 'metric', - }, - uiState: {}, - data: { - searchSource: { - query: { - language: 'kuery', - query: '', - }, - filter: [], - index: indexPatternId, - }, - references: [ - { - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - id: indexPatternId, - }, - ], - aggs: [ - { - id: '1', - enabled: true, - type: 'count', - schema: 'metric', - params: { customLabel: 'Total alerts' }, - }, - { - id: '2', - enabled: true, - type: 'max', - schema: 'metric', - params: { - field: 'rule.level', - customLabel: 'Max rule level detected', - }, - }, - ], - }, - }; }; const getVisStateAgentTopRuleGroups = (indexPatternId: string) => { diff --git a/plugins/main/public/react-services/reporting.js b/plugins/main/public/react-services/reporting.js index 2477701c6e..a5436236a5 100644 --- a/plugins/main/public/react-services/reporting.js +++ b/plugins/main/public/react-services/reporting.js @@ -19,7 +19,7 @@ import { UI_LOGGER_LEVELS } from '../../common/constants'; import { UI_ERROR_SEVERITIES } from './error-orchestrator/types'; import { getErrorOrchestrator } from './common-services'; import store from '../redux/store'; -import domtoimage from '../utils/dom-to-image'; +import domtoimage from '../utils/dom-to-image-more'; import dateMath from '@elastic/datemath'; import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiLink } from '@elastic/eui'; @@ -116,7 +116,18 @@ export class ReportingService { return await Promise.all( Array.from(domVisualizations).map(async node => { return { - element: await domtoimage.toPng(node), + /* WORKAROUND: Defining the width and height resolves a bug + related to cropped screenshot on Firefox. + + This solution is based on + https://github.com/1904labs/dom-to-image-more/issues/160#issuecomment-1922491067 + + See https://github.com/wazuh/wazuh-dashboard-plugins/issues/6900#issuecomment-2275495245 + */ + element: await domtoimage.toPng(node, { + width: node.clientWidth, + height: node.clientHeight, + }), width: node.clientWidth, height: node.clientHeight, title: node?.parentNode?.parentNode?.parentNode?.querySelector( @@ -140,13 +151,13 @@ export class ReportingService { const timeFilter = dataSourceContext.time && dataSourceContext.indexPattern.timeFieldName ? buildRangeFilter( - { - name: dataSourceContext.indexPattern.timeFieldName, - type: 'date', - }, - dataSourceContext.time, - dataSourceContext.indexPattern, - ) + { + name: dataSourceContext.indexPattern.timeFieldName, + type: 'date', + }, + dataSourceContext.time, + dataSourceContext.indexPattern, + ) : null; // Build the filters to use in the server side // Based on https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.13.0/src/plugins/data/public/query/query_service.ts#L103-L113 @@ -166,12 +177,12 @@ export class ReportingService { tab === 'syscollector' ? { to: dataSourceContext.time.to, from: dataSourceContext.time.from } : { - to: dateMath.parse(dataSourceContext.time.to, { - roundUp: true, - forceNow: getForceNow(), - }), - from: dateMath.parse(dataSourceContext.time.from), - }; + to: dateMath.parse(dataSourceContext.time.to, { + roundUp: true, + forceNow: getForceNow(), + }), + from: dateMath.parse(dataSourceContext.time.from), + }; const data = { array: visualizations, diff --git a/plugins/main/public/utils/dom-to-image-more.js b/plugins/main/public/utils/dom-to-image-more.js new file mode 100644 index 0000000000..0aaa8de378 --- /dev/null +++ b/plugins/main/public/utils/dom-to-image-more.js @@ -0,0 +1,1550 @@ +/* +The MIT License (MIT) + +Copyright 2018 Marc Brooks +https://about.me/idisposable + +Copyright 2015 Anatolii Saienko +https://github.com/tsayen + +Copyright 2012 Paul Bakaus +http://paulbakaus.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// dom-to-image-more 3.3.1 +// It contains some customization by Wazuh +(function (global) { + 'use strict'; + + const util = newUtil(); + const inliner = newInliner(); + const fontFaces = newFontFaces(); + const images = newImages(); + + // Default impl options + const defaultOptions = { + // Default is to copy default styles of elements + copyDefaultStyles: true, + // Default is to fail on error, no placeholder + imagePlaceholder: undefined, + // Default cache bust is false, it will use the cache + cacheBust: false, + // Use (existing) authentication credentials for external URIs (CORS requests) + useCredentials: false, + // Use (existing) authentication credentials for external URIs (CORS requests) on some filtered requests only + useCredentialsFilters: [], + // Default resolve timeout + httpTimeout: 30000, + // Style computation cache tag rules (options are strict, relaxed) + styleCaching: 'strict', + // Default cors config is to request the image address directly + corsImg: undefined, + // Callback for adjustClonedNode eventing (to allow adjusting clone's properties) + adjustClonedNode: undefined, + }; + + const domtoimage = { + toSvg: toSvg, + toPng: toPng, + toJpeg: toJpeg, + toBlob: toBlob, + toPixelData: toPixelData, + toCanvas: toCanvas, + impl: { + fontFaces: fontFaces, + images: images, + util: util, + inliner: inliner, + urlCache: [], + options: {}, + }, + }; + + if (typeof exports === 'object' && typeof module === 'object') { + module.exports = domtoimage; // eslint-disable-line no-undef + } else { + global.domtoimage = domtoimage; + } + + // support node and browsers + const ELEMENT_NODE = + (typeof Node !== 'undefined' ? Node.ELEMENT_NODE : undefined) || 1; + const getComputedStyle = + (typeof global !== 'undefined' ? global.getComputedStyle : undefined) || + (typeof window !== 'undefined' ? window.getComputedStyle : undefined) || + globalThis.getComputedStyle; + const atob = + (typeof global !== 'undefined' ? global.atob : undefined) || + (typeof window !== 'undefined' ? window.atob : undefined) || + globalThis.atob; + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options + * @param {Function} options.filter - Should return true if passed node should be included in the output + * (excluding node means excluding it's children as well). Not called on the root node. + * @param {Function} options.onclone - Callback function which is called when the Document has been cloned for + * rendering, can be used to modify the contents that will be rendered without affecting the original + * source document. + * @param {String} options.bgcolor - color for the background, any valid CSS color value. + * @param {Number} options.width - width to be applied to node before rendering. + * @param {Number} options.height - height to be applied to node before rendering. + * @param {Object} options.style - an object whose properties to be copied to node's style before rendering. + * @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only), + defaults to 1.0. + * @param {Number} options.scale - a Number multiplier to scale up the canvas before rendering to reduce fuzzy images, defaults to 1.0. + * @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch + * @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url + * @param {String} options.styleCaching - set to 'strict', 'relaxed' to select style caching rules + * @param {Boolean} options.copyDefaultStyles - set to false to disable use of default styles of elements + * @param {Object} options.corsImg - When the image is restricted by the server from cross-domain requests, the proxy address is passed in to get the image + * - @param {String} url - eg: https://cors-anywhere.herokuapp.com/ + * - @param {Enumerator} method - get, post + * - @param {Object} headers - eg: { "Content-Type", "application/json;charset=UTF-8" } + * - @param {Object} data - post payload + * @param {Function} options.adjustClonedNode - callback for adjustClonedNode eventing (to allow adjusting clone's properties) + * @return {Promise} - A promise that is fulfilled with a SVG image data URL + * */ + function toSvg(node, options) { + const ownerWindow = domtoimage.impl.util.getWindow(node); + options = options || {}; + copyOptions(options); + let restorations = []; + return ( + Promise.resolve(node) + .then(ensureElement) + .then(function (clonee) { + return cloneNode(clonee, options, null, ownerWindow); + }) + // Wazuh + // Avoid downloading the embed fonts + // .then(embedFonts) + .then(inlineImages) + .then(applyOptions) + .then(makeSvgDataUri) + .then(restoreWrappers) + .then(clearCache) + ); + + function ensureElement(node) { + if (node.nodeType === ELEMENT_NODE) return node; + + const originalChild = node; + const originalParent = node.parentNode; + const wrappingSpan = document.createElement('span'); + originalParent.replaceChild(wrappingSpan, originalChild); + wrappingSpan.append(node); + restorations.push({ + parent: originalParent, + child: originalChild, + wrapper: wrappingSpan, + }); + return wrappingSpan; + } + + function restoreWrappers(result) { + // put the original children back where the wrappers were inserted + while (restorations.length > 0) { + const restoration = restorations.pop(); + restoration.parent.replaceChild(restoration.child, restoration.wrapper); + } + + return result; + } + + function clearCache(result) { + domtoimage.impl.urlCache = []; + removeSandbox(); + return result; + } + + function applyOptions(clone) { + if (options.bgcolor) { + clone.style.backgroundColor = options.bgcolor; + } + if (options.width) { + clone.style.width = `${options.width}px`; + } + if (options.height) { + clone.style.height = `${options.height}px`; + } + if (options.style) { + Object.keys(options.style).forEach(function (property) { + clone.style[property] = options.style[property]; + }); + } + + let onCloneResult = null; + + if (typeof options.onclone === 'function') { + onCloneResult = options.onclone(clone); + } + + return Promise.resolve(onCloneResult).then(function () { + return clone; + }); + } + + function makeSvgDataUri(node) { + let width = options.width || util.width(node); + let height = options.height || util.height(node); + + return Promise.resolve(node) + .then(function (svg) { + svg.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); + return new XMLSerializer().serializeToString(svg); + }) + .then(util.escapeXhtml) + .then(function (xhtml) { + const foreignObjectSizing = + (util.isDimensionMissing(width) + ? ' width="100%"' + : ` width="${width}"`) + + (util.isDimensionMissing(height) + ? ' height="100%"' + : ` height="${height}"`); + const svgSizing = + (util.isDimensionMissing(width) ? '' : ` width="${width}"`) + + (util.isDimensionMissing(height) ? '' : ` height="${height}"`); + return `${xhtml}`; + }) + .then(function (svg) { + return `data:image/svg+xml;charset=utf-8,${svg}`; + }); + } + } + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data. + * */ + function toPixelData(node, options) { + return draw(node, options).then(function (canvas) { + return canvas + .getContext('2d') + .getImageData(0, 0, util.width(node), util.height(node)).data; + }); + } + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a PNG image data URL + * */ + function toPng(node, options) { + return draw(node, options).then(function (canvas) { + return canvas.toDataURL(); + }); + } + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a JPEG image data URL + * */ + function toJpeg(node, options) { + return draw(node, options).then(function (canvas) { + return canvas.toDataURL( + 'image/jpeg', + (options ? options.quality : undefined) || 1.0, + ); + }); + } + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a PNG image blob + * */ + function toBlob(node, options) { + return draw(node, options).then(util.canvasToBlob); + } + + /** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a canvas object + * */ + function toCanvas(node, options) { + return draw(node, options); + } + + function copyOptions(options) { + // Copy options to impl options for use in impl + if (typeof options.copyDefaultStyles === 'undefined') { + domtoimage.impl.options.copyDefaultStyles = + defaultOptions.copyDefaultStyles; + } else { + domtoimage.impl.options.copyDefaultStyles = options.copyDefaultStyles; + } + + if (typeof options.imagePlaceholder === 'undefined') { + domtoimage.impl.options.imagePlaceholder = + defaultOptions.imagePlaceholder; + } else { + domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder; + } + + if (typeof options.cacheBust === 'undefined') { + domtoimage.impl.options.cacheBust = defaultOptions.cacheBust; + } else { + domtoimage.impl.options.cacheBust = options.cacheBust; + } + + if (typeof options.corsImg === 'undefined') { + domtoimage.impl.options.corsImg = defaultOptions.corsImg; + } else { + domtoimage.impl.options.corsImg = options.corsImg; + } + + if (typeof options.useCredentials === 'undefined') { + domtoimage.impl.options.useCredentials = defaultOptions.useCredentials; + } else { + domtoimage.impl.options.useCredentials = options.useCredentials; + } + + if (typeof options.useCredentialsFilters === 'undefined') { + domtoimage.impl.options.useCredentialsFilters = + defaultOptions.useCredentialsFilters; + } else { + domtoimage.impl.options.useCredentialsFilters = + options.useCredentialsFilters; + } + + if (typeof options.httpTimeout === 'undefined') { + domtoimage.impl.options.httpTimeout = defaultOptions.httpTimeout; + } else { + domtoimage.impl.options.httpTimeout = options.httpTimeout; + } + + if (typeof options.styleCaching === 'undefined') { + domtoimage.impl.options.styleCaching = defaultOptions.styleCaching; + } else { + domtoimage.impl.options.styleCaching = options.styleCaching; + } + } + + function draw(domNode, options) { + options = options || {}; + return toSvg(domNode, options) + .then(util.makeImage) + .then(function (image) { + const scale = typeof options.scale !== 'number' ? 1 : options.scale; + const canvas = newCanvas(domNode, scale); + const ctx = canvas.getContext('2d'); + ctx.msImageSmoothingEnabled = false; + ctx.imageSmoothingEnabled = false; + if (image) { + ctx.scale(scale, scale); + ctx.drawImage(image, 0, 0); + } + return canvas; + }); + + function newCanvas(node, scale) { + let width = options.width || util.width(node); + let height = options.height || util.height(node); + + // per https://www.w3.org/TR/CSS2/visudet.html#inline-replaced-width the default width should be 300px if height + // not set, otherwise should be 2:1 aspect ratio for whatever height is specified + if (util.isDimensionMissing(width)) { + width = util.isDimensionMissing(height) ? 300 : height * 2.0; + } + + if (util.isDimensionMissing(height)) { + height = width / 2.0; + } + + const canvas = document.createElement('canvas'); + canvas.width = width * scale; + canvas.height = height * scale; + + if (options.bgcolor) { + const ctx = canvas.getContext('2d'); + ctx.fillStyle = options.bgcolor; + ctx.fillRect(0, 0, canvas.width, canvas.height); + } + + return canvas; + } + } + + let sandbox = null; + + function cloneNode(node, options, parentComputedStyles, ownerWindow) { + const filter = options.filter; + if ( + node === sandbox || + util.isHTMLScriptElement(node) || + util.isHTMLStyleElement(node) || + util.isHTMLLinkElement(node) || + (parentComputedStyles !== null && filter && !filter(node)) + ) { + return Promise.resolve(); + } + + return Promise.resolve(node) + .then(makeNodeCopy) + .then(adjustCloneBefore) + .then(function (clone) { + return cloneChildren(clone, getParentOfChildren(node)); + }) + .then(adjustCloneAfter) + .then(function (clone) { + return processClone(clone, node); + }); + + function makeNodeCopy(original) { + if (util.isHTMLCanvasElement(original)) { + return util.makeImage(original.toDataURL()); + } + return original.cloneNode(false); + } + + function adjustCloneBefore(clone) { + if (options.adjustClonedNode) { + options.adjustClonedNode(node, clone, false); + } + return Promise.resolve(clone); + } + + function adjustCloneAfter(clone) { + if (options.adjustClonedNode) { + options.adjustClonedNode(node, clone, true); + } + return Promise.resolve(clone); + } + + function getParentOfChildren(original) { + if (util.isElementHostForOpenShadowRoot(original)) { + return original.shadowRoot; // jump "down" to #shadow-root + } + return original; + } + + function cloneChildren(clone, original) { + const originalChildren = getRenderedChildren(original); + let done = Promise.resolve(); + + if (originalChildren.length !== 0) { + const originalComputedStyles = getComputedStyle( + getRenderedParent(original), + ); + + util.asArray(originalChildren).forEach(function (originalChild) { + done = done.then(function () { + return cloneNode( + originalChild, + options, + originalComputedStyles, + ownerWindow, + ).then(function (clonedChild) { + if (clonedChild) { + clone.appendChild(clonedChild); + } + }); + }); + }); + } + + return done.then(function () { + return clone; + }); + + function getRenderedParent(original) { + if (util.isShadowRoot(original)) { + return original.host; // jump up from #shadow-root to its parent + } + return original; + } + + function getRenderedChildren(original) { + if (util.isShadowSlotElement(original)) { + return original.assignedNodes(); // shadow DOM has "assigned nodes" as rendered children + } + return original.childNodes; + } + } + + function processClone(clone, original) { + if (!util.isElement(clone) || util.isShadowSlotElement(original)) { + return Promise.resolve(clone); + } + + return Promise.resolve() + .then(cloneStyle) + .then(clonePseudoElements) + .then(copyUserInput) + .then(fixSvg) + .then(function () { + return clone; + }); + + function cloneStyle() { + copyStyle(original, clone); + + function copyFont(source, target) { + target.font = source.font; + target.fontFamily = source.fontFamily; + target.fontFeatureSettings = source.fontFeatureSettings; + target.fontKerning = source.fontKerning; + target.fontSize = source.fontSize; + target.fontStretch = source.fontStretch; + target.fontStyle = source.fontStyle; + target.fontVariant = source.fontVariant; + target.fontVariantCaps = source.fontVariantCaps; + target.fontVariantEastAsian = source.fontVariantEastAsian; + target.fontVariantLigatures = source.fontVariantLigatures; + target.fontVariantNumeric = source.fontVariantNumeric; + target.fontVariationSettings = source.fontVariationSettings; + target.fontWeight = source.fontWeight; + } + + function copyStyle(sourceElement, targetElement) { + const sourceComputedStyles = getComputedStyle(sourceElement); + if (sourceComputedStyles.cssText) { + targetElement.style.cssText = sourceComputedStyles.cssText; + copyFont(sourceComputedStyles, targetElement.style); // here we re-assign the font props. + } else { + copyUserComputedStyleFast( + options, + sourceElement, + sourceComputedStyles, + parentComputedStyles, + targetElement, + ); + + // Remove positioning of initial element, which stops them from being captured correctly + if (parentComputedStyles === null) { + ['inset-block', 'inset-block-start', 'inset-block-end'].forEach( + prop => targetElement.style.removeProperty(prop), + ); + ['left', 'right', 'top', 'bottom'].forEach(prop => { + if (targetElement.style.getPropertyValue(prop)) { + targetElement.style.setProperty(prop, '0px'); + } + }); + } + } + } + } + + function clonePseudoElements() { + const cloneClassName = util.uid(); + + [':before', ':after'].forEach(function (element) { + clonePseudoElement(element); + }); + + function clonePseudoElement(element) { + const style = getComputedStyle(original, element); + const content = style.getPropertyValue('content'); + + if (content === '' || content === 'none') { + return; + } + + const currentClass = clone.getAttribute('class') || ''; + clone.setAttribute('class', `${currentClass} ${cloneClassName}`); + + const styleElement = document.createElement('style'); + styleElement.appendChild(formatPseudoElementStyle()); + clone.appendChild(styleElement); + + function formatPseudoElementStyle() { + const selector = `.${cloneClassName}:${element}`; + const cssText = style.cssText + ? formatCssText() + : formatCssProperties(); + + return document.createTextNode(`${selector}{${cssText}}`); + + function formatCssText() { + return `${style.cssText} content: ${content};`; + } + + function formatCssProperties() { + const styleText = util + .asArray(style) + .map(formatProperty) + .join('; '); + return `${styleText};`; + + function formatProperty(name) { + const propertyValue = style.getPropertyValue(name); + const propertyPriority = style.getPropertyPriority(name) + ? ' !important' + : ''; + return `${name}: ${propertyValue}${propertyPriority}`; + } + } + } + } + } + + function copyUserInput() { + if (util.isHTMLTextAreaElement(original)) { + clone.innerHTML = original.value; + } + if (util.isHTMLInputElement(original)) { + clone.setAttribute('value', original.value); + } + } + + function fixSvg() { + if (util.isSVGElement(clone)) { + clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); + + if (util.isSVGRectElement(clone)) { + ['width', 'height'].forEach(function (attribute) { + const value = clone.getAttribute(attribute); + if (value) { + clone.style.setProperty(attribute, value); + } + }); + } + } + } + } + } + + function embedFonts(node) { + return fontFaces.resolveAll().then(function (cssText) { + if (cssText !== '') { + const styleNode = document.createElement('style'); + node.appendChild(styleNode); + styleNode.appendChild(document.createTextNode(cssText)); + } + return node; + }); + } + + function inlineImages(node) { + return images.inlineAll(node).then(function () { + return node; + }); + } + function newUtil() { + let uid_index = 0; + + return { + escape: escapeRegEx, + isDataUrl: isDataUrl, + canvasToBlob: canvasToBlob, + resolveUrl: resolveUrl, + getAndEncode: getAndEncode, + uid: uid, + delay: delay, + asArray: asArray, + escapeXhtml: escapeXhtml, + makeImage: makeImage, + width: width, + height: height, + getWindow: getWindow, + isElement: isElement, + isElementHostForOpenShadowRoot: isElementHostForOpenShadowRoot, + isShadowRoot: isShadowRoot, + isInShadowRoot: isInShadowRoot, + isHTMLElement: isHTMLElement, + isHTMLCanvasElement: isHTMLCanvasElement, + isHTMLInputElement: isHTMLInputElement, + isHTMLImageElement: isHTMLImageElement, + isHTMLLinkElement: isHTMLLinkElement, + isHTMLScriptElement: isHTMLScriptElement, + isHTMLStyleElement: isHTMLStyleElement, + isHTMLTextAreaElement: isHTMLTextAreaElement, + isShadowSlotElement: isShadowSlotElement, + isSVGElement: isSVGElement, + isSVGRectElement: isSVGRectElement, + isDimensionMissing: isDimensionMissing, + }; + + function getWindow(node) { + const ownerDocument = node ? node.ownerDocument : undefined; + return ( + (ownerDocument ? ownerDocument.defaultView : undefined) || + global || + window + ); + } + + function isElementHostForOpenShadowRoot(value) { + return isElement(value) && value.shadowRoot !== null; + } + + function isShadowRoot(value) { + return value instanceof getWindow(value).ShadowRoot; + } + + function isInShadowRoot(value) { + return ( + value !== null && + Object.prototype.hasOwnProperty.call(value, 'getRootNode') && + isShadowRoot(value.getRootNode()) + ); + } + + function isElement(value) { + return value instanceof getWindow(value).Element; + } + + function isHTMLCanvasElement(value) { + return value instanceof getWindow(value).HTMLCanvasElement; + } + + function isHTMLElement(value) { + return value instanceof getWindow(value).HTMLElement; + } + + function isHTMLImageElement(value) { + return value instanceof getWindow(value).HTMLImageElement; + } + + function isHTMLInputElement(value) { + return value instanceof getWindow(value).HTMLInputElement; + } + + function isHTMLLinkElement(value) { + return value instanceof getWindow(value).HTMLLinkElement; + } + + function isHTMLScriptElement(value) { + return value instanceof getWindow(value).HTMLScriptElement; + } + + function isHTMLStyleElement(value) { + return value instanceof getWindow(value).HTMLStyleElement; + } + + function isHTMLTextAreaElement(value) { + return value instanceof getWindow(value).HTMLTextAreaElement; + } + + function isShadowSlotElement(value) { + return ( + isInShadowRoot(value) && + value instanceof getWindow(value).HTMLSlotElement + ); + } + + function isSVGElement(value) { + return value instanceof getWindow(value).SVGElement; + } + + function isSVGRectElement(value) { + return value instanceof getWindow(value).SVGRectElement; + } + + function isDataUrl(url) { + return url.search(/^(data:)/) !== -1; + } + + function isDimensionMissing(value) { + return isNaN(value) || value <= 0; + } + + function asBlob(canvas) { + return new Promise(function (resolve) { + const binaryString = atob(canvas.toDataURL().split(',')[1]); + const length = binaryString.length; + const binaryArray = new Uint8Array(length); + + for (let i = 0; i < length; i++) { + binaryArray[i] = binaryString.charCodeAt(i); + } + + resolve( + new Blob([binaryArray], { + type: 'image/png', + }), + ); + }); + } + + function canvasToBlob(canvas) { + if (canvas.toBlob) { + return new Promise(function (resolve) { + canvas.toBlob(resolve); + }); + } + + return asBlob(canvas); + } + + function resolveUrl(url, baseUrl) { + const doc = document.implementation.createHTMLDocument(); + const base = doc.createElement('base'); + doc.head.appendChild(base); + const a = doc.createElement('a'); + doc.body.appendChild(a); + base.href = baseUrl; + a.href = url; + return a.href; + } + + function uid() { + return `u${fourRandomChars()}${uid_index++}`; + + function fourRandomChars() { + /* see https://stackoverflow.com/a/6248722/2519373 */ + return `0000${((Math.random() * Math.pow(36, 4)) << 0).toString( + 36, + )}`.slice(-4); + } + } + + function makeImage(uri) { + if (uri === 'data:,') { + return Promise.resolve(); + } + + return new Promise(function (resolve, reject) { + const image = new Image(); + if (domtoimage.impl.options.useCredentials) { + image.crossOrigin = 'use-credentials'; + } + image.onload = function () { + if (window && window.requestAnimationFrame) { + // In order to work around a Firefox bug (webcompat/web-bugs#119834) we + // need to wait one extra frame before it's safe to read the image data. + window.requestAnimationFrame(function () { + resolve(image); + }); + } else { + // If we don't have a window or requestAnimationFrame function proceed immediately. + resolve(image); + } + }; + image.onerror = reject; + image.src = uri; + }); + } + + function getAndEncode(url) { + let cacheEntry = domtoimage.impl.urlCache.find(function (el) { + return el.url === url; + }); + + if (!cacheEntry) { + cacheEntry = { + url: url, + promise: null, + }; + domtoimage.impl.urlCache.push(cacheEntry); + } + + if (cacheEntry.promise === null) { + if (domtoimage.impl.options.cacheBust) { + // Cache bypass so we dont have CORS issues with cached images + // Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache + url += (/\?/.test(url) ? '&' : '?') + new Date().getTime(); + } + + cacheEntry.promise = new Promise(function (resolve) { + const httpTimeout = domtoimage.impl.options.httpTimeout; + const request = new XMLHttpRequest(); + + request.onreadystatechange = done; + request.ontimeout = timeout; + request.responseType = 'blob'; + request.timeout = httpTimeout; + + if (domtoimage.impl.options.useCredentialsFilters.length > 0) { + domtoimage.impl.options.useCredentials = + domtoimage.impl.options.useCredentialsFilters.filter( + credentialsFilter => url.search(credentialsFilter) >= 0, + ).length > 0; + } + + if (domtoimage.impl.options.useCredentials) { + request.withCredentials = true; + } + + if ( + domtoimage.impl.options.corsImg && + url.indexOf('http') === 0 && + url.indexOf(window.location.origin) === -1 + ) { + const method = + ( + domtoimage.impl.options.corsImg.method || 'GET' + ).toUpperCase() === 'POST' + ? 'POST' + : 'GET'; + + request.open( + method, + (domtoimage.impl.options.corsImg.url || '').replace( + '#{cors}', + url, + ), + true, + ); + + let isJson = false; + const headers = domtoimage.impl.options.corsImg.headers || {}; + Object.keys(headers).forEach(function (key) { + if (headers[key].indexOf('application/json') !== -1) { + isJson = true; + } + request.setRequestHeader(key, headers[key]); + }); + + const corsData = handleJson( + domtoimage.impl.options.corsImg.data || '', + ); + + Object.keys(corsData).forEach(function (key) { + if (typeof corsData[key] === 'string') { + corsData[key] = corsData[key].replace('#{cors}', url); + } + }); + + request.send(isJson ? JSON.stringify(corsData) : corsData); + } else { + request.open('GET', url, true); + request.send(); + } + + let placeholder; + if (domtoimage.impl.options.imagePlaceholder) { + const split = domtoimage.impl.options.imagePlaceholder.split(/,/); + if (split && split[1]) { + placeholder = split[1]; + } + } + + function done() { + if (request.readyState !== 4) { + return; + } + + if (request.status >= 300) { + if (placeholder) { + resolve(placeholder); + } else { + fail( + `cannot fetch resource: ${url}, status: ${request.status}`, + ); + } + + return; + } + + const encoder = new FileReader(); + encoder.onloadend = function () { + resolve(encoder.result); + }; + encoder.readAsDataURL(request.response); + } + + function timeout() { + if (placeholder) { + resolve(placeholder); + } else { + fail( + `timeout of ${httpTimeout}ms occured while fetching resource: ${url}`, + ); + } + } + + function handleJson(data) { + try { + return JSON.parse(JSON.stringify(data)); + } catch (e) { + fail('corsImg.data is missing or invalid'); + return; + } + } + + function fail(message) { + console.error(message); + resolve(''); + } + }); + } + return cacheEntry.promise; + } + + function escapeRegEx(string) { + return string.replace(/([.*+?^${}()|[]\/\\])/g, '\\$1'); + } + + function delay(ms) { + return function (arg) { + return new Promise(function (resolve) { + setTimeout(function () { + resolve(arg); + }, ms); + }); + }; + } + + function asArray(arrayLike) { + const array = []; + const length = arrayLike.length; + for (let i = 0; i < length; i++) { + array.push(arrayLike[i]); + } + + return array; + } + + function escapeXhtml(string) { + return string + .replace(/%/g, '%25') + .replace(/#/g, '%23') + .replace(/\n/g, '%0A'); + } + + function width(node) { + const width = px(node, 'width'); + + if (!isNaN(width)) return width; + + const leftBorder = px(node, 'border-left-width'); + const rightBorder = px(node, 'border-right-width'); + return node.scrollWidth + leftBorder + rightBorder; + } + + function height(node) { + const height = px(node, 'height'); + + if (!isNaN(height)) return height; + + const topBorder = px(node, 'border-top-width'); + const bottomBorder = px(node, 'border-bottom-width'); + return node.scrollHeight + topBorder + bottomBorder; + } + + function px(node, styleProperty) { + if (node.nodeType === ELEMENT_NODE) { + let value = getComputedStyle(node).getPropertyValue(styleProperty); + if (value.slice(-2) === 'px') { + value = value.slice(0, -2); + return parseFloat(value); + } + } + + return NaN; + } + } + + function newInliner() { + const URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g; + + return { + inlineAll: inlineAll, + shouldProcess: shouldProcess, + impl: { + readUrls: readUrls, + inline: inline, + }, + }; + + function shouldProcess(string) { + return string.search(URL_REGEX) !== -1; + } + + function readUrls(string) { + const result = []; + let match; + while ((match = URL_REGEX.exec(string)) !== null) { + result.push(match[1]); + } + return result.filter(function (url) { + return !util.isDataUrl(url); + }); + } + + function inline(string, url, baseUrl, get) { + return Promise.resolve(url) + .then(function (urlValue) { + return baseUrl ? util.resolveUrl(urlValue, baseUrl) : urlValue; + }) + .then(get || util.getAndEncode) + .then(function (dataUrl) { + return string.replace(urlAsRegex(url), `$1${dataUrl}$3`); + }); + + function urlAsRegex(urlValue) { + return new RegExp( + `(url\\(['"]?)(${util.escape(urlValue)})(['"]?\\))`, + 'g', + ); + } + } + + function inlineAll(string, baseUrl, get) { + if (nothingToInline()) { + return Promise.resolve(string); + } + + return Promise.resolve(string) + .then(readUrls) + .then(function (urls) { + let done = Promise.resolve(string); + urls.forEach(function (url) { + done = done.then(function (prefix) { + return inline(prefix, url, baseUrl, get); + }); + }); + return done; + }); + + function nothingToInline() { + return !shouldProcess(string); + } + } + } + + function newFontFaces() { + return { + resolveAll: resolveAll, + impl: { + readAll: readAll, + }, + }; + + function resolveAll() { + return readAll() + .then(function (webFonts) { + return Promise.all( + webFonts.map(function (webFont) { + return webFont.resolve(); + }), + ); + }) + .then(function (cssStrings) { + return cssStrings.join('\n'); + }); + } + + function readAll() { + return Promise.resolve(util.asArray(document.styleSheets)) + .then(getCssRules) + .then(selectWebFontRules) + .then(function (rules) { + return rules.map(newWebFont); + }); + + function selectWebFontRules(cssRules) { + return cssRules + .filter(function (rule) { + return rule.type === CSSRule.FONT_FACE_RULE; + }) + .filter(function (rule) { + return inliner.shouldProcess(rule.style.getPropertyValue('src')); + }); + } + + function getCssRules(styleSheets) { + const cssRules = []; + styleSheets.forEach(function (sheet) { + if ( + Object.prototype.hasOwnProperty.call( + Object.getPrototypeOf(sheet), + 'cssRules', + ) + ) { + try { + util + .asArray(sheet.cssRules || []) + .forEach(cssRules.push.bind(cssRules)); + } catch (e) { + console.error( + `domtoimage: Error while reading CSS rules from ${sheet.href}`, + e.toString(), + ); + } + } + }); + return cssRules; + } + + function newWebFont(webFontRule) { + return { + resolve: function resolve() { + const baseUrl = (webFontRule.parentStyleSheet || {}).href; + return inliner.inlineAll(webFontRule.cssText, baseUrl); + }, + src: function () { + return webFontRule.style.getPropertyValue('src'); + }, + }; + } + } + } + + function newImages() { + return { + inlineAll: inlineAll, + impl: { + newImage: newImage, + }, + }; + + function newImage(element) { + return { + inline: inline, + }; + + function inline(get) { + if (util.isDataUrl(element.src)) { + return Promise.resolve(); + } + + return Promise.resolve(element.src) + .then(get || util.getAndEncode) + .then(function (dataUrl) { + return new Promise(function (resolve) { + element.onload = resolve; + // for any image with invalid src(such as ), just ignore it + element.onerror = resolve; + element.src = dataUrl; + }); + }); + } + } + + function inlineAll(node) { + if (!util.isElement(node)) { + return Promise.resolve(node); + } + + return inlineCSSProperty(node).then(function () { + if (util.isHTMLImageElement(node)) { + return newImage(node).inline(); + } else { + return Promise.all( + util.asArray(node.childNodes).map(function (child) { + return inlineAll(child); + }), + ); + } + }); + + function inlineCSSProperty(node) { + const properties = ['background', 'background-image']; + + const inliningTasks = properties.map(function (propertyName) { + const value = node.style.getPropertyValue(propertyName); + const priority = node.style.getPropertyPriority(propertyName); + + if (!value) { + return Promise.resolve(); + } + + return inliner.inlineAll(value).then(function (inlinedValue) { + node.style.setProperty(propertyName, inlinedValue, priority); + }); + }); + + return Promise.all(inliningTasks).then(function () { + return node; + }); + } + } + } + + function setStyleProperty(targetStyle, name, value, priority) { + const needs_prefixing = ['background-clip'].indexOf(name) >= 0; + if (priority) { + targetStyle.setProperty(name, value, priority); + if (needs_prefixing) { + targetStyle.setProperty(`-webkit-${name}`, value, priority); + } + } else { + targetStyle.setProperty(name, value); + if (needs_prefixing) { + targetStyle.setProperty(`-webkit-${name}`, value); + } + } + } + + function copyUserComputedStyleFast( + options, + sourceElement, + sourceComputedStyles, + parentComputedStyles, + targetElement, + ) { + const defaultStyle = domtoimage.impl.options.copyDefaultStyles + ? getDefaultStyle(options, sourceElement) + : {}; + const targetStyle = targetElement.style; + + util.asArray(sourceComputedStyles).forEach(function (name) { + const sourceValue = sourceComputedStyles.getPropertyValue(name); + const defaultValue = defaultStyle[name]; + const parentValue = parentComputedStyles + ? parentComputedStyles.getPropertyValue(name) + : undefined; + + // Ignore setting style property on clone node, if already it has a style (through adjustCloneNode) + const targetValue = targetStyle.getPropertyValue(name); + if (targetValue) return; + + // If the style does not match the default, or it does not match the parent's, set it. We don't know which + // styles are inherited from the parent and which aren't, so we have to always check both. + if ( + sourceValue !== defaultValue || + (parentComputedStyles && sourceValue !== parentValue) + ) { + const priority = sourceComputedStyles.getPropertyPriority(name); + setStyleProperty(targetStyle, name, sourceValue, priority); + } + }); + } + + let removeDefaultStylesTimeoutId = null; + let tagNameDefaultStyles = {}; + + const ascentStoppers = [ + // these come from https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements + 'ADDRESS', + 'ARTICLE', + 'ASIDE', + 'BLOCKQUOTE', + 'DETAILS', + 'DIALOG', + 'DD', + 'DIV', + 'DL', + 'DT', + 'FIELDSET', + 'FIGCAPTION', + 'FIGURE', + 'FOOTER', + 'FORM', + 'H1', + 'H2', + 'H3', + 'H4', + 'H5', + 'H6', + 'HEADER', + 'HGROUP', + 'HR', + 'LI', + 'MAIN', + 'NAV', + 'OL', + 'P', + 'PRE', + 'SECTION', + 'SVG', + 'TABLE', + 'UL', + // this is some non-standard ones + 'math', // intentionally lowercase, thanks Safari + 'svg', // in case we have an svg embedded element + // these are ultimate stoppers in case something drastic changes in how the DOM works + 'BODY', + 'HEAD', + 'HTML', + ]; + + function getDefaultStyle(options, sourceElement) { + const tagHierarchy = computeTagHierarchy(sourceElement); + const tagKey = computeTagKey(tagHierarchy); + if (tagNameDefaultStyles[tagKey]) { + return tagNameDefaultStyles[tagKey]; + } + + // We haven't cached the answer for that hierachy yet, build a + // sandbox (if not yet created), fill it with the hierarchy that + // matters, and grab the default styles associated + const sandboxWindow = ensureSandboxWindow(); + const defaultElement = constructElementHierachy( + sandboxWindow.document, + tagHierarchy, + ); + const defaultStyle = computeStyleForDefaults(sandboxWindow, defaultElement); + destroyElementHierarchy(defaultElement); + + tagNameDefaultStyles[tagKey] = defaultStyle; + return defaultStyle; + + function computeTagHierarchy(sourceNode) { + const tagNames = []; + + do { + if (sourceNode.nodeType === ELEMENT_NODE) { + const tagName = sourceNode.tagName; + tagNames.push(tagName); + + if (ascentStoppers.includes(tagName)) { + break; + } + } + + sourceNode = sourceNode.parentNode; + } while (sourceNode); + + return tagNames; + } + + function computeTagKey(tagHierarchy) { + if (options.styleCaching === 'relaxed') { + // pick up only the ascent-stopping element tag and the element tag itself + /* jshint unused:true */ + return tagHierarchy + .filter((_, i, a) => i === 0 || i === a.length - 1) + .join('>'); + } + // for all other cases, fall back the the entire path + return tagHierarchy.join('>'); // it's like CSS + } + + function constructElementHierachy(sandboxDocument, tagHierarchy) { + let element = sandboxDocument.body; + do { + const childTagName = tagHierarchy.pop(); + const childElement = sandboxDocument.createElement(childTagName); + element.appendChild(childElement); + element = childElement; + } while (tagHierarchy.length > 0); + + // Ensure that there is some content, so that properties like margin are applied. + // we use zero-width space to handle FireFox adding a pixel + element.textContent = '\u200b'; + return element; + } + + function computeStyleForDefaults(sandboxWindow, defaultElement) { + const defaultStyle = {}; + const defaultComputedStyle = + sandboxWindow.getComputedStyle(defaultElement); + + // Copy styles to an object, making sure that 'width' and 'height' are given the default value of 'auto', since + // their initial value is always 'auto' despite that the default computed value is sometimes an absolute length. + util.asArray(defaultComputedStyle).forEach(function (name) { + defaultStyle[name] = + name === 'width' || name === 'height' + ? 'auto' + : defaultComputedStyle.getPropertyValue(name); + }); + return defaultStyle; + } + + function destroyElementHierarchy(element) { + do { + const parentElement = element.parentElement; + if (parentElement !== null) { + parentElement.removeChild(element); + } + element = parentElement; + } while (element && element.tagName !== 'BODY'); + } + } + + function ensureSandboxWindow() { + if (sandbox) { + return sandbox.contentWindow; + } + + // figure out how this document is defined (doctype and charset) + const charsetToUse = document.characterSet || 'UTF-8'; + const docType = document.doctype; + const docTypeDeclaration = docType + ? `' + : ''; + + // Create a hidden sandbox