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 28 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

Changes:

  • Refactor the loading while getting the server API token using a similar render than the platform
Screenshot

image

  • Add documentation for dashboardSecurity service
  • Move server user authentication data to dashboardSecurity and serverSecurity services
  • Add hooks and HOCs to dashboardSecurity service

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
@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
guidomodarelli and others added 8 commits December 16, 2024 15:56
- move user authentication data to serverSecurity service
- move user account data to dashboardSecurity service
- move useServerUserPermissionsIsAdminRequirements from serverSecurity to useDashboardSecurityIsAdmin in dashboardSecurity service
- add useDashboardSecurityAccount in dashboardSecurity service
- fix documentation of http service
@yenienserrano yenienserrano self-requested a review December 20, 2024 11:56
guidomodarelli
guidomodarelli previously approved these changes Dec 20, 2024
Copy link
Contributor

@guidomodarelli guidomodarelli left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@guidomodarelli guidomodarelli left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 36.82% ( 816 / 2216 )
Branches 38.31% ( 467 / 1219 )
Functions 38.65% ( 259 / 670 )
Lines 37.06% ( 811 / 2188 )

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 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 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

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
3 participants