Skip to content

Add global FIM and system inventories #7368

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

Open
wants to merge 204 commits into
base: 4.13.0
Choose a base branch
from

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Mar 21, 2025

Description

This pull request adds global FIM and system inventories.

Changes:

  • Add FIM and system inventory data sources
  • Add new app IT Hygiene to Security operations category
  • Add IT Hygiene to agent menu
  • Add new settings to define the new index patterns:
    • system_inventory.pattern
    • fim.pattern
  • Add reusable components related to explore indexer data in tables to use in different use cases
  • Move hardware/software information from Inventory data to agent overview
  • Replace the FIM file details based on Wazuh server API data to Wazuh indexer in the agent welcome
  • Enhance useDataGrid to manage error on initialization
  • Add some reusable HOCs and hooks related to data source, index pattern and wrap component
  • Add sample data generator for FIM and system inventory states
  • Remove GET /api/syscollector endpoint
  • Remove POST /reports/agents/{agentID}/inventory API endpoint and extended reporting information related to syscollector
  • Remove Inventory data views and button from agent overview
    • Remove reporting
  • Remove example request related to syscollector from Dev Tools
  • Fix the validation of data source repository for vulnerabilities to use the vulnerabilities.pattern setting.
  • Add title prop to WzRibbon
  • Enhance useValueSuggestion hook to support boolean fields and add a workaround (:warning: low performance) to fetch suggestions for fields different to boolean or string

Side changes

  • Fix the selection of index pattern for vulnerabilities inventory data using a related index pattern to the defined in vulnerabilities.pattern setting instead of searching index pattern with title/id that contains vulnerabilities.
  • Unused side changes that could be useful in the future and were developed in the different iterations of the issue:
    • "Flex" layout to workaround a problem with EuiDataGrid and flex containr based in the usage of display:table
    • Create hook to create new filter manager instance
    • Create unfinished custom combo box input for using as filter in the WzSearchBar
    • Create hook to split the user and managed filter for using in the WzSearchBar
    • Create component to wrap the custom filter in the WzSearchBar

Issues Resolved

#27903

Evidence

FIM > Inventory
image
image

IT Hygiene > Dashboard

  • Overview
    image

  • Agent

image

IT Hygiene > Inventory
image
image
image

Agent overview
image
image
image

Dev Tools
image

New settings
image
image

Test

This pull request adds a sample data generator, see scripts/sample-data/README.md. The indexed sample data expects you use the imposter API.

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
Go to agent welcome and the hardware/system information should be displayed in a new panel
Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file
Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser)
Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.
Go to System inventory > IT Hygiene > Dashboard and test the queries, filters and the dashboard represents the expected data.
Go to System inventory > IT Hygiene > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.
With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt
With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt
With no System inventory indices and no index pattern, go to IT Hygiene > Dashboard and this should display a prompt
With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized
With no System inventory indices and index pattern, go to IT Hygiene > Inventory and this should display a prompt related to data source was not initialized

Details

⚫ Go to agent welcome and the hardware/system information should be displayed in a new panel

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser)

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to System inventory > IT Hygiene > Dashboard and test the queries, filters and the dashboard represents the expected data.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to System inventory > IT Hygiene > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and no index pattern, go to IT Hygiene > Dashboard and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and index pattern, go to IT Hygiene > Inventory and this should display a prompt related to data source was not initialized

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Desvelao added 20 commits March 11, 2025 08:58
- Replace FIM inventory table based on indexer data
- Add `fim.pattern` setting to define the FIM index pattern
…based on indexer data

- Replace the tables of agent system inventory based on indexer data
- Create sample datasets for system inventory
- Create a OpenSearch Dashboards client with ability to:
  - Saved objects/index patterns: create, delete, get all, exists
- Add the ability to create the index pattern into Wazuh dashboard
- Move repeated logic from datasets to common file
…licts because the this was created due to component is mounted 2 times triggering the creation 2 times in parallel
- Add useNewFilterManager hook
- Add additional tabs for document details
- Add data sources
- Add system inventory apps:
  - Hosts
  - Network
  - Software
  - Processes
- Split FIM inventory into files and registries
guidomodarelli and others added 19 commits April 24, 2025 15:04
Updates the type for `columnSchemaDefinitionsMap` from `Record<string, unknown>` to `Record<string, tDataGridColumn`.

Improves type safety and code clarity within data grid components.
Assigns `DataGridState` as the default for the generic type parameter, removing the need to specify it explicitly in common use cases.
Passes a unique identifier (`moduleId` or `tableId`) to the `useDataGrid` hook.
Retrieves the configured page size from local storage state management when the data grid initializes.
Ensures user preference for page size persists between sessions.
Updates the `tableId` prop to `tableID` for consistency with naming conventions.
Turns off the ESLint extension within the VS Code workspace.
- Refactor TableDataGrid component and create a new hook to create the
  new dashboard layout
Comment on lines +1971 to +1988
validate: SettingsValidator.compose(
SettingsValidator.isString,
SettingsValidator.isNotEmptyString,
SettingsValidator.hasNoSpaces,
SettingsValidator.noLiteralString('.', '..'),
SettingsValidator.noStartsWithString('-', '_', '+', '.'),
SettingsValidator.hasNotInvalidCharacters(
'\\',
'/',
'?',
'"',
'<',
'>',
'|',
',',
'#',
),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

You could unify all these Validates, extract them into a separate function, and reuse them where appropriate, since they are all the same, exactly the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right that the generated function validator is used for more settings and it could be refactored into a function. It could be enhanced in the future. For another hand, refactoring into a function, it could cause problem if the setting definitions are splitted on multiple plugins that can not access to the unified function. At this moment, all the settings are defined in the main/wazuh plugin so it could make sense to unify this definition. Taking into account the changes included in this PR, I do not consider this should delay the review.

Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 45.41% ( 411 / 905 )
Branches 41.09% ( 157 / 382 )
Functions 41.84% ( 136 / 325 )
Lines 45.59% ( 409 / 897 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 78.72% ( 185 / 235 )
Branches 62.72% ( 69 / 110 )
Functions 61.7% ( 29 / 47 )
Lines 78.72% ( 185 / 235 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 16.91% ( 5082 / 30049 )
Branches 10.39% ( 1990 / 19146 )
Functions 17.62% ( 1287 / 7304 )
Lines 17.17% ( 4969 / 28937 )

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.

Global queries - Dashboard add sections for fim and system inventory data (dashboard, inventory, events)
2 participants