From d913dacd8a5b7d741814fa141ccc5047c99e5381 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 1 Oct 2024 12:23:59 +0200 Subject: [PATCH 1/3] Filter deprecated actions --- .../components/security/policies/edit-policy.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/main/public/components/security/policies/edit-policy.tsx b/plugins/main/public/components/security/policies/edit-policy.tsx index 17485f96d3..54ae297c85 100644 --- a/plugins/main/public/components/security/policies/edit-policy.tsx +++ b/plugins/main/public/components/security/policies/edit-policy.tsx @@ -130,16 +130,18 @@ export const EditPolicyFlyout = ({ policy, closeFlyout }) => { ), }; }) - .sort((a, b) => a.value.localeCompare(b.value)); + .sort((a, b) => a.value?.localeCompare(b.value)); setActions(actions); } const loadResources = () => { let allResources = []; - addedActions.forEach(x => { - const res = (availableActions[x.action] || {})['resources']; - allResources = allResources.concat(res); - }); + addedActions + .filter(x => !!availableActions[x.action]) // Remove configured actions no longer available on the API + .forEach(x => { + const res = availableActions[x.action]?.['resources']; + allResources = allResources.concat(res); + }); const allResourcesSet = new Set(allResources); const resources = Array.from(allResourcesSet) .map((x, idx) => { @@ -159,7 +161,7 @@ export const EditPolicyFlyout = ({ policy, closeFlyout }) => { ), }; }) - .sort((a, b) => a.value.localeCompare(b.value)); + .sort((a, b) => a.value?.localeCompare(b.value)); setResources(resources); }; From 529a8f0808fec317b5cba78093b56bda541d34f2 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 1 Oct 2024 12:46:43 +0200 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a25674f56..64f9a8354d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,8 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed - Fixed read-only users could not access to Statistics application [#7001](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7001) -- Fixed no-agent-alert spawn with selected agent in agent-welcome view[#7029](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7029) +- Fixed no-agent-alert spawn with selected agent in agent-welcome view [#7029](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7029) +- Fixed security policy exception when it contained deprecated actions [#7042](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7042) ### Removed From 45f56e80cb6b1544df11d2ce1151e503fc0773d7 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 1 Oct 2024 17:15:10 +0200 Subject: [PATCH 3/3] Update plugins/main/public/components/security/policies/edit-policy.tsx Co-authored-by: Guido Modarelli <38738725+guidomodarelli@users.noreply.github.com> --- .../main/public/components/security/policies/edit-policy.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/public/components/security/policies/edit-policy.tsx b/plugins/main/public/components/security/policies/edit-policy.tsx index 54ae297c85..ba8e95fbef 100644 --- a/plugins/main/public/components/security/policies/edit-policy.tsx +++ b/plugins/main/public/components/security/policies/edit-policy.tsx @@ -137,7 +137,7 @@ export const EditPolicyFlyout = ({ policy, closeFlyout }) => { const loadResources = () => { let allResources = []; addedActions - .filter(x => !!availableActions[x.action]) // Remove configured actions no longer available on the API + .filter(x => !!availableActions?.[x.action]) // Remove configured actions no longer available on the API .forEach(x => { const res = availableActions[x.action]?.['resources']; allResources = allResources.concat(res);