Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frontend serverSecurity service #7026

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Sep 27, 2024

Description

This pull request adds a serverSecurity client to the wazuh-core plugin and expose it to manage the security of the Wazuh server is a composition of old services:

  • WzUserPermissions
  • useUserPermissions
  • useUserPermissionsRequirements
  • withUserAuthorizationPrompt
  • withUserLogged
  • withUserPermissions
  • withUserPermissionsRequirements
  • WzButtonPermissions
  • WzElementPermissions

Issues Resolved

#6959

Test

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

- Create basic types
- Create CoreServerSecurity implementation
- Create runtime dependencies of serverSecurity
  - hooks
    - useServerUserLogged,
    - useServerUserPermissions,
    - useServerUserPermissionsRequirements,
    - useServerUserPermissionsIsAdminRequirements,
  - hocs
   - withServerUserAuthorizationPrompt,
   - withServerUserLogged,
  - ui
    - ServerButtonPermissions
    - ServerElementPermissions
- Export the serverSecurity service in the lifecycle methods of core
  plugin
@Desvelao Desvelao self-assigned this Sep 27, 2024
@Desvelao Desvelao linked an issue Sep 27, 2024 that may be closed by this pull request
6 tasks
LoadingServerUserLogging,
}) => {
const withServerUserAuthorizationPromptChanged =
(permissions = null, othersPermissions = { isAdmininistrator: null }) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(permissions = null, othersPermissions = { isAdmininistrator: null }) =>
(permissions: Function | object | null = null, othersPermissions = { isAdmininistrator: null }) =>

Desvelao and others added 7 commits November 28, 2024 13:46
@Desvelao Desvelao marked this pull request as ready for review November 28, 2024 15:25
…to enhancement/6959-extract-common-services-frontend-server-security
@Desvelao Desvelao requested a review from a team December 11, 2024 13:02
Copy link
Contributor

Wazuh Engine plugin code coverage (Jest) test % values
Statements 8.63% ( 64 / 741 )
Branches 7.94% ( 22 / 277 )
Functions 1.87% ( 7 / 373 )
Lines 9.1% ( 64 / 703 )

Copy link
Contributor

Wazuh Fleet plugin code coverage (Jest) test % values
Statements 4.68% ( 9 / 192 )
Branches 16.66% ( 7 / 42 )
Functions 1.11% ( 1 / 90 )
Lines 4.76% ( 9 / 189 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 37.49% ( 820 / 2187 )
Branches 38.43% ( 467 / 1215 )
Functions 39.48% ( 261 / 661 )
Lines 37.73% ( 815 / 2160 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 13.43% ( 4028 / 29984 )
Branches 8.98% ( 1749 / 19460 )
Functions 12.97% ( 943 / 7266 )
Lines 13.6% ( 3926 / 28864 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract common services from main plugin
2 participants