Skip to content

Handle case when version is missing#29181

Merged
Dwordcito merged 1 commit into
4.12.1from
bug/29102-vd-handle-missing-agent-version
Apr 15, 2025
Merged

Handle case when version is missing#29181
Dwordcito merged 1 commit into
4.12.1from
bug/29102-vd-handle-missing-agent-version

Conversation

@pereyra-m
Copy link
Copy Markdown
Contributor

Related issue
Closes #29102

Description

This PR handles the case when Wazuh-DB doesn't send the agent version.
This can happen if the agent is registered but didn't send the first keepalive.

@pereyra-m pereyra-m self-assigned this Apr 11, 2025
@pereyra-m pereyra-m linked an issue Apr 11, 2025 that may be closed by this pull request
3 tasks
Copy link
Copy Markdown
Contributor

@GabrielEValenzuela GabrielEValenzuela left a comment

Choose a reason for hiding this comment

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

The fix looks solid — I rechecked with the unit test case, and it confirms the root cause is now properly addressed. Great job, Mati!

data->m_agents.push_back(
{Utils::padString(std::to_string(agent.at("id").get<int>()), '0', 3),
agent.at("name"),
agent.contains("version") ? Utils::leftTrim(agent.at("version"), "Wazuh ") : "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch

@Dwordcito Dwordcito merged commit 1568fce into 4.12.1 Apr 15, 2025
26 checks passed
@Dwordcito Dwordcito deleted the bug/29102-vd-handle-missing-agent-version branch April 15, 2025 14:56
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.

Vulnerability detector: handle missing agent version from Wazuh-DB

4 participants