From c609b920fbdf4abc2eccae74cc8563dcc2919893 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 8 Feb 2023 16:39:31 +0100 Subject: [PATCH 1/2] change RexExp --- public/react-services/wz-user-permissions.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react-services/wz-user-permissions.ts b/public/react-services/wz-user-permissions.ts index 1b720620ba..523ad0777d 100644 --- a/public/react-services/wz-user-permissions.ts +++ b/public/react-services/wz-user-permissions.ts @@ -21,7 +21,7 @@ export class WzUserPermissions{ const missingOrPermissions = WzUserPermissions.checkMissingUserPermissions(permission, userPermissions); return Array.isArray(missingOrPermissions) ? missingOrPermissions.length === permission.length : missingOrPermissions; } - + const isGenericResource = (permission.resource.match(':\\*') || []).index === permission.resource.length - 2 const actionName = typeof permission === 'string' ? permission : permission.action; @@ -48,8 +48,8 @@ export class WzUserPermissions{ const simplePermission = (resource: string) => { return ( ![actionResource, actionResourceAll].includes(resource) && - (resource.match(actionResource.replace('*', '\\*')) || - resource.match(actionResourceAll.replace('*', '\*'))) + (resource.match(actionResource.replace(/\*/g, '.+')) || + resource.match(actionResourceAll.replace(/\*/g, '.+'))) ); }; @@ -102,10 +102,10 @@ export class WzUserPermissions{ return userPermissions[actionName][actionResource] ? notAllowInWazuhPermissions(actionResource) : Object.keys(userPermissions[actionName]).some((resource) => { - return resource.match(actionResourceAll.replace('*', '\\*')) !== null; + return resource.match(actionResourceAll.replace(/\*/g, '.+')) !== null; }) ? Object.keys(userPermissions[actionName]).some((resource) => { - if (resource.match(actionResourceAll.replace('*', '\\*'))) { + if (resource.match(actionResourceAll.replace(/\*/g, '.+'))) { return notAllowInWazuhPermissions(resource); } }) From 3f8a77e9fe0d9cf5839840a45f891d86adc030a8 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Thu, 9 Feb 2023 11:28:53 +0100 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14540b78b4..54fb166ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- +- Changed of regular expression in RBAC. [#5201](https://github.com/wazuh/wazuh-kibana-app/pull/5201) ### Fixed