Skip to content

Commit

Permalink
Filter deprecated actions (#7042)
Browse files Browse the repository at this point in the history
* Filter deprecated actions

* Add changelog

* Update plugins/main/public/components/security/policies/edit-policy.tsx

Co-authored-by: Guido Modarelli <[email protected]>

---------

Co-authored-by: Guido Modarelli <[email protected]>
  • Loading branch information
asteriscos and guidomodarelli authored Oct 1, 2024
1 parent 0a402f1 commit 23c8dc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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:/wazuh/wazuh-dashboard-plugins/pull/7001)
- Fixed no-agent-alert spawn with selected agent in agent-welcome view[#7029](https:/wazuh/wazuh-dashboard-plugins/pull/7029)
- Fixed no-agent-alert spawn with selected agent in agent-welcome view [#7029](https:/wazuh/wazuh-dashboard-plugins/pull/7029)
- Fixed security policy exception when it contained deprecated actions [#7042](https:/wazuh/wazuh-dashboard-plugins/pull/7042)

### Removed

Expand Down
14 changes: 8 additions & 6 deletions plugins/main/public/components/security/policies/edit-policy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
};

Expand Down

0 comments on commit 23c8dc5

Please sign in to comment.